Example #1
0
 /// <summary>
 /// Handles the Click event of the restoreBackupFileToolStripMenuItem control.
 /// </summary>
 /// <param name="sender">The source of the event.</param>
 /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
 private void restoreBackupFileToolStripMenuItem_Click(object sender, EventArgs e)
 {
     if (this.backupFilesList.SelectedItems.Count > 0)
     {
         if (_loadedConfigFile == null)
         {
             SaveFileDialog sfd = new SaveFileDialog();
             sfd.Title    = "Restore backup to file...";
             sfd.FileName = "ccnet.config";
             sfd.Filter   = Properties.Strings.OpenSaveFilter;
             if (sfd.ShowDialog(this) == DialogResult.OK)
             {
                 _loadedConfigFile = new FileInfo(sfd.FileName);
             }
         }
         BackupFileListViewItem bflvi     = this.backupFilesList.SelectedItems[0] as BackupFileListViewItem;
         FileInfo            backupFile   = bflvi.FileInfo;
         FileInfo            restoredFile = _loadedConfigFile;
         BackupFileEventArgs be           = new BackupFileEventArgs(backupFile, restoredFile);
         OnBeforeRestoreConfigurationFromBackup(be);
         bflvi.RestoreBackup(restoredFile);
         OnAfterRestoreConfigurationFromBackup(be);
         Thread threadLoadBackupFiles = new Thread(new ThreadStart(LoadBackupsToListView));
         threadLoadBackupFiles.Start();
     }
 }
Example #2
0
 /// <summary>
 /// Raises the <see cref="E:AfterRestoreConfigurationFromBackup"/> event.
 /// </summary>
 /// <param name="e">The <see cref="CCNetConfig.Components.BackupFileEventArgs"/> instance containing the event data.</param>
 private void OnAfterRestoreConfigurationFromBackup(BackupFileEventArgs e)
 {
     if (this.AfterRestoreConfigurationFromBackup != null)
     {
         this.AfterRestoreConfigurationFromBackup(this, e);
     }
 }