예제 #1
0
        private async void App_EnteredBackground(object sender, EnteredBackgroundEventArgs e)
        {
            Windows.Foundation.Deferral deferral = e.GetDeferral();
            await ServiceLocator.Current.GetService <SuspendAndResumeService>().SaveStateAsync();

            deferral.Complete();
        }
예제 #2
0
        private async void App_EnteredBackground(object sender, EnteredBackgroundEventArgs e)
        {
            var deferral = e.GetDeferral();
            await Singleton <SuspendAndResumeService> .Instance.SaveStateAsync();

            deferral.Complete();
        }
예제 #3
0
 private void OnEnteredBackground(object sender, EnteredBackgroundEventArgs enteredBackgroundEventArgs)
 {
     if (ServiceProvider.IsInitialized)
     {
         ServiceProvider.EventAggregator.Publish(this, new BackgroundNavigationMessage());
     }
 }
예제 #4
0
        private async void App_EnteredBackground(object sender, EnteredBackgroundEventArgs e)
        {
            var deferral = e.GetDeferral();

            StateService.Instance.SaveStateAsync();
            deferral.Complete();
        }
예제 #5
0
    private void AppEnteredBackground(object sender, EnteredBackgroundEventArgs e)
    {
        int[] size = new int[3];
        size[0] = namesService.Count;
        size[1] = namesPubTopic.Count;
        size[2] = namesSubTopic.Count;

        // UnAdvertiseService
        for (int i = 0; i < size[0]; i++)
        {
            ServiceUnAdvertiser(namesService[i][0]);
        }

        // UnAdvertiseTopic
        for (int i = 0; i < size[1]; i++)
        {
            UnAdvertiser(namesPubTopic[i][0]);
        }

        // UnSubscribeTopic
        for (int i = 0; i < size[2]; i++)
        {
            UnSubscriber(namesSubTopic[i][0]);
        }

        Close();
    }
 private async void AppEnteredBackground(object sender, EnteredBackgroundEventArgs e)
 {
     await Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
     {
         iErrorMessage.Text = "Application entered background";
     });
 }
예제 #7
0
 // 不得在 EnteredBackground 事件中执行长时间运行的任务,因为这可能会导致用户感觉过渡到后台非常慢。
 private void App_EnteredBackground(object sender, EnteredBackgroundEventArgs e)
 {
     System.Diagnostics.Debug.WriteLine("EnteredBackground");
     _isInBackgroundMode = true;
     MemoryManager.AppMemoryUsageIncreased     += OnMemoryIncreased;
     MemoryManager.AppMemoryUsageLimitChanging += OnMemoryLimitChanged;
 }
예제 #8
0
        private async void App_EnteredBackground(object sender, EnteredBackgroundEventArgs e)
        {
            var deferral = e.GetDeferral();

            await new FileIOService().saveData();
            deferral.Complete();
        }
예제 #9
0
 public async void Suspend(object sender, EnteredBackgroundEventArgs e)
 {
     using (var deferral = e.GetDeferral())
     {
         await SuspendCore();
     }
 }
        private void OnEnteredBackground(object sender, EnteredBackgroundEventArgs e)
        {
            Debug.WriteLine("Entering Background: " + e);
            Deferral deferral = e.GetDeferral();

            deferral.Complete();
        }
예제 #11
0
        private void App_EnteredBackground(object sender, EnteredBackgroundEventArgs e)
        {
            var deferral = e.GetDeferral();

            CoreWindowLogic.Stringify();
            deferral.Complete();
        }
예제 #12
0
        async void OnEnteringBackground(object sender, EnteredBackgroundEventArgs e)
        {
            // NB: getting rid of the UI here means that if the user opens up
            // N tabs then when they come back to the app those tabs will still
            // be there but will all start loading fresh again. That might not
            // be the best user experience as it loses their position on the
            // page.
            if (BrowserViewModel.ForegroundInstance != null)
            {
                var deferral = e.GetDeferral();

                try
                {
                    var serialized = BrowserViewModel.ForegroundInstance.Serialize();
                    await Storage.StoreAsync(serialized);
                }
                finally
                {
                    deferral.Complete();
                }
            }

            Window.Current.Content = null;
            this.background        = true;
        }
