locked
Forcing an object to wait for a SystemState change RRS feed

  • Question

  • Hi,

    I have a class called CallManager, defined as followed:

    public class CallManager
    {
          private SystemState phoneCallTalking = new SystemState(SystemProperty.PhoneCallTalking);
         
          public CallManager ()
          {
                    phoneCallTalking.Changed += new ChangeEventHandler(phoneCallTalking_Changed);
          }

          void phoneCallTalking_Changed(object sender, ChangeEventArgs args)
          {
                //do some work
          }
    }


    in the Main function, i am doing:

    void Main ()
    {
              CallManager  cm = new CallManager  ();
            
              .....
    }

    My goal is to creat an object of CallManager  (cm), and to force it to wait until the state of SystemProperty.PhoneCallTalking is changed, and than it will fire the logic of its handler.

    the problem is that until the state is changed - I dont have the object cm anymore, the handler wont be called....
    How can I force the object to wait until the system state is changed?

    thanks guys.
            



         
       
    Tuesday, February 16, 2010 6:34 PM

Answers