Пример #1
0
 private void Current_Suspending(object sender, Windows.ApplicationModel.SuspendingEventArgs e)
 {
     if (Frame.CurrentSourcePageType.FullName == "Nawigator_SGGW_B34.MainPage")
     {
         Application.Current.Exit();
     }
 }
Пример #2
0
        private async void Current_Suspending(object sender, Windows.ApplicationModel.SuspendingEventArgs e)
        {
            var deferral = e.SuspendingOperation.GetDeferral();

            try
            {
                if (GlobalVariables.CurrentIDs.ID_Tab != 0)
                {
                    //Code content
                    string content = await ContentViewer.GetCode();

                    await TabsWriteManager.PushTabContentViaIDAsync(GlobalVariables.CurrentIDs, content, false);

                    //Cursor position
                    PositionSCEE CursorPosition = await ContentViewer.GetCursorPosition();

                    InfosTab Tab = TabsAccessManager.GetTabViaID(GlobalVariables.CurrentIDs);
                    Tab.TabCursorPosition = new CursorPosition {
                        column = CursorPosition.column, row = CursorPosition.row
                    };
                    await TabsWriteManager.PushUpdateTabAsync(Tab, GlobalVariables.CurrentIDs.ID_TabsList, false);

                    deferral.Complete();
                }
                else
                {
                    deferral.Complete();
                }
            }
            catch
            {
                deferral.Complete();
            }
        }
Пример #3
0
        private void Current_Suspending(object sender, Windows.ApplicationModel.SuspendingEventArgs e)
        {
            var deferral = e.SuspendingOperation.GetDeferral();

            // here is where we'd transfer the open socket to the socket manager.
            // ...If we knew how to get the socket out of the scenario code where it lives right now.
            if (socket != null)
            {
                // To demonstrate usage of CancelIOAsync async, have a pending read on the socket and call
                // cancel before transfering the socket.
                //DataReader reader = new DataReader(socket.InputStream);
                //reader.InputStreamOptions = InputStreamOptions.Partial;
                //var read = reader.LoadAsync(250);
                //read.Completed += (info, status) =>
                //{

                //};
                //await socket.CancelIOAsync();

                //socket.TransferOwnership(socketId);
                //socket = null;
            }

            deferral.Complete();
        }
 private void Current_Suspending(object sender, Windows.ApplicationModel.SuspendingEventArgs e)
 {
     if (this.DataContext != null)
     {
         SaveBulbs();
     }
 }
        private async void Current_Suspending(object sender, Windows.ApplicationModel.SuspendingEventArgs e)
        {
            view.file_key = xfile_key.Text;
            await view.hold();

            e.SuspendingOperation.Deadline.AddSeconds(5);
        }
Пример #6
0
 private void Current_Suspending(object sender, Windows.ApplicationModel.SuspendingEventArgs e)
 {
     ContentVM.Value?.OnNavigatingFrom(new Prism.Windows.Navigation.NavigatingFromEventArgs()
     {
         NavigationMode = NavigationMode.New,
     }, viewModelState, true);
 }
        private void App_Suspending(object sender, Windows.ApplicationModel.SuspendingEventArgs e)
        {
            try
            {
                var deferral = e.SuspendingOperation.GetDeferral();

                foreach (GenericGattServiceViewModel service in GattSampleContext.Context.CreatedServices)
                {
                    string key   = "Service_" + service.Service.ServiceProvider.Service.Uuid.ToString() + "_IsPublishing";
                    bool   value = service.IsPublishing;
                    SettingsService.Instance.SettingsDictionary[key] = value;

                    if (service.IsPublishing)
                    {
                        service.Service.ServiceProvider.StopAdvertising();
                    }
                }

                GattSampleContext.Context.ReleaseAllResources();

                deferral.Complete();
            }
            catch (Exception ex)
            {
                Debug.WriteLine("Suspending: " + ex.Message);
            }
        }
Пример #8
0
        private async void Current_Suspending(object sender, Windows.ApplicationModel.SuspendingEventArgs e)
        {
            var deferral = e.SuspendingOperation.GetDeferral();

            try
            {
                _timerUpdateCancellationTokenSource?.Cancel();
                _timerUpdateCancellationTokenSource = null;
            }
            catch (Exception ex)
            {
                _logger.ZLogError(ex, "subscription timer cancel faield.");
            }


            try
            {
                await StopTimerAsync();
            }
            catch (Exception ex)
            {
                _logger.ZLogError(ex, "subscription timer stop faield.");
            }
            finally
            {
                deferral.Complete();
            }
        }
Пример #9
0
        protected void App_Suspending(Object sender, Windows.ApplicationModel.SuspendingEventArgs e)
        {
            // Reference to Local Application Settings.
            Windows.Storage.ApplicationDataContainer localSettings = Windows.Storage.ApplicationData.Current.LocalSettings;

            localSettings.Values["lastViewedTimeStamp"] = DateTime.Now.ToString();
        }
