Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/amazon-web-services/14.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Windows phone 7 计时器并保存其状态_Windows Phone 7_State_Dispatchertimer - Fatal编程技术网

Windows phone 7 计时器并保存其状态

Windows phone 7 计时器并保存其状态,windows-phone-7,state,dispatchertimer,Windows Phone 7,State,Dispatchertimer,我正在构建一个windows phone应用程序(基本上是一个游戏,但我没有使用XNA,Silverlight就足够了)。图形正在基于Dispatchermer移动。我想做的基本上是,当电话到达时停止计时器,在电话结束后再次启动计时器,这样游戏状态就不会丢失 我试过: // Code to execute when the application is activated (brought to foreground) // This code will not execute

我正在构建一个windows phone应用程序(基本上是一个游戏,但我没有使用XNA,Silverlight就足够了)。图形正在基于Dispatchermer移动。我想做的基本上是,当电话到达时停止计时器,在电话结束后再次启动计时器,这样游戏状态就不会丢失

我试过:

    // Code to execute when the application is activated (brought to foreground)
    // This code will not execute when the application is first launched
    private void Application_Activated(object sender, ActivatedEventArgs e)
    {
        Game.timer.Start();
    }

    // Code to execute when the application is deactivated (sent to background)
    // This code will not execute when the application is closing
    private void Application_Deactivated(object sender, DeactivatedEventArgs e)
    {

        Game.timer.Stop();
    }
但是它不起作用,当一个电话打到手机上时,它实际上没有达到这一点。有人有过这样的经历吗


提前感谢:)

当接到电话时,您将收到相框上的


请注意,此事件也可以仅因接到一个电话而触发。

。非常感谢你!