Esempio n. 1
0
 /// <summary>
 /// Triggered when thhe background task is running and updating progress.
 /// </summary>
 /// <param name="sender">The sender of the event.</param>
 /// <param name="args">The event arguments.</param>
 private void OnTaskProgress(BackgroundTaskRegistration sender, BackgroundTaskProgressEventArgs args)
 {
     Dispatcher.DispatchAsync(() =>
     {
         IsSyncing = true;
     });
 }
Esempio n. 2
0
 private async void OnProgress(BackgroundTaskRegistration sender, BackgroundTaskProgressEventArgs args)
 {
     await CoreApplication.MainView.Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () =>
     {
         SyncProgress.Value = args.Progress;
     });
 }
        /// <summary>
        /// Handle background task progress.
        /// </summary>
        /// <param name="task">The task that is reporting progress.</param>
        /// <param name="e">Arguments of the progress report.</param>
        private void OnProgress(IBackgroundTaskRegistration task, BackgroundTaskProgressEventArgs args)
        {
            var progress = "Progress: " + args.Progress + "%";

            BackgroundTaskSample.SampleBackgroundTaskWithConditionProgress = progress;
            UpdateUI();
        }
        // we are mis-using this function, as it is our only direct way on getting data back from our background task,
        // we use the UInt32 Progress to forward the heartbeat value to the UI app.
        private async void OnProgress(BackgroundTaskRegistration sender, BackgroundTaskProgressEventArgs args)
        {
            // Serialize UI update to the the main UI thread.
            await this.Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () =>
            {
                SetWaitVisibility(false);

                // lets put the value into the UI control
                HeartbeatValueBox.Text = "" + args.Progress;

                //we need to store it in an array in order to visualize the values with graph
                _data.Add(new HeartbeatMeasurement
                {
                    HeartbeatValue = (ushort)args.Progress,
                    Timestamp      = DateTimeOffset.Now
                });

                if (_data.Count >= 2)
                {
                    // and we have our custom control to show the graph
                    // this does not draw well if there is only one value, thus using it only after we got at least two values
                    outputDataChart.PlotChart(_data.ToArray());
                }
            });
        }
        /// <summary>
        /// Handle background task progress.
        /// </summary>
        /// <param name="task">The task that is reporting progress.</param>
        /// <param name="e">Arguments of the progress report.</param>
        private void OnProgress(IBackgroundTaskRegistration task, BackgroundTaskProgressEventArgs args)
        {
            var progress = "Progress: " + args.Progress + "%";

            BackgroundTaskSample.ServicingCompleteTaskProgress = progress;
            UpdateUI();
        }
Esempio n. 6
0
        private void OnProgress(IBackgroundTaskRegistration task, BackgroundTaskProgressEventArgs args)
        {
            // 获取后台任务的执行进度
            _taskProgress = args.Progress.ToString();

            UpdateUI();
        }
 private void OnProgress(IBackgroundTaskRegistration task, BackgroundTaskProgressEventArgs args)
 {
     var ignored = Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
     {
         Prog = args.Progress;
     });
 }
        /// <summary>
        /// Handle background task progress.
        /// </summary>
        /// <param name="task">The task that is reporting progress.</param>
        /// <param name="e">Arguments of the progress report.</param>
        private void OnProgress(IBackgroundTaskRegistration task, BackgroundTaskProgressEventArgs args)
        {
            var progress = "Progress: " + args.Progress + "%";

            BackgroundTaskSample.TimeTriggeredTaskProgress = progress;
            UpdateUI();
        }
Esempio n. 9
0
 private async void OnProgress(BackgroundTaskRegistration sender, BackgroundTaskProgressEventArgs args)
 {
     // Serialize UI update to the the main UI thread.
     await this.Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () =>
     {
         ShowErrorDialog(CommonData.LastMessage, "Got message");
     });
 }
 private async void OnProgress(BackgroundTaskRegistration sender, BackgroundTaskProgressEventArgs args)
 {
     await Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () =>
     {
         installProgressBar.Value   = args.Progress;
         installValueTextBlock.Text = $"{args.Progress}%";
     });
 }
Esempio n. 11
0
 /// <summary>
 /// Handle background task progress.
 /// </summary>
 /// <param name="task">The task that is reporting progress.</param>
 /// <param name="e">Arguments of the progress report.</param>
 private void OnProgress(IBackgroundTaskRegistration task, BackgroundTaskProgressEventArgs args)
 {
     var ignored = Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
     {
         var progress = "Progress: " + args.Progress + "%";
         BackgroundTaskSample.ApplicationTriggerTaskProgress = progress;
         UpdateUI();
     });
 }
Esempio n. 12
0
        private void BackgroundTask_Progress(BackgroundTaskRegistration sender, BackgroundTaskProgressEventArgs args)
        {
            ToastHistoryChangedType changedType = (ToastHistoryChangedType)args.Progress;

            CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, delegate
            {
                OnHistoryChanged(changedType);
            });
        }
        private static void OnProgress(IBackgroundTaskRegistration sender, BackgroundTaskProgressEventArgs e)
        {
            var handler = TileUpdateInProgress;

            if (null != handler)
            {
                handler(sender as BackgroundTaskRegistration, e);
            }
        }
Esempio n. 14
0
        private void UpdateProgress(BackgroundTaskProgressEventArgs e)
        {
            if (e == null)
            {
                return;
            }

            _progressMessage = e.Progress.Message;
            _progressBar     = e.Progress.Percent;
            SignalProgressUpdate();
        }
