在Windows Phone 8中,当我按下开始按钮时,我应该得到Application_Deactivated
和Application_Closing
事件。但是当我在这些事件中设置断点时,断点不会命中。为什么Application_Closing
和Application_Deactivated
没有被调用?为什么应用程序没有收到应用程序关闭事件?
Occurs when an application stops being the foreground application.
的App.xaml
<Application
x:Class="ContineousLocationTracking.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone">
<!--Application Resources-->
<Application.Resources>
<local:LocalizedStrings xmlns:local="clr-namespace:ContineousLocationTracking" x:Key="LocalizedStrings"/>
</Application.Resources>
<Application.ApplicationLifetimeObjects>
<!--Required object that handles lifetime events for the application-->
<shell:PhoneApplicationService
Launching="Application_Launching" Closing="Application_Closing"
Activated="Application_Activated" Deactivated="Application_Deactivated"
RunningInBackground="PhoneApplicationService_RunningInBackground"
/>
</Application.ApplicationLifetimeObjects>
</Application>
这些方法中是否有任何代码?因为如果它们是空的,编译器可以删除它们。 – xmashallax
你是如何设置这些事件的? – CathalMF
@xmashallax不,我在事件中有代码 –