Пример #1
0
        /// <summary>
        ///  バックグラウンドタスクが実行完了したときの処理.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="args"></param>
        private async void BackgroundTask_Completed(Windows.ApplicationModel.Background.BackgroundTaskRegistration sender, Windows.ApplicationModel.Background.BackgroundTaskCompletedEventArgs args)
        {
            // バックグラウンドタスク完了イベントはワーカースレッドで通知されるので
            // UI threadで実行する必要あり

            if (this.OnLaunchedDispatcher == null)
            {
                return;
            }

            await this.OnLaunchedDispatcher.RunAsync(
                Windows.UI.Core.CoreDispatcherPriority.Normal,
                () =>
            {
                if (Window.Current == null)
                {
                    return;
                }
                var frame = Window.Current.Content as Frame;
                if (frame == null)
                {
                    return;
                }
                var page = frame.Content as LockscreenItemsPage;
                if (page == null)
                {
                    return;
                }
                page.BackgroundTask_Completed(sender, args);
            });
        }
 async void task_Completed(Windows.ApplicationModel.Background.BackgroundTaskRegistration sender, Windows.ApplicationModel.Background.BackgroundTaskCompletedEventArgs args)
 {
     await dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
     {
         TaskCompleted = true;
         Load();
     });
 }
 async void task_Progress(Windows.ApplicationModel.Background.BackgroundTaskRegistration sender, Windows.ApplicationModel.Background.BackgroundTaskProgressEventArgs args)
 {
     await dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
     {
         TaskCompleted = false;
         TaskProgress  = args.Progress;
     });
 }
 /// <summary>
 ///  バックグラウンドタスクが実行完了したときの処理.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="args"></param>
 public async void BackgroundTask_Completed(Windows.ApplicationModel.Background.BackgroundTaskRegistration sender, Windows.ApplicationModel.Background.BackgroundTaskCompletedEventArgs args)
 {
     // バックグラウンドタスク完了イベントはワーカースレッドで通知されるので
     // UI threadで実行する必要あり
     await this.Dispatcher.RunAsync(
         Windows.UI.Core.CoreDispatcherPriority.Low,
         () => { LoadCurrentLockscreenImageAsync(); });
 }
Пример #5
0
 private void BackGroundTask_Completed(Windows.ApplicationModel.Background.BackgroundTaskRegistration sender, Windows.ApplicationModel.Background.BackgroundTaskCompletedEventArgs args)
 {
     // UI updates should be performed asynchronously, to avoid holding up the UI thread
     UpdateTile();
 }