Windows8 处理应用被Suspend与Resume的操作

    public sealed partial class MainPage : Page
    {
        public MainPage()
        {
            this.InitializeComponent();

            Application.Current.Resuming += new EventHandler<Object>(App_Resuming);
        }

        private void App_Resuming(Object sender, Object e)
        {
            // To Do:例如刷新网络数据
        }
    }

 

    public sealed partial class MainPage : Page
    {
        public MainPage()
        {
            this.InitializeComponent();

            Application.Current.Suspending += new SuspendingEventHandler(App_Suspending);
        }

        void App_Suspending(Object sender,Windows.ApplicationModel.SuspendingEventArgs e)
        {
            //程序被挂起前保存应用程序数据
        }
    }

 

posted on 2013-03-28 10:31  JackSlaterYu  阅读(193)  评论(0编辑  收藏  举报