Esempio n. 1
0
        private void onBackupFinsihedHelper()
        {
            BackupClass.Dispose();

            if (BackupFinished != null)
            {
                BackupFinished.Invoke();
            }

            if (HearSoundWhenBackupCompleted)
            {
                Miscellaneous.DoBeeps();
            }

            // in support mode we always opening log and do not perform power task
            if (_options.LoggingLevel == LogLevel.Support)
            {
                SupportManager.OpenWebLinkAsync(_fileLogFile);

                Environment.Exit(0);
            }
            else
            {
                if (ErrorsOrWarningsRegistered)
                {
                    // user chose to shutdown PC or logoff from it. In this case we should
                    // add a registry key in RunOnce section to show him log in browser
                    // of backup when he will login into the system next time
                    if ((PowerTask == PowerTask.Shutdown) ||
                        (PowerTask == PowerTask.Reboot) ||
                        (PowerTask == PowerTask.LogOff))
                    {
                        NativeMethods.ScheduleOpeningFileAfterLoginOfUserIntoTheSystem(_fileLogFile);
                    }
                    else
                    // Hibernate, Sleep, Nothing
                    // we should open browser and perform required power operation
                    {
                        SupportManager.OpenWebLinkAsync(_fileLogFile);
                    }
                }
                // No problems during backup registered. In this case we should notify
                // user that's all is ok
                else
                {
                    // user is here and we can show him the message
                    if (PowerTask == PowerTask.None)
                    {
                        MessageBox.Show(Translation.Current[180], ";-)", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1, 0);
                    }
                }

                PowerPC.DoTask(PowerTask);

                if (PowerTask == PowerTask.None && ErrorsOrWarningsRegistered)
                {
                    ;
                }
                else
                {
                    Environment.Exit(0);
                }
            }
        }