Esempio n. 15
0
 private async void OnBgTaskProgress(BackgroundTaskRegistration sender, BackgroundTaskProgressEventArgs args)
 {
     // WARNING: Test code
     // Handle background task progress.
     if (args.Progress == 1)
     {
         await CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
         {
             System.Diagnostics.Debug.WriteLine("Background task is started.");
         });
     }
 }
Esempio n. 16
0
        void ProgressUpdated(object sender, BackgroundTaskProgressEventArgs e)
        {
            _progressBar.Text  = e.Progress.Message;
            _progressBar.Value = e.Progress.Percent > 100 ? 100 : e.Progress.Percent;
            _progressBar.Update();

            if (e.Progress.Percent >= 100)
            {
                _buttonCancel.Enabled   = false;
                _buttonGenerate.Enabled = true;
            }
        }
 /// <summary>
 /// The background task updates the progress counter.  When that happens, this event handler gets invoked
 /// When the handler is invoked, we will display the value stored in local settings to the user.
 /// </summary>
 /// <param name="task"></param>
 /// <param name="args"></param>
 private async void OnProgress(IBackgroundTaskRegistration task, BackgroundTaskProgressEventArgs args)
 {
     if (ApplicationData.Current.LocalSettings.Values.Keys.Contains("ReceivedMessage"))
     {
         string backgroundMessage = (string)ApplicationData.Current.LocalSettings.Values["ReceivedMessage"];
         await Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () =>
         {
             rootPage.NotifyUser("Client Connected", NotifyType.StatusMessage);
             ConversationListBox.Items.Add("Received: " + backgroundMessage);
         });
     }
 }
Esempio n. 18
0
 private async void OnBgTaskProgress(BackgroundTaskRegistration sender, BackgroundTaskProgressEventArgs args)
 {
     // WARNING: Test code
     // Handle background task progress.
     System.Diagnostics.Debug.WriteLine(args);
     if (args.Progress == 1)
     {
         await Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
         {
             System.Diagnostics.Debug.WriteLine("Background task is started.");
             //DisplayTaskCreatedDialog("Background task is started.");
         });
     }
 }
Esempio n. 19
0
 void OnProgress(BackgroundTaskRegistration sender, BackgroundTaskProgressEventArgs args)
 {
     Dispatcher.RunAsync(CoreDispatcherPriority.Normal,
                         () =>
     {
         if (this.mediaElement.Visibility == Visibility.Collapsed)
         {
             this.mediaElement.Visibility = Visibility.Visible;
             this.mediaElement.Play();
         }
         this.txtTaskRunning.Text = "Running";
         this.progressBar.Value   = args.Progress;
     });
 }
Esempio n. 20
0
        private void RegisteredTask_Progress(BackgroundTaskRegistration sender, BackgroundTaskProgressEventArgs args)
        {
            if (Window.Current == null)
            {
                return;
            }
            if (Window.Current.Content == null)
            {
                return;
            }
            if (Window.Current.Content.Dispatcher == null)
            {
                return;
            }

            Window.Current.Content.Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.High, () =>
            {
                new MessageDialog("Progress: ").ShowAsync().AsTask();
            }).AsTask();
        }
Esempio n. 21
0
        private void Reg_Progress(BackgroundTaskRegistration sender, BackgroundTaskProgressEventArgs args)
        {
            var status = string.Empty;

            if (args.Progress < 10)
            {
                status = "Starting...";
            }
            else if (args.Progress < 30)
            {
                status = "Downloading...";
            }
            else if (args.Progress < 90)
            {
                status = "Applying...";
            }
            else
            {
                status = "Almost done...";
            }
            UpdateNotification(args.Progress, status);
        }
Esempio n. 22
0
        private void Task_Progress(BackgroundTaskRegistration sender, BackgroundTaskProgressEventArgs args)
        {
            var progress = $"Progress: {args.Progress} %";

            UpdateUI(progress);
        }
Esempio n. 23
0
 private static void Task_Progress(BackgroundTaskRegistration sender, BackgroundTaskProgressEventArgs args)
 {
     Debug.Write("........Task_Progress" + args.InstanceId);
 }
Esempio n. 24
0
 private void TaskOnProgress(BackgroundTaskRegistration sender, BackgroundTaskProgressEventArgs args)
 {
     Debug.WriteLine($"Background {sender.Name} TaskOnProgress.");
 }
Esempio n. 25
0
 void Task_Progress(BackgroundTaskRegistration sender, BackgroundTaskProgressEventArgs args)
 {
 }
 //in case, if the app is in foreground, it should get some data from background
 private async void _deviceUseBackgroundTaskRegistration_Progress(BackgroundTaskRegistration sender, BackgroundTaskProgressEventArgs args)
 {
     await Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
     {
         heartData.CurrentRate = (int)args.Progress;
     });
 }
Esempio n. 27
0
 private void task_Progress(BackgroundTaskRegistration sender, BackgroundTaskProgressEventArgs args)
 {
     Debug.WriteLine("task_Progress()");
 }
Esempio n. 28
0
 private static void BgTask_Progress(BackgroundTaskRegistration sender, BackgroundTaskProgressEventArgs args)
 {
     LogMessage("BgTask Progress: " + args.Progress, NotifyType.StatusMessage);
 }
Esempio n. 29
0
 /// <summary>
 /// Updates the UI with the progress of the sync
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="args"></param>
 private async void OnSyncWithDeviceProgress(BackgroundTaskRegistration sender, BackgroundTaskProgressEventArgs args)
 {
     await rootPage.Dispatcher.RunAsync(CoreDispatcherPriority.Normal,
                                        new DispatchedHandler(() =>
     {
         SyncProgressBar.Value = args.Progress;
     }));
 }
 private void OnProgress(IBackgroundTaskRegistration task, BackgroundTaskProgressEventArgs args)
 {
 }