예제 #1
0
        private void RegisterRecovery()
        {
            var settings = new RecoverySettings(new RecoveryData(SaveState, AppConfigs.Configuration), 0);

            ApplicationRestartRecoveryManager.RegisterForApplicationRecovery(settings);
            AppLogger.Log.Info("Recovery Registered");
        }
예제 #2
0
        private void RegisterForRecovery()
        {
            var settings = new RecoverySettings(new RecoveryData(DoRecovery, _tempPath), 0);

            ApplicationRestartRecoveryManager.RegisterForApplicationRecovery(settings);
            TraceTextBlock.Text += string.Format("{0:T}: Registered for recovery\n", DateTime.Now);
            App.Source.TraceEvent(TraceEventType.Verbose, 0, "Registered for recovery");
            // NOTE: Зарегистрировано для восстановления
        }
예제 #3
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);
            }
        }
예제 #4
0
파일: Form1.cs 프로젝트: kagada/Arianrhod
        private void RegisterForRecovery()
        {
            // Don't pass any state. We'll use our static variable "CurrentFile" to determine
            // the current state of the application.
            // Since this registration is being done on application startup, we don't have a state currently.
            // In some cases it might make sense to pass this initial state.
            // Another approach: When doing "auto-save", register for recovery everytime, and pass
            // the current state at that time.
            RecoveryData     data     = new RecoveryData(new RecoveryCallback(RecoveryProcedure), null);
            RecoverySettings settings = new RecoverySettings(data, 0);

            ApplicationRestartRecoveryManager.RegisterForApplicationRecovery(settings);

            Debug.WriteLine("ARR: Registered for recovery");
        }
예제 #5
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);
        }
예제 #6
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]);
            }
        }
예제 #7
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;
        }
예제 #8
0
        private void RegisterApplicationRecoveryAndRestart()
        {
            RecoverySettings recoverySettings = new RecoverySettings(new RecoveryData(PerformRecovery, null), 5000);

            ApplicationRestartRecoveryManager.RegisterForApplicationRecovery(recoverySettings);
        }
예제 #9
0
 private void RegisterARR()
 {
     ApplicationRestartRecoveryManager.RegisterForApplicationRestart(new RestartSettings(string.Empty, RestartRestrictions.None));
     ApplicationRestartRecoveryManager.RegisterForApplicationRecovery(new RecoverySettings(new RecoveryData(PerformRecovery, null), 5000));
 }