Hi, there~

i'm writing an application which's used to record the *CallTalking*
time.
Here 's a piece of my code:
public void ListenCall()
{
callState = new
SystemState(SystemProperty.PhoneCallTalking);
callCount = new
SystemState(SystemProperty.PhoneActiveCallCount);

callState.Changed += new
ChangeEventHandler(callState_Changed);
callCount.Changed += new
ChangeEventHandler(callCount_Changed);
}

void callCount_Changed(object sender, ChangeEventArgs args)
{
if (args.NewValue != null && (int)args.NewValue == 1)
MessageBox.Show("Call Incoming...");
//**********
//if i removed or replaced the "MessageBox.Show(..).",
//the callState.Changed would never be triggled
//BUG?!
//**********
}

void callState_Changed(object sender, ChangeEventArgs args)
{
if (args.NewValue != null)
{
String state = ((int)args.NewValue) == 1 ?
"talking..." : "hang up";
MessageBox.Show(state);
}
}

Any suggestion about that?

Thanks in advance~

Regards,

Re: Strange! SystemState.Change Failed?! by Freesc

Freesc
Tue Mar 11 21:23:18 CDT 2008

On Mar 12, 10:19=A0am, Freesc <hjd.cl...@gmail.com> wrote:
> Hi, there~
>
> i'm writing an application which's used to record the *CallTalking*
> time.
> Here 's a piece of my code:
> =A0 =A0 =A0 =A0 public void ListenCall()
> =A0 =A0 =A0 =A0 {
> =A0 =A0 =A0 =A0 =A0 =A0 callState =3D new
> SystemState(SystemProperty.PhoneCallTalking);
> =A0 =A0 =A0 =A0 =A0 =A0 callCount =3D new
> SystemState(SystemProperty.PhoneActiveCallCount);
>
> =A0 =A0 =A0 =A0 =A0 =A0 callState.Changed +=3D new
> ChangeEventHandler(callState_Changed);
> =A0 =A0 =A0 =A0 =A0 =A0 callCount.Changed +=3D new
> ChangeEventHandler(callCount_Changed);
> =A0 =A0 =A0 =A0 }
>
> =A0 =A0 =A0 =A0 void callCount_Changed(object sender, ChangeEventArgs args=
)
> =A0 =A0 =A0 =A0 {
> =A0 =A0 =A0 =A0 =A0 =A0 if (args.NewValue !=3D null && (int)args.NewValue =
=3D=3D 1)
> =A0 =A0 =A0 =A0 =A0 =A0 =A0MessageBox.Show("Call Incoming...");
> //**********
> //if i removed or replaced the "MessageBox.Show(..).",
> //the callState.Changed would never be triggled
> //BUG?!
> //**********
> =A0 =A0 =A0 =A0 }
>
> =A0 =A0 =A0 =A0 void callState_Changed(object sender, ChangeEventArgs args=
)
> =A0 =A0 =A0 =A0 {
> =A0 =A0 =A0 =A0 =A0 =A0 if (args.NewValue !=3D null)
> =A0 =A0 =A0 =A0 =A0 =A0 {
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 String state =3D ((int)args.NewValue) =3D=
=3D 1 ?
> "talking..." : "hang up";
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 MessageBox.Show(state);
> =A0 =A0 =A0 =A0 =A0 =A0 }
> =A0 =A0 =A0 =A0 }
>
> Any suggestion about that?
>
> =A0Thanks in advance~
>
> Regards,

I'm using WM 6 pro Emulator, .NET CF3.5

Thanks