Example #1
0
        private void Restore(object sender, DoWorkEventArgs args)
        {
            //TODO: add a Try-Catch here
            Schedule s = m_wrapper.DataConnection.GetObjectById<Schedule>(m_wrapper.ScheduleID);

            RestoreTask task = new RestoreTask(s, m_wrapper.FullRestorePath, m_wrapper.RestoreFilter, m_wrapper.RestoreTime);
            Dictionary<string, string> options = new Dictionary<string, string>();
            string destination = task.GetConfiguration(options);
            if (options.ContainsKey("filter"))
                options.Remove("filter");

            using (Library.Main.Interface i = new XervBackup.Library.Main.Interface(destination, options))
            {
                i.OperationProgress += new XervBackup.Library.Main.OperationProgressEvent(i_OperationProgress);
                i.Restore(task.LocalPath.Split(System.IO.Path.PathSeparator));
            }
        }
Example #2
0
 /// <summary>
 /// Call XervBackup for the restore
 /// </summary>
 /// <param name="aSource">Source file</param>
 /// <param name="aTarget">Place to put it</param>
 /// <param name="aOptions">XervBackup Options</param>
 private void Restore(string aSource, string aTarget, Dictionary<string,string> aOptions)
 {
     this.ProgressGroupBox.Visible = true;
     this.ProgressGroupBox.BringToFront();
     this.progressBar.Style = ProgressBarStyle.Marquee;
     this.RestoreToolStripButton.Enabled = false;
     this.treeView.Enabled = false;
     string Result = null;
     Utility.Tools.Background((Action)
         delegate()
         {
             using (XervBackup.Library.Main.Interface i = new XervBackup.Library.Main.Interface(aSource, FixOptions(aOptions)))
                 Result = i.Restore(new string[] { aTarget });
         });
     MessageBox.Show(Result);
     this.ProgressGroupBox.Visible = false;
     this.RestoreToolStripButton.Enabled = true;
     this.treeView.Enabled = true;
 }