Esempio n. 1
0
        /// <summary>
        ///     The run app.
        /// </summary>
        private static void RunApp()
        {
            try
            {
                // Application Services
                ApplicationRestartRecoveryManager.RegisterForApplicationRestart(
                    new RestartSettings(string.Empty, RestartRestrictions.None));
            }
            catch (Exception)
            {
            }
            try
            {
                Notify = new NotifyIcon {
                    Visible = false
                };
                defualtApp.InitializeComponent();
                defualtApp.DispatcherUnhandledException += (s, e) =>
                {
                    VDialog.Show(
                        e.Exception.Message + "\r\n\r\n" + e.Exception.StackTrace,
                        "FATAL ERROR",
                        MessageBoxButtons.OK,
                        MessageBoxIcon.Error);
                    e.Handled = false;
                    End();
                };
                defualtApp.Run();
            }
            catch (Exception)
            {
            }

            End();
        }
Esempio n. 2
0
        private void RegisterForRestart()
        {
            var settings = new RestartSettings("/restart", RestartRestrictions.None);

            ApplicationRestartRecoveryManager.RegisterForApplicationRestart(settings);
            AppLogger.Log.Info("Restart Registered");
        }
Esempio n. 3
0
        public void WireUp()
        {
            TaskScheduler.UnobservedTaskException            += TaskSchedulerOnUnobservedTaskException;
            AppDomain.CurrentDomain.UnhandledException       += CurrentDomainOnUnhandledException;
            Application.Current.DispatcherUnhandledException += ApplicationOnDispatcherUnhandledException;

            ApplicationRestartRecoveryManager.RegisterForApplicationRestart(new RestartSettings("-died", RestartRestrictions.None));
        }
Esempio n. 4
0
        private void RegisterForRestart()
        {
            // Register for automatic restart if the
            // application was terminated for any reason
            // other than a system reboot or a system update.
            ApplicationRestartRecoveryManager.RegisterForApplicationRestart(
                new RestartSettings("/restart", RestartRestrictions.NotOnReboot | RestartRestrictions.NotOnPatch));

            Debug.WriteLine("ARR: Registered for restart");
        }
Esempio n. 5
0
        private void RegisterForRestart()
        {
            var settings = new RestartSettings(string.Format("/restart:{0}", _tempPath),
                                               RestartRestrictions.NotOnReboot | RestartRestrictions.NotOnPatch);

            ApplicationRestartRecoveryManager.RegisterForApplicationRestart(settings);
            TraceTextBlock.Text += string.Format("{0:T}: Registered for restart\n", DateTime.Now);
            App.Source.TraceEvent(TraceEventType.Verbose, 0, "Registered for restart");
            // NOTE: Зарегистрировано для перезапуска
        }
Esempio n. 6
0
        /// <summary>Registers the application to use the Recovery Manager.</summary>
        static void RegisterApplicationRecoveryAndRestart()
        {
            if (Environment.OSVersion.Version.Major < 6)
            {
                return;
            }

            // register for Application Restart
            ApplicationRestartRecoveryManager.RegisterForApplicationRestart(
                new RestartSettings(string.Empty, RestartRestrictions.NotOnReboot));
        }
Esempio n. 7
0
        private void RegisterApplicationRecoveryAndRestart()
        {
            if (CoreHelpers.RunningOnVista)
            {
                // register for Application Restart and Recovery
                RestartSettings restartSettings = new RestartSettings(string.Empty, RestartRestrictions.None);
                ApplicationRestartRecoveryManager.RegisterForApplicationRestart(restartSettings);

                RecoverySettings recoverySettings = new RecoverySettings(new RecoveryData(PerformRecovery, null), c_keepAliveInterval);
                ApplicationRestartRecoveryManager.RegisterForApplicationRecovery(recoverySettings);
            }
        }
Esempio n. 8
0
        /// <summary>Registers the application to use the Recovery Manager.</summary>
        static void RegisterApplicationRecoveryAndRestart()
        {
            if (Environment.OSVersion.Version.Major < 6)
            {
                return;
            }

            // register for Application Restart
            ApplicationRestartRecoveryManager.RegisterForApplicationRestart(
                new RestartSettings(string.Empty, RestartRestrictions.NotOnReboot));

            // register for Application Recovery
            var recoverySettings = new RecoverySettings(new RecoveryData(PerformRecovery, null), 4000);

            ApplicationRestartRecoveryManager.RegisterForApplicationRecovery(recoverySettings);
        }
Esempio n. 9
0
        public Form1()
        {
            InitializeComponent();

            recoveryFile = Path.Combine(Path.GetDirectoryName(Application.ExecutablePath), "RecoveryData.xml");
            ApplicationRestartRecoveryManager.RegisterForApplicationRestart(
                new RestartSettings("/restart", RestartRestrictions.NotOnReboot | RestartRestrictions.NotOnPatch));

            var data     = new RecoveryData(RecoveryProcedure, null);
            var settings = new RecoverySettings(data, 0);

            ApplicationRestartRecoveryManager.RegisterForApplicationRecovery(settings);


            if (Environment.GetCommandLineArgs().Length > 1 && Environment.GetCommandLineArgs()[1] == "/restart")
            {
                RecoverLastSession(Environment.GetCommandLineArgs()[1]);
            }
        }
Esempio n. 10
0
        public MainWindow()
        {
            InitializeComponent();

            //Register next Restart Recovery key (It ensures that application if application closes other than OnPatch/ OnReboot / NormalEnd
            // it pass the /recovery argument.
            ApplicationRestartRecoveryManager.RegisterForApplicationRestart(
                new RestartSettings("/recover", RestartRestrictions.NotOnPatch | RestartRestrictions.NotOnReboot));

            //Register Recovery data.
            var data   = new RecoveryData(RecoverDataCallback, null);
            var seting = new RecoverySettings(data, 0);

            ApplicationRestartRecoveryManager.RegisterForApplicationRecovery(seting);

            // Lets Check wheher recovery needed
            var args = Environment.GetCommandLineArgs();

            if (args.Length > 1 && args[1].Equals("/recovery", StringComparison.InvariantCultureIgnoreCase))
            {
                StartRecovery("/recovery");
            }
            SaveButton.IsEnabled = false;
        }
Esempio n. 11
0
 private void RegisterARR()
 {
     ApplicationRestartRecoveryManager.RegisterForApplicationRestart(new RestartSettings(string.Empty, RestartRestrictions.None));
     ApplicationRestartRecoveryManager.RegisterForApplicationRecovery(new RecoverySettings(new RecoveryData(PerformRecovery, null), 5000));
 }