예제 #13
0
 /// <summary>
 /// The application entered the background.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void App_EnteredBackground(object sender, EnteredBackgroundEventArgs e)
 {
     // Place the application into "background mode" and note the
     // transition with a flag.
     LogMessage("App Entered background");
     isInBackgroundMode = true;
 }
예제 #14
0
 private async void App_EnteredBackground(object sender, EnteredBackgroundEventArgs e)
 {
     try
     {
         //GNARLY_TODO: Save the visual state.
         var frame      = Window.Current.Content as Frame;
         var mainWindow = frame.Content as MainPage;
         if (mainWindow != null && mainWindow.ActiveChannel != null)
         {
             _cachedMessages = await mainWindow.ActiveChannel.DownloadMessages(MainPage.MaxMessageDownloadCount);
         }
         _appPreviouslyRunning = true;
         GnarlyClient.Instance.Disconnect();
     }
     catch (TaskCanceledException)
     {
         CoreApplication.Exit();
     }
     catch (OperationCanceledException)
     {
         CoreApplication.Exit();
     }
     catch (HttpRequestException)
     {
         CoreApplication.Exit();
     }
     catch (Exception exception)
     {
         ExceptionUploader.UploadException(exception.Message, exception.StackTrace);
     }
     // RegisterTask(BackgroundClientTask, BackgroundClientTaskEntryPoint);
 }
예제 #15
0
        /// <summary>
        ///     The application entered the background.
        /// </summary>
        private static void AppEnteredBackground(object sender, EnteredBackgroundEventArgs e)
        {
            // Send hit
            TelemetryService.Current.TrackEvent("Enter Background");

            // Update the variable
            IsBackground = true;
        }
예제 #16
0
파일: App.xaml.cs 프로젝트: stwime/Chessman
        private void OnEnteredBackground(object sender, EnteredBackgroundEventArgs e)
        {
            var deferral = e.GetDeferral();

            SaveApplicationState();

            deferral.Complete();
        }
예제 #17
0
        private void OnEnteredBackground(object sender, EnteredBackgroundEventArgs e)
        {
            var deferral = e.GetDeferral();

            //TODO: Save application state and stop any background activity

            deferral.Complete();
        }
예제 #18
0
        private void OnEnteredBackground(object sender, EnteredBackgroundEventArgs e)
        {
            Deferral deferral = e.GetDeferral();

            IsForeground = false;
            NotificationSystem.RefreshCallNotification(CallSystem.CallManager.CurrentCalls);
            deferral.Complete();
        }
예제 #19
0
        private async void App_EnteredBackground(object sender, EnteredBackgroundEventArgs e)
        {
            var deferral = e.GetDeferral();

            await this.uaApplication.SuspendAsync();

            deferral.Complete();
        }
예제 #20
0
 private void OnEnteredBackground(object sender, EnteredBackgroundEventArgs e)
 {
     ViewModel.NowPlayingTracks.Close();
     PlaybackControl.Instance.NowPlayingChanged    -= OnNowPlayingChanged;
     PlaybackControl.Instance.NowPlayingRestored   -= OnNowPlayingRestored;
     PlaybackHistoryManager.Instance.NewEntryAdded -= OnNewHistoryEntryAdded;
     ViewModel.NowPlayingTracks.CollectionChanged  -= OnUpcomingChanged;
 }
예제 #21
0
        void OnEnteredBackground(object sender, EnteredBackgroundEventArgs e)
        {
            if (string.IsNullOrEmpty(billInput.Text))
            {
                return;
            }

            ApplicationData.Current.LocalSettings.Values[nameof(App.SavedBillAmount)] = billInput.Text;
        }
예제 #22
0
파일: App.xaml.cs 프로젝트: g1357/Glucose
 /// <summary>
 /// Обработчик события перехода в фоновый режим
 /// </summary>
 /// <param name="sender">Источник события</param>
 /// <param name="e">Аргументы события перехода в фоновый режим</param>
 private async void App_EnteredBackground(object sender, EnteredBackgroundEventArgs e)
 {
     // Получить отсрочку
     var deferral = e.GetDeferral();
     // Сохранить состояние приложения
     await Helpers.Singleton<SuspendAndResumeService>.Instance.SaveStateAsync();
     // Завершить отсрочку
     deferral.Complete();
 }