Пример #10
0
        /*
         * METHOD      : Current_Suspending()
         * DESCRIPTION :
         *      This method triggers on suspend and saves all the data needed to restore the state of the
         *      game in the event of a suspend or suspend and terminate.
         * PARAMETERS  :
         *                   object : sender
         *      SuspendingEventArgs : e
         * RETURNS     :
         *      void : void
         */
        private void Current_Suspending(Object sender, Windows.ApplicationModel.SuspendingEventArgs e)
        {
            //Store counter time and stop it
            localSettings.Values["count"] = Counter;
            tmr.Stop();

            localSettings.Values["gameState"] = SUSPEND;

            foreach (Rectangle r in rectArray)
            {
                if (r != empty)
                {
                    //Get rectangle render transform data
                    TranslateTransform check     = (TranslateTransform)r.RenderTransform;
                    double             xPosition = check.X;
                    double             yPosition = check.Y;

                    //Store render transformations
                    localSettings.Values["Transform." + r.Name + "x"] = xPosition;
                    localSettings.Values["Transform." + r.Name + "y"] = yPosition;
                }

                //Store rectangle positions
                localSettings.Values[r.Name + "x"] = RectanglePositions[r].Key;
                localSettings.Values[r.Name + "y"] = RectanglePositions[r].Value;
            }
        }
Пример #11
0
        private void AppExitHandler(object sender, Windows.ApplicationModel.SuspendingEventArgs e)
        {
            var deferral = e.SuspendingOperation.GetDeferral();

            AppDebug.Line("Exiting app!");
            deferral.Complete();
        }
Пример #12
0
        private void OnSuspending(object sender, Windows.ApplicationModel.SuspendingEventArgs e)
        {
            var def = e.SuspendingOperation.GetDeferral();

            CurrentApp.Suspend();
            def.Complete();
        }
 async void App_Suspending(Object sender, Windows.ApplicationModel.SuspendingEventArgs e)
 {
     if (v)
     {
         await appWindow.CloseAsync();
     }
 }
Пример #14
0
        // When the app is suspended keep the simulation calculations running but stop updating the UI
        //   All UI code inside the simulation loop needs to check appSuspended and not run if it's true
        //   e.g. if (appSuspended) return;

        // App will be suspened when it's being quit by the user
        void App_Suspending(Object sender, Windows.ApplicationModel.SuspendingEventArgs e)
        {
            appSuspended = true;
            Debug.WriteLine(">>> App Suspended");
            SetMessageText(">>> App Suspended");   // Use this message to test Suspending. Since Visual Studio debugging prevents suspending, run without
                                                   //   debugging and look for this message to verify that suspend/resume has occured
        }
Пример #15
0
 async void App_Suspending(Object sender, Windows.ApplicationModel.SuspendingEventArgs e)
 {
     // Create a simple setting
     localSettings.Values["FirstName"] = fName.Text;
     localSettings.Values["LastName"]  = lName.Text;
     localSettings.Values["Email"]     = email.Text;
 }
Пример #16
0
        // Called when app is suspending
        private void Current_Suspending(object sender, Windows.ApplicationModel.SuspendingEventArgs e)
        {
            // Clean up out watchers
            inputDeviceWatcher.StopWatcher();
            inputDeviceWatcher = null;

            outputDeviceWatcher.StopWatcher();
            outputDeviceWatcher = null;

            // Remove EventHandlers and try dispose of input & output ports
            try
            {
                midiInPort.MessageReceived -= MidiInPort_MessageReceived;
                midiInPort.Dispose();
                midiInPort = null;
            }
            catch
            {
            }

            try
            {
                midiOutPort.Dispose();
                midiOutPort = null;
            }
            catch
            {
            }
        }
        async void Current_Suspending(object sender, Windows.ApplicationModel.SuspendingEventArgs e)
        {
            //save your application data before the application terminates
            //two ways of saving the app - Synchronous and Asynchronous
            //if the data is small , use synchronous

            //Synchronous data save
            var localSettings = Windows.Storage.ApplicationData.Current.LocalSettings;

            localSettings.Values["data"] = txtBoxData.Text;


            //Asynchronous data saving includes using a SuspendingDeferral for making the app to wait until the asynchrnous task completes
            var deferral = e.SuspendingOperation.GetDeferral();

            //do all asynchronous task here
            var localFolder = Windows.Storage.ApplicationData.Current.LocalFolder;
            var file        = await localFolder.CreateFileAsync("datafile.txt", CreationCollisionOption.ReplaceExisting);

            if (file != null)
            {
                await FileIO.WriteTextAsync(file, txtBoxData.Text);
            }

            //tell windows to complete all async operations
            deferral.Complete();
        }
Пример #18
0
 public void ForegroundApp_Suspending(object sender, Windows.ApplicationModel.SuspendingEventArgs e)
 {
     if (IsMyBackgroundTaskRunning)
     {
         RemoveMediaPlayerEventHandlers();
     }
 }
Пример #19
0
        private async void Application_Suspending(object sender, Windows.ApplicationModel.SuspendingEventArgs e)
        {
            var deferral = e.SuspendingOperation.GetDeferral();

            //await _kinectSensor?.CloseAsync();
            deferral.Complete();
        }
