CCF - Context change notification RRS feed

  • Question

  • Hi,

    I have written a HostedControl application (App1) where I set the context and then fire context change notification, following is the code:

    setContext("<testItem>TestData</testItem>") ;

    FireChangeContext(new ContextEventArgs(Context));


    There is one more HostedControl application (App2) where I have overridden NotifyContextChange method so that this application gets notified for each context change.

    Further, I have hosted both these applications in Agent Desktop. When I select a customer, then App2 gets notified for context change as the customer data  gets uploaded in context. However when I fire contextchange command through App1, no context change notification is received in App2.

    Can someone point out the correct way of raising and receiving context change notifications? Also and pre-requisites for doing such process?


    Ashish Malhotra


    Friday, September 8, 2006 9:18 AM


  • Hi Ashish,

    To Raise a context change event, you need to create a new context, then Call FireContextChange..
    for example:

    This is a NotifyContextChange Event handler In a hosted control..

    public override void NotifyContextChange(Context context)


          // Here I am assigning the inbound context to a local var… You don’t need to do this, however I am simply adding something to the existing context.

          Localcontext = context;  


          base.NotifyContextChange (context);



    iTouchCount++; // here Im incrementing a var that I will add to the context.


    // Some display stuff so I can see whats going on

          textBox1.Text = context.GetContext();   

          textBox2.Text = iTouchCount.ToString();




    // here Im going to tiger a context change across the hosted apps..

    private void button1_Click(object sender, System.EventArgs e)



          // I create a new context, 

          Context Lclcontext = new Context();


          // Load it with what I want…



          // add something to it..

          Lclcontext["TouchCount"] = iTouchCount.ToString();


          // Create the new Context Arg..

          ContextEventArgs cx = new ContextEventArgs(Lclcontext);


          // Fire the Change Context Command…

          this.FireChangeContext( cx );


          // then call Notify to let my local control know the context change occurred ( note.. when you call FireChangeContext is does not call back to the control that called it.. )

          this.NotifyContextChange( Lclcontext );




    Hope that helps…


    Matt B..


    Thursday, September 14, 2006 2:46 PM