예제 #23
0
        private void App_EnteredBackground(object sender, EnteredBackgroundEventArgs e)
        {
            var deferral = e.GetDeferral();

            BLogger.Logger.Info("App has entered background...");
            CoreWindowLogic.SaveSettings();
            CoreWindowLogic.UpdateSmtc();
            deferral.Complete();
        }
예제 #24
0
        private void App_EnteredBackground(object sender, EnteredBackgroundEventArgs e)
        {
            if (!_isInBackgroundMode)
            {
                ShowToast("进入后台任务", "陈初静去休息一会");
            }

            _isInBackgroundMode = true;
        }
예제 #25
0
        private void OnEnteredBackground(object sender, EnteredBackgroundEventArgs enteredBackgroundEventArgs)
        {
            ApplicationSettingsHelper.SaveSettingsValue("AppBackgrounded", true);

            if (Locator.PlaybackService.PlayingType == PlayingType.Video && Locator.PlaybackService.IsPlaying)
            {
                Locator.PlaybackService.Pause();
            }
        }
예제 #26
0
 private void OnEnteredBackground(object sender, EnteredBackgroundEventArgs e)
 {
     if (IsTimerInProgress)
     {
         NotificationManager.Current.AddAllNotifications(IsInPomodoro, CurrentTimer.StartTime + CurrentTimer.TotalTime,
                                                         SettingsService.Current.AutoStartOfNextPomodoro, SettingsService.Current.AutoStartOfBreak,
                                                         _completedPomodoros, LongBreakAfter, PomodoroLength,
                                                         ShortBreakLength, LongBreakLength);
     }
 }
예제 #27
0
        private async void App_EnteredBackground(object sender, EnteredBackgroundEventArgs e)
        {
            var Deferral = e.GetDeferral();

            await ViewModelLocator.MainVM.EnteredBackground();

            await Repository.GetObject <INavigationService>()?.SaveFrame();

            Deferral.Complete();
        }
예제 #28
0
 public void HandleEnteredBackground(object sender, EnteredBackgroundEventArgs e)
 {
     LogThis();
     _messengerService.Send(new Messages.EnteredBackgroundMessage {
         EventArgs = e
     });
     _messengerService.Send(new Messages.AppVisibilityChangedMessage {
         Visibility = AppVisibilities.Background
     });
 }
예제 #29
0
        private async void App_EnteredBackground(object sender, EnteredBackgroundEventArgs e)
        {
            var deferral = e.GetDeferral();


            await SuspensionManager.SaveAsync();


            deferral.Complete();
        }
        private async void Current_EnteredBackground(object sender, EnteredBackgroundEventArgs e)
        {
            if (Frame.CurrentSourcePageType == typeof(CameraPage))
            {
                var deferral = e.GetDeferral();
                await CleanupCameraAsync();

                deferral.Complete();
            }
        }
예제 #31
0
        /// <summary>
        /// The application entered the background.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void App_EnteredBackground(object sender, EnteredBackgroundEventArgs e)
        {
            // Place the application into "background mode" and note the
            // transition with a flag.
            Debug.WriteLine("Entered background");
            isInBackgroundMode = true;

            // An application may wish to release views and view data
            // at this point since the UI is no longer visible.
            //
            // As a performance optimization, here we note instead that
            // the app has entered background mode with a boolean and
            // defer unloading views until AppMemoryUsageLimitChanging or
            // AppMemoryUsageIncreased is raised with an indication that
            // the application is under memory pressure.
        }
예제 #32
0
 private void App_EnteredBackground(object sender, EnteredBackgroundEventArgs e)
 {
     // 不要立即執行畫面的清除因爲有可能用戶會馬上回來
     isInBackgroundMode = true;
 }
예제 #33
0
        /// <summary>
        /// The application entered the background.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void App_EnteredBackground(object sender, EnteredBackgroundEventArgs e)
        {
            // Place the application into "background mode" and note the
            // transition with a flag.
            ShowToast("Entered background");
            isInBackgroundMode = true;

            // Unload view content if needed.
            //
            // If the AppMemoryUsageLevel changed and triggered AppMemoryUsageIncreased
            // before the app entered background mode then the view is still loaded
            // and we need to unload it now.
            UnloadViewContentIfNeeded();
        }