Пример #20
0
        private async void App_Suspending(object sender, Windows.ApplicationModel.SuspendingEventArgs e)
        {
            var deferral = e.SuspendingOperation.GetDeferral();
            await ViewModel.SaveAsync();

            deferral.Complete();
        }
Пример #21
0
        void App_Suspending(Object sender,
                            Windows.ApplicationModel.SuspendingEventArgs e)
        {
            var deferral = e.SuspendingOperation.GetDeferral();

            deferral.Complete();
        }
        private async void App_Suspending(object sender, Windows.ApplicationModel.SuspendingEventArgs e)
        {
            var deferral = e.SuspendingOperation.GetDeferral();
            await _customerDataProvider.SaveCustomersAsync(customerListView.Items.OfType <Customer>());

            deferral.Complete();
        }
Пример #23
0
        private void App_Suspending(object sender, Windows.ApplicationModel.SuspendingEventArgs e)
        {
            IsServiceInitialized = false;

            // This is an appropriate place to save to persistent storage any datapoint the application cares about.
            // For the purpose of this sample we just discard any values.
            datapoints.Clear();

            // Allow the GattDeviceService to get cleaned up by the Windows Runtime.
            // The Windows runtime will clean up resources used by the GattDeviceService object when the application is
            // suspended. The GattDeviceService object will be invalid once the app resumes, which is why it must be
            // marked as invalid, and reinitalized when the application resumes.
            if (service != null)
            {
                service.Dispose();
                service = null;
            }

            if (characteristic != null)
            {
                characteristic = null;
            }

            if (watcher != null)
            {
                watcher.Stop();
                watcher = null;
            }
        }
Пример #24
0
        private async void OnSuspending(object sender, Windows.ApplicationModel.SuspendingEventArgs e)
        {
            if (this.isPreviewStreaming)
            {
                var deferral = e.SuspendingOperation.GetDeferral();
                try
                {
                    if (this.frameProcessingTimer != null)
                    {
                        this.frameProcessingTimer.Cancel();
                    }

                    if (this.mediaCapture != null)
                    {
                        if (this.mediaCapture.CameraStreamState == Windows.Media.Devices.CameraStreamState.Streaming)
                        {
                            await this.mediaCapture.StopPreviewAsync();
                        }

                        this.mediaCapture.Dispose();
                    }

                    this.frameProcessingTimer = null;
                    var ignored = Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () => { this.captureElement.Source = null; });

                    this.mediaCapture = null;
                }
                finally
                {
                    deferral.Complete();
                }
            }
        }
        static async void HandleAppSuspending(object sender, Windows.ApplicationModel.SuspendingEventArgs e)
        {
            var deferral = e.SuspendingOperation.GetDeferral();
            await FeedbackManager.Current.StoreDataIfNeeded();

            deferral.Complete();
        }
Пример #26
0
 async void Current_Suspending(object sender, Windows.ApplicationModel.SuspendingEventArgs e)
 {
     if (_chmFile != null)
     {
         await _chmFile.Save();
     }
 }
Пример #27
0
        private void App_Suspending(object sender, Windows.ApplicationModel.SuspendingEventArgs e)
        {
            watcher.Stop();

            watcher.Received -= OnAdvertisementReceived;
            watcher.Stopped  -= OnAdvertisementWatcherStopped;
        }
Пример #28
0
        protected override async void OnSuspending(object sender, Windows.ApplicationModel.SuspendingEventArgs e)
        {
            var deferral = e.SuspendingOperation.GetDeferral();
            await SuspensionManager.SaveAsync();

            deferral.Complete();
        }
Пример #29
0
        /// <summary>
        /// Gets called when the App suspends
        /// </summary>
        private async void OnAppSuspending(object sender, Windows.ApplicationModel.SuspendingEventArgs e)
        {
            Orchestra.Disconnect();
            await MusicLibrary.Save();

            MusicLibrary.Close();
        }
Пример #30
0
        /*  -- Method Header Comment
         * Name	:	App_Suspending
         * Purpose :	Suspends all necessary data
         * Inputs	:	object sender, SuspendingEventArgs e
         * Outputs	:	None
         * Returns	:	None
         */
        private void App_Suspending(object sender, SuspendingEventArgs e)
        {
            // loop through each button in the array
            foreach (var btn in StateManagement.buttonArray)
            {
                // save the button content and x, y positions
                var btnNum = (int)btn.Content;
                var xPos   = (int)btn.Margin.Left;
                var yPos   = (int)btn.Margin.Top;

                // create a new composite store
                var composite = new ApplicationDataCompositeValue
                {
                    ["xPos"] = xPos, ["yPos"] = yPos, [btnNum.ToString()] = btnNum
                };
                // save to the composite
                localSettings.Values[$"button {btnNum}"] = composite;
            }

            // save required values to localsettings
            localSettings.Values["playerName"]  = StateManagement.PlayerName;
            localSettings.Values["currentTime"] = StateManagement.GameTime;
            StateManagement.gameTimer.Stop();
            localSettings.Values["wasSuspended"] = true;
            localSettings.Values["emptySquare"]  = StateManagement.EmptySquare;
        }