Esempio n. 1
0
 private void Ping()
 {
     if (ApplicationRestartRecoveryManager.ApplicationRecoveryInProgress())
     {
         Debug.Write("Operation Cancelled");
         Environment.Exit(2);
     }
 }
Esempio n. 2
0
        // This method is called periodically to ensure
        // that WER knows that recovery is still in progress.
        private void PingSystem()
        {
            // Find out if the user canceled recovery.
            bool isCanceled = ApplicationRestartRecoveryManager.ApplicationRecoveryInProgress();

            if (isCanceled)
            {
                Console.WriteLine("Recovery has been canceled by user.");
                Environment.Exit(2);
            }
        }
Esempio n. 3
0
        /// <summary>
        /// Performs recovery by saving the state
        /// </summary>
        /// <param name="parameter">Unused.</param>
        /// <returns>Unused.</returns>
        private int PerformRecovery(object parameter)
        {
            try
            {
                ApplicationRestartRecoveryManager.ApplicationRecoveryInProgress();
                Storage.Save(m_rootViewModel.TaskData);
                ApplicationRestartRecoveryManager.ApplicationRecoveryFinished(true);
            }
            catch
            {
                ApplicationRestartRecoveryManager.ApplicationRecoveryFinished(false);
            }

            return(0);
        }
Esempio n. 4
0
        private int PerformRecovery(object parameter)
        {
            try
            {
                ApplicationRestartRecoveryManager.ApplicationRecoveryInProgress();

                RegistryUpdater.DisableImplicitLayer();

                ApplicationRestartRecoveryManager.ApplicationRecoveryFinished(true);
            }
            catch
            {
                ApplicationRestartRecoveryManager.ApplicationRecoveryFinished(false);
            }

            return(0);
        }
Esempio n. 5
0
        /// <summary>Performs recovery by saving the state.</summary>
        /// <param name="parameter">This parameter is not used.</param>
        /// <returns>Return value is not used.</returns>
        static int PerformRecovery(object parameter)
        {
            try
            {
                ApplicationRestartRecoveryManager.ApplicationRecoveryInProgress();
                Core.SaveProject();

                // Save your work here for recovery
                ApplicationRestartRecoveryManager.ApplicationRecoveryFinished(true);
            }
            catch
            {
                ApplicationRestartRecoveryManager.ApplicationRecoveryFinished(false);
            }

            return(0);
        }
Esempio n. 6
0
 private int SaveState(object state)
 {
     using (AppLogger.Log.ErrorCall())
     {
         AppLogger.Log.Error("Saving application state");
         var settings  = (SoundSwitchConfiguration)state;
         var cancelled = ApplicationRestartRecoveryManager.ApplicationRecoveryInProgress();
         if (cancelled)
         {
             AppLogger.Log.Error("Recovery Cancelled");
             ApplicationRestartRecoveryManager.ApplicationRecoveryFinished(false);
             return(0);
         }
         settings.Save();
         ApplicationRestartRecoveryManager.ApplicationRecoveryFinished(true);
         AppLogger.Log.Error("Recovery Success");
         return(0);
     }
 }
Esempio n. 7
0
        private int DoRecovery(object state)
        {
            App.Source.TraceEvent(TraceEventType.Verbose, 0, "Begin recovery");
            _tempPath = state as string;
            var canceled = ApplicationRestartRecoveryManager.ApplicationRecoveryInProgress();

            if (canceled)
            {
                TraceTextBlock.Text += string.Format("{0:T}: Recovery canceled, shutting down\n", DateTime.Now);
                // NOTE: Восстановление отменено, завершение работы
                App.Source.TraceEvent(TraceEventType.Verbose, 0, "End recovery with cancel");
                ApplicationRestartRecoveryManager.ApplicationRecoveryFinished(false);
                return(0);
            }

            SaveFile(_tempPath);
            App.Source.TraceEvent(TraceEventType.Verbose, 0, "End recovery");
            ApplicationRestartRecoveryManager.ApplicationRecoveryFinished(true);

            return(0);
        }
Esempio n. 8
0
        private int PerformRecovery(object parameter)
        {
            try
            {
                ApplicationRestartRecoveryManager.ApplicationRecoveryInProgress();
                if (System.IO.Directory.Exists("data") && System.IO.File.Exists("data/session.xml"))
                {
                    recovery = true;
                    new System.Threading.Thread(() =>
                    {
                        MessageBox.Show("Hands Free Leveler might be crashed during a sesion\nRecovering from last rotation\n" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), "Recovery Restart", MessageBoxButton.OK, MessageBoxImage.Warning);
                    }).Start();
                }

                ApplicationRestartRecoveryManager.ApplicationRecoveryFinished(true);
            }
            catch
            {
                ApplicationRestartRecoveryManager.ApplicationRecoveryFinished(false);
            }
            return(0);
        }