Ejemplo n.º 1
0
        private void Restore()
        {
            OpenFileDialog dialog = new OpenFileDialog();
              dialog.Filter = Files.BackupFileFilter;
              dialog.CheckFileExists = true;
              dialog.Multiselect = false;
              dialog.Title = Resources.RestoreBackupDialogTitle;

              if (dialog.ShowDialog() == DialogResult.OK)
              {
            try
            {
              BackupFile backup = new BackupFile(this.controller.Status.DataPath, dialog.FileName);
              backup.BeginExtract();

              BackupProgressDialog backupDialog = new BackupProgressDialog();
              backupDialog.SetProgress(backup.FileName, backup.Progress);
              backupDialog.Show();

              while (!backup.Complete)
              {
            backupDialog.SetProgress(backup.FileName, backup.Progress);
            Application.DoEvents();
            Thread.Sleep(1);
              }

              backupDialog.Close();

              Status.TextStatusDialog.ShowInfo(this.controller, this);
              this.controller.LoadCertificates();
              Status.TextStatusDialog.HideInfo();
              LoadCertificates();

              MessageForm.Show(Resources.RestoreBackupDone, Resources.MessageBoxTitle, MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            catch (Exception exception)
            {
              Error.ErrorDialog.ShowError(exception);
            }
              }
        }
Ejemplo n.º 2
0
        private void Backup()
        {
            SaveFileDialog dialog = new SaveFileDialog();
              dialog.Filter = Files.BackupFileFilter;
              dialog.CheckPathExists = true;
              dialog.Title = Resources.SaveBackupDialogTitle;

              if (dialog.ShowDialog() == DialogResult.OK)
              {
            try
            {
              BackupFile backup = new BackupFile(this.controller.Status.DataPath, dialog.FileName);
              backup.BeginCreate();

              BackupProgressDialog backupDialog = new BackupProgressDialog();
              backupDialog.SetProgress(backup.FileName, backup.Progress);
              backupDialog.Show();

              while (!backup.Complete)
              {
            backupDialog.SetProgress(backup.FileName, backup.Progress);
            Application.DoEvents();
            Thread.Sleep(1);
              }

              backupDialog.Close();

              MessageForm.Show(Resources.SaveBackupDone, Resources.MessageBoxTitle, MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            catch (Exception exception)
            {
              Error.ErrorDialog.ShowError(exception);
            }
              }
        }