void FinishedRestore_PageLeave(object sender, PageChangedArgs args)
        {
            if (args.Direction == PageChangedDirection.Back)
                return;

            if (!RunInBackground.Checked)
            {
                try
                {
                    m_waitdlg = new XervBackup.GUI.HelperControls.WaitForOperation();
                    m_waitdlg.Setup(new DoWorkEventHandler(Restore), Strings.FinishedRestore.RestoreWaitDialogTitle, true);
                    if (m_waitdlg.ShowDialog() != DialogResult.OK)
                    {
                        if (m_waitdlg.Error != null)
                            throw m_waitdlg.Error;

                        args.Cancel = true;
                        return;
                    }

                    m_owner.CancelButton.PerformClick();
                    m_waitdlg = null;
                }
                catch (Exception ex)
                {
                    MessageBox.Show(this, string.Format(Strings.FinishedRestore.RestoreFailedError, ex.Message), Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                args.Cancel = true;
                return;
            }
        }
        void RunNowFinished_PageEnter(object sender, PageChangedArgs args)
        {
            m_wrapper = new WizardSettingsWrapper(m_settings);

            Summary.Text = string.Format(Strings.RunNowFinished.SummaryText, m_wrapper.ScheduleName);
            args.TreatAsLast = true;
        }
        void AdvancedOptions_PageLeave(object sender, PageChangedArgs args)
        {
            m_settings["Advanced:When"] = SelectWhen.Checked;
            m_settings["Advanced:Incremental"] = SelectCleanup.Checked;
            m_settings["Advanced:Throttle"] = LimitOptions.Checked;
            m_settings["Advanced:Filters"] = EditFilters.Checked;
            m_settings["Advanced:Overrides"] = EditOverrides.Checked;

            if (args.Direction == PageChangedDirection.Back)
                return;

            m_wrapper.IncludeSetup = IncludeXervBackupSetup.Checked;

            List<IWizardControl> pages = new List<IWizardControl>();
            if (SelectWhen.Checked)
                pages.Add(new Wizard_pages.Add_backup.SelectWhen());
            if (SelectCleanup.Checked)
                pages.Add(new Wizard_pages.Add_backup.CleanupSettings());
            if (LimitOptions.Checked)
                pages.Add(new Wizard_pages.Add_backup.ThrottleOptions());
            if (EditFilters.Checked)
                pages.Add(new Wizard_pages.Add_backup.EditFilters());
            if (EditOverrides.Checked)
                pages.Add(new Wizard_pages.Add_backup.SettingOverrides());

            pages.Add(new Wizard_pages.Add_backup.FinishedAdd());

            m_owner.Pages.Clear();
            m_owner.Pages.AddRange(pages);
            args.NextPage = pages[0];
        }
        void RunNowFinished_PageLeave(object sender, PageChangedArgs args)
        {
            if (args.Direction == PageChangedDirection.Back)
                return;

            m_wrapper.ForceFull = ForceFull.Checked;
        }
 void AdvancedOptions_PageEnter(object sender, PageChangedArgs args)
 {
     m_wrapper = new WizardSettingsWrapper(m_settings);
     if (!m_valuesAutoLoaded)
     {
         IncludeXervBackupSetup.Checked = m_wrapper.IncludeSetup;
         EditOverrides.Checked = m_wrapper.Overrides.Count > 0;
     }
 }
        void FinishedRestoreSetup_PageEnter(object sender, PageChangedArgs args)
        {
            m_wrapper = new WizardSettingsWrapper(m_settings);

            List<KeyValuePair<string, string>> strings = new List<KeyValuePair<string, string>>();
            strings.Add(new KeyValuePair<string, string>(Strings.FinishedRestoreSetup.SummaryAction, Strings.FinishedRestoreSetup.SummaryRestoreBackup));

            strings.Add(new KeyValuePair<string, string>(null, null));
            strings.Add(new KeyValuePair<string, string>(Strings.FinishedRestoreSetup.SummarySource, m_wrapper.Backend.ToString()));

            //TODO: Figure out how to make summary

            /*switch(m_wrapper.Backend)
            {
                case WizardSettingsWrapper.BackendType.File:
                    FileSettings file = new FileSettings(m_wrapper);
                    strings.Add(new KeyValuePair<string, string>(Strings.FinishedRestoreSetup.SummarySourcePath, file.Path));
                    break;
                case WizardSettingsWrapper.BackendType.FTP:
                    FTPSettings ftp = new FTPSettings(m_wrapper);
                    strings.Add(new KeyValuePair<string, string>(Strings.FinishedRestoreSetup.SummarySourcePath, ftp.Server + "/" + ftp.Path));
                    break;
                case WizardSettingsWrapper.BackendType.SSH:
                    SSHSettings ssh = new SSHSettings(m_wrapper);
                    strings.Add(new KeyValuePair<string, string>(Strings.FinishedRestoreSetup.SummarySourcePath, ssh.Server + "/" + ssh.Path));
                    break;
                case WizardSettingsWrapper.BackendType.S3:
                    S3Settings s3 = new S3Settings(m_wrapper);
                    strings.Add(new KeyValuePair<string, string>(Strings.FinishedRestoreSetup.SummarySourcePath, s3.Path));
                    break;
                case WizardSettingsWrapper.BackendType.WebDav:
                    WEBDAVSettings webdav = new WEBDAVSettings(m_wrapper);
                    strings.Add(new KeyValuePair<string, string>(Strings.FinishedRestoreSetup.SummarySourcePath, webdav.Path));
                    break;
            }*/

            int maxlen = 0;
            foreach (KeyValuePair<string, string> i in strings)
                if (i.Key != null)
                    maxlen = Math.Max(maxlen, i.Key.Length);

            System.Text.StringBuilder sb = new StringBuilder();
            foreach (KeyValuePair<string, string> i in strings)
                if (i.Key == null)
                    sb.Append("\r\n");
                else
                    sb.Append(i.Key + ": " + new String(' ', maxlen - i.Key.Length) + i.Value + "\r\n");

            Summary.Text = sb.ToString();

            args.TreatAsLast = true;
        }
Beispiel #7
0
        protected override void GridContainer_PageLeave(object sender, PageChangedArgs args)
        {
            base.GridContainer_PageLeave(sender, args);
            m_options.Add(GridContainer.DESTINATION_EXTENSION_KEY, Destination.Text);

            if (args.Direction == PageChangedDirection.Back || args.Cancel == true)
                return;

            if (string.IsNullOrEmpty(Destination.Text) || Destination.Text.Trim().Length == 0)
            {
                MessageBox.Show(this, Library.Interface.CommonStrings.EmptyServernameError, Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Information);
                args.Cancel = true;
                return;
            }
        }
Beispiel #8
0
        void SelectName_PageEnter(object sender, PageChangedArgs args)
        {
            m_wrapper = new WizardSettingsWrapper(m_settings);

            BackupFolder.Setup(Program.DataConnection, true, true);

            if (!m_valuesAutoLoaded)
            {
                BackupName.Text = m_wrapper.ScheduleName;
                BackupFolder.SelectedFolder = m_wrapper.SchedulePath;
            }

            try { BackupName.Focus(); }
            catch { }
        }
Beispiel #9
0
 void MainPage_PageDisplay(object sender, PageChangedArgs args)
 {
     //Skip this, if there is only one valid option
     if (Program.DataConnection.GetObjects<Datamodel.Schedule>().Length == 0)
     {
         m_isFirstShow = false;
         if (args.Direction == PageChangedDirection.Next)
         {
             CreateNew.Checked = true;
             try { m_owner.NextButton.PerformClick(); }
             catch { }
         }
         else
         {
             try { m_owner.BackButton.PerformClick(); }
             catch { }
         }
     }
 }
        void FinishedRestore_PageEnter(object sender, PageChangedArgs args)
        {
            m_wrapper = new WizardSettingsWrapper(m_settings);

            Summary.Text = string.Format(
                Strings.FinishedRestore.SummaryText,
                m_wrapper.ScheduleName,
                (m_wrapper.RestoreTime.Ticks == 0 ? Strings.FinishedRestore.MostRecent : m_wrapper.RestoreTime.ToString()),
                m_wrapper.DisplayRestorePath
            );

            args.TreatAsLast = true;

            Schedule schedule = m_wrapper.DataConnection.GetObjectById<Schedule>(m_wrapper.ScheduleID);
            if (!schedule.ExistsInDb)
            {
                RunInBackground.Checked = false;
                RunInBackground.Visible = false;
            }
        }
Beispiel #11
0
        void SelectBackend_PageDisplay(object sender, PageChangedArgs args)
        {
            Item_CheckChanged(null, null);

            //If there is just one backend, skip this page
            if (BackendList.Controls.Count == 1)
            {
                if (args.Direction == PageChangedDirection.Next)
                {
                    ((RadioButton)BackendList.Controls[0]).Checked = true;
                    try { m_owner.NextButton.PerformClick(); }
                    catch { }
                }
                else
                {
                    try { m_owner.BackButton.PerformClick(); }
                    catch { }
                }
            }
        }
        void SelectBackupVersion_PageLeave(object sender, PageChangedArgs args)
        {
            if (args.Direction == PageChangedDirection.Back)
            {
                BackupList.Abort();
                return;
            }

            if (BackupList.SelectedItem.Ticks == 0)
            {
                MessageBox.Show(this, Strings.SelectBackupVersion.NoBackupSelectedError, Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Information);
                args.Cancel = true;
                return;
            }

            m_selectedDate = new DateTime();
            m_selectedDate = BackupList.SelectedItem;

            m_wrapper.RestoreTime = m_selectedDate;
            args.NextPage = new TargetFolder();
        }
Beispiel #13
0
        void TargetFolder_PageLeave(object sender, PageChangedArgs args)
        {
            m_wrapper.RestoreTargetFolders = backupFileList.TargetFolders;
            m_wrapper.RestoreFileSelection = backupFileList.CheckedFiles;

            if (args.Direction == PageChangedDirection.Back)
                return;

            string[] targetpaths;
            Dictionary<string, string> filesInFolder = new Dictionary<string,string>();

            if (PartialRestore.Checked && backupFileList.TargetFolders.Count > 1)
            {
                targetpaths = backupFileList.TargetSuggestions;
                for (int i = 0; i < targetpaths.Length; i++)
                    if (string.IsNullOrEmpty(targetpaths[i]))
                    {
                        if (!string.IsNullOrEmpty(TargetPath.Text) && TargetPath.Text.Trim().Length != 0)
                            targetpaths[i] = Library.Utility.Utility.AppendDirSeparator(TargetPath.Text) + i.ToString();
                    }

                foreach (string s in m_wrapper.RestoreFileSelection)
                {
                    int index = int.Parse(s.Substring(0, s.IndexOf(System.IO.Path.DirectorySeparatorChar)));
                    if (string.IsNullOrEmpty(targetpaths[index]))
                    {
                        MessageBox.Show(this, Strings.TargetFolder.NoFolderError, Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Information);
                        args.Cancel = true;
                        return;
                    }
                    filesInFolder[targetpaths[index]] = null;
                }
            }
            else
            {
                if (TargetPath.Text.Trim().Length == 0)
                {
                    MessageBox.Show(this, Strings.TargetFolder.NoFolderError, Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Information);
                    args.Cancel = true;
                    return;
                }

                targetpaths = new string[] { TargetPath.Text.Trim() };
                filesInFolder[TargetPath.Text] = null;
            }

            //if the filelist is loaded, we can verify the file length
            if (!Library.Utility.Utility.IsClientLinux)
            {
                if (backupFileList.LoadedFileList != null && backupFileList.LoadedFileList.Count != 0)
                {
                    long maxPath = 0;
                    List<string> files = PartialRestore.Checked ? m_wrapper.RestoreFileSelection : backupFileList.LoadedFileList;

                    if (backupFileList.TargetFolders.Count > 1)
                    {
                        string[] restorefolders = PartialRestore.Checked ? targetpaths : backupFileList.TargetSuggestions;
                        foreach (string s in files)
                        {
                            int sepIndx = s.IndexOf(System.IO.Path.DirectorySeparatorChar) + 1;
                            int index = int.Parse(s.Substring(0, s.IndexOf(System.IO.Path.DirectorySeparatorChar)));
                            if (index >= 0 && index < restorefolders.Length && !string.IsNullOrEmpty(restorefolders[index]))
                                maxPath = Math.Max(restorefolders[index].Length + s.Length + 1 - sepIndx, maxPath);
                        }
                    }
                    else
                    {
                        foreach (string s in files)
                            maxPath = Math.Max(TargetPath.Text.Length + s.Length + 1, maxPath);
                    }

                    if (maxPath > 245)
                    {
                        if (MessageBox.Show(this, string.Format(Strings.TargetFolder.PathTooLongWarning, maxPath), Application.ProductName, MessageBoxButtons.YesNoCancel, MessageBoxIcon.Warning) != DialogResult.Yes)
                        {
                            args.Cancel = true;
                            return;
                        }
                    }

                }
            }

            bool anyValids = false;
            for (int i = 0; i < targetpaths.Length; i++)
            {
                string targetpath = targetpaths[i] ?? "";

                try
                {
                    //Skip the verification for folders with no target files
                    if (!filesInFolder.ContainsKey(targetpath))
                    {
                        targetpaths[i] = "";
                        continue;
                    }

                    if (targetpath.Trim().Length == 0)
                    {
                        MessageBox.Show(this, Strings.TargetFolder.NoFolderError, Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Information);
                        args.Cancel = true;
                        return;
                    }

                    if (!System.IO.Path.IsPathRooted(targetpath))
                    {
                        MessageBox.Show(this, string.Format(Strings.TargetFolder.FolderPathIsRelativeError, targetpath), Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Information);
                        args.Cancel = true;
                        return;
                    }

                    if (!System.IO.Directory.Exists(targetpath))
                    {
                        switch (MessageBox.Show(this, string.Format(Strings.TargetFolder.CreateNewFolderWarning, targetpath), Application.ProductName, MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question))
                        {
                            case DialogResult.Yes:
                                System.IO.Directory.CreateDirectory(targetpath);
                                break;
                            case DialogResult.Cancel:
                                args.Cancel = true;
                                return;
                        }
                    }

                    if (System.IO.Directory.GetFileSystemEntries(targetpath).Length > 0)
                        if (MessageBox.Show(this, string.Format(Strings.TargetFolder.FolderIsNotEmptyWarning, targetpath), Application.ProductName, MessageBoxButtons.YesNoCancel, MessageBoxIcon.Warning) != DialogResult.Yes)
                        {
                            args.Cancel = true;
                            return;
                        }

                    anyValids = true;
                }
                catch (Exception ex)
                {
                    MessageBox.Show(this, string.Format(Strings.TargetFolder.FolderValidationError, targetpath, ex.Message), Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Error);
                    args.Cancel = true;
                    return;
                }
            }

            if ( !anyValids || (PartialRestore.Checked && m_wrapper.RestoreFileSelection.Count == 0))
            {
                MessageBox.Show(this, Strings.TargetFolder.NoFilesSelectedError, Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Information);
                args.Cancel = true;
                return;
            }

            if (PartialRestore.Checked)
            {
                m_wrapper.DisplayRestorePath = string.Join(System.IO.Path.PathSeparator.ToString(), targetpaths);
                m_wrapper.RestoreFilter = string.Join(System.IO.Path.PathSeparator.ToString(), backupFileList.CheckedFiles.ToArray());
            }
            else
            {
                m_wrapper.DisplayRestorePath = targetpaths[0];
                m_wrapper.RestoreFilter = "";
            }
            args.NextPage = new FinishedRestore();
        }
Beispiel #14
0
 void TargetFolder_PageEnter(object sender, PageChangedArgs args)
 {
     m_wrapper = new WizardSettingsWrapper(m_settings);
     if (PartialRestore.Checked)
         PartialRestore_CheckedChanged(null, null);
 }
Beispiel #15
0
        void FinishedAdd_PageEnter(object sender, PageChangedArgs args)
        {
            m_wrapper = new WizardSettingsWrapper(m_settings);

            List<KeyValuePair<string, string>> strings = new List<KeyValuePair<string, string>>();
            if (m_wrapper.PrimayAction == WizardSettingsWrapper.MainAction.Add)
                strings.Add(new KeyValuePair<string, string>(Strings.FinishedAdd.SummaryAction, Strings.FinishedAdd.SummaryActionAdd));
            else
                strings.Add(new KeyValuePair<string, string>(Strings.FinishedAdd.SummaryAction, Strings.FinishedAdd.SummaryActionModify));

            strings.Add(new KeyValuePair<string, string>(Strings.FinishedAdd.SummarySourceFolder, m_wrapper.SourcePath));
            strings.Add(new KeyValuePair<string, string>(Strings.FinishedAdd.SummaryWhen, m_wrapper.BackupTimeOffset.ToString()));
            if (!string.IsNullOrEmpty(m_wrapper.RepeatInterval))
                strings.Add(new KeyValuePair<string, string>(Strings.FinishedAdd.SummaryRepeat, m_wrapper.RepeatInterval));
            if (!string.IsNullOrEmpty(m_wrapper.FullBackupInterval))
                strings.Add(new KeyValuePair<string, string>(Strings.FinishedAdd.SummaryFullBackupEach, m_wrapper.FullBackupInterval));
            if (m_wrapper.MaxFullBackups > 0)
                strings.Add(new KeyValuePair<string, string>(Strings.FinishedAdd.SummaryKeepFullBackups, m_wrapper.MaxFullBackups.ToString()));

            strings.Add(new KeyValuePair<string, string>(null, null));
            strings.Add(new KeyValuePair<string, string>(Strings.FinishedAdd.SummaryDestination, m_wrapper.Backend.ToString()));

            //TODO: Figure out how to make a summary

            /*switch(m_wrapper.Backend)
            {
                case WizardSettingsWrapper.BackendType.File:
                    FileSettings file = new FileSettings(m_wrapper);
                    strings.Add(new KeyValuePair<string, string>(Strings.FinishedAdd.SummaryDestinationPath, file.Path));
                    break;
                case WizardSettingsWrapper.BackendType.FTP:
                    FTPSettings ftp = new FTPSettings(m_wrapper);
                    strings.Add(new KeyValuePair<string, string>(Strings.FinishedAdd.SummaryDestinationPath, ftp.Server + "/" + ftp.Path));
                    break;
                case WizardSettingsWrapper.BackendType.SSH:
                    SSHSettings ssh = new SSHSettings(m_wrapper);
                    strings.Add(new KeyValuePair<string, string>(Strings.FinishedAdd.SummaryDestinationPath, ssh.Server + "/" + ssh.Path));
                    break;
                case WizardSettingsWrapper.BackendType.S3:
                    S3Settings s3 = new S3Settings(m_wrapper);
                    strings.Add(new KeyValuePair<string, string>(Strings.FinishedAdd.SummaryDestinationPath, s3.Path));
                    break;
                case WizardSettingsWrapper.BackendType.WebDav:
                    WEBDAVSettings webdav = new WEBDAVSettings(m_wrapper);
                    strings.Add(new KeyValuePair<string, string>(Strings.FinishedAdd.SummaryDestinationPath, webdav.Path));
                    break;
            }*/

            int maxlen = 0;
            foreach (KeyValuePair<string, string> i in strings)
                if (i.Key != null)
                    maxlen = Math.Max(maxlen, i.Key.Length);

            System.Text.StringBuilder sb = new StringBuilder();
            foreach (KeyValuePair<string, string> i in strings)
                if (i.Key == null)
                    sb.Append("\r\n");
                else
                    sb.Append(i.Key + ": " + new String(' ', maxlen - i.Key.Length) + i.Value + "\r\n");

            Summary.Text = sb.ToString();

            args.TreatAsLast = true;

            CommandLine.Text = "";
            Tabs.SelectedTab = TabSummary;
        }
Beispiel #16
0
        void FinishedAdd_PageLeave(object sender, PageChangedArgs args)
        {
            if (args.Direction == PageChangedDirection.Back)
                return;

            m_wrapper.RunImmediately = RunNow.Checked;
        }
Beispiel #17
0
        private void BackBtn_Click(object sender, EventArgs e)
        {
            try
            {
                m_isBack = true;
                PageChangedArgs args = new PageChangedArgs(this, false, PageChangedDirection.Back);

                if (m_visited.Count > 0)
                    args.NextPage = m_visited.Pop();

                if (this.CurrentPage != null)
                    this.CurrentPage.Leave(this, args);

                if (BackPressed != null)
                    BackPressed(this, args);

                if (args.Cancel || args.NextPage == null)
                    return;

                m_isLastPage = args.TreatAsLast;
                CurrentPage = args.NextPage;
            }
            finally
            {
                m_isBack = false;
            }

            BeginInvoke(new EventHandler(RefocusElement), sender, e);
        }
Beispiel #18
0
 void MainPage_PageEnter(object sender, PageChangedArgs args)
 {
     m_wrapper = new WizardSettingsWrapper(m_settings);
     UpdateButtonState();
     args.TreatAsLast = false;
 }
Beispiel #19
0
        void SelectBackend_PageEnter(object sender, PageChangedArgs args)
        {
            m_wrapper = new WizardSettingsWrapper(m_settings);

            int top = 0;
            BackendList.Controls.Clear();

            //Sort backends by display name
            SortedList<string, Library.Interface.IBackend> lst = new SortedList<string, XervBackup.Library.Interface.IBackend>();
            foreach (Library.Interface.IBackend backend in Library.DynamicLoader.BackendLoader.Backends)
                lst.Add(backend.DisplayName.Trim().ToLower(), backend);

            foreach (Library.Interface.IBackend backend in lst.Values)
            {
                DoubleClickRadioButton button = new DoubleClickRadioButton();
                button.AutoSize = true;
                button.Text = backend.DisplayName;
                toolTips.SetToolTip(button, backend.Description);
                button.Left = 0;
                button.Top = top;
                button.Tag = backend;
                button.CheckedChanged += new EventHandler(Item_CheckChanged);
                button.DoubleClick += new EventHandler(button_DoubleClick);

                button.Checked = (backend.ProtocolKey == m_wrapper.Backend);

                top += button.Height + 5;
                BackendList.Controls.Add(button);
            }

            Item_CheckChanged(null, null);

            if (m_wrapper.PrimayAction == WizardSettingsWrapper.MainAction.RestoreSetup || m_wrapper.PrimayAction == WizardSettingsWrapper.MainAction.Restore)
                Question.Text = Strings.SelectBackend.RestoreSetupTitle;
        }
Beispiel #20
0
        private void NextBtn_Click(object sender, EventArgs e)
        {
            m_isBack = false;
            IWizardControl nextpage = null;
            int pos = Pages.IndexOf(CurrentPage);
            if (pos >= 0 && pos < Pages.Count - 1)
                nextpage = Pages[pos + 1];

            PageChangedArgs args = new PageChangedArgs(this, Pages.IndexOf(nextpage) == Pages.Count - 1 && Pages.Count != 0, PageChangedDirection.Next);
            args.NextPage = nextpage;

            if (m_currentPage != null)
            {
                m_currentPage.Leave(this, args);
                if (args.Cancel)
                    return;
            }

            if (m_isLastPage)
            {
                if (Finished != null)
                {
                    CancelEventArgs ce = new CancelEventArgs(false);
                    Finished(this, ce);
                    if (ce.Cancel)
                        return;
                }

                this.DialogResult = DialogResult.OK;
                this.Close();

                return;
            }

            if (NextPressed != null)
                NextPressed(this, args);
            if (args.Cancel || args.NextPage == null)
                return;

            if (CurrentPage != null)
                m_visited.Push(CurrentPage);
            m_isLastPage = args.TreatAsLast;
            UpdateButtons();

            CurrentPage = args.NextPage;

            BeginInvoke(new EventHandler(RefocusElement), sender, e);
        }
Beispiel #21
0
        void SelectName_PageLeave(object sender, PageChangedArgs args)
        {
            if (args.Direction == PageChangedDirection.Back)
                return;

            if (BackupName.Text.Trim().Length <= 0)
            {
                MessageBox.Show(this, Strings.SelectName.NoNameEnteredError, Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Information);
                args.Cancel = true;
                return;
            }

            try
            {
                Schedule[] tmp = Program.DataConnection.GetObjects<Schedule>("Name LIKE ? AND Path LIKE ?", BackupName.Text, BackupFolder.SelectedFolder);
                if ((tmp.Length == 1 && tmp[0].ID != m_wrapper.ScheduleID) || tmp.Length > 1)
                {
                    MessageBox.Show(this, Strings.SelectName.DuplicateNameEnteredError, Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Information);
                    args.Cancel = true;
                    return;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(this, string.Format(Strings.SelectName.InvalidNameEnteredError, ex.Message), Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Information);
                args.Cancel = true;
                return;
            }

            m_wrapper.ScheduleName = BackupName.Text;
            m_wrapper.SchedulePath = BackupFolder.SelectedFolder;

            args.NextPage = new SelectFiles();
        }
Beispiel #22
0
 void SelectName_PageDisplay(object sender, PageChangedArgs args)
 {
     try { BackupName.Focus(); }
     catch { }
 }
Beispiel #23
0
        void MainPage_PageLeave(object sender, PageChangedArgs args)
        {
            if (args.Direction == PageChangedDirection.Back)
                return;

            m_wrapper.DataConnection = Program.DataConnection;

            if (CreateNew.Checked)
                m_wrapper.PrimayAction = WizardSettingsWrapper.MainAction.Add;
            else if (Edit.Checked)
                m_wrapper.PrimayAction = WizardSettingsWrapper.MainAction.Edit;
            else if (Restore.Checked)
                m_wrapper.PrimayAction = WizardSettingsWrapper.MainAction.Restore;
            else if (Backup.Checked)
                m_wrapper.PrimayAction = WizardSettingsWrapper.MainAction.RunNow;
            else if (Remove.Checked)
                m_wrapper.PrimayAction = WizardSettingsWrapper.MainAction.Remove;
            else
            {
                m_wrapper.PrimayAction = WizardSettingsWrapper.MainAction.Unknown;
                args.NextPage = null;
                args.Cancel = true;
                return;
            }

            if (m_wrapper.PrimayAction == WizardSettingsWrapper.MainAction.Add)
            {
                args.NextPage = new Add_backup.SelectName();
                m_wrapper.SetupDefaults();
                m_wrapper.PrimayAction = WizardSettingsWrapper.MainAction.Add;
            }
            else
                args.NextPage = new SelectBackup();
        }
Beispiel #24
0
 void IWizardControl.Enter(IWizardForm owner, PageChangedArgs args)
 {
 }
Beispiel #25
0
        void SelectBackend_PageLeave(object sender, PageChangedArgs args)
        {
            if (args.Direction == PageChangedDirection.Back)
                return;

            Library.Interface.IBackend selectedBackend = null;
            foreach (RadioButton button in BackendList.Controls)
                if (button.Checked && button.Tag is Library.Interface.IBackend)
                    selectedBackend = button.Tag as Library.Interface.IBackend;

            if (selectedBackend == null)
            {
                MessageBox.Show(this, Strings.SelectBackend.NoActionSelected, Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Information);
                args.Cancel = true;
                return;
            }

            //If the user chooses another backend, we need to clear the settings,
            // so items like the tested flag are not set
            if (m_wrapper.Backend != selectedBackend.ProtocolKey)
                m_wrapper.BackendSettings.Clear();

            m_wrapper.Backend = selectedBackend.ProtocolKey;

            if (m_wrapper.PrimayAction == WizardSettingsWrapper.MainAction.Restore)
            {
                if (m_wrapper.ShowAdvancedRestoreOptions)
                    args.NextPage = new Add_backup.SettingOverrides();
                else
                    args.NextPage = new Restore.SelectBackupVersion();
            }
            else if (m_wrapper.PrimayAction == WizardSettingsWrapper.MainAction.RestoreSetup)
            {
                if (m_wrapper.ShowAdvancedRestoreOptions)
                    args.NextPage = new Add_backup.SettingOverrides();
                else
                    args.NextPage = new RestoreSetup.FinishedRestoreSetup();
            }
            else
                args.NextPage = new Add_backup.AdvancedOptions();

            //Create the appropriate GUI for the backend settings
            if (selectedBackend is Library.Interface.IBackendGUI)
                args.NextPage = new GUIContainer(args.NextPage, selectedBackend as Library.Interface.IGUIControl);
            else
                args.NextPage = new Backends.RawContainer(args.NextPage, selectedBackend, m_wrapper.BackendSettings);
        }
Beispiel #26
0
        void SelectBackup_PageEnter(object sender, PageChangedArgs args)
        {
            BackupList.Setup(Program.DataConnection, true, false);
            m_wrapper = new WizardSettingsWrapper(m_settings);

            if (m_action != null)
                m_wrapper.PrimayAction = m_action.Value;

            if (m_wrapper.PrimayAction == WizardSettingsWrapper.MainAction.RunNow && m_wrapper.DataConnection == null)
                m_wrapper.DataConnection = Program.DataConnection;

            if (m_wrapper.ScheduleID > 0)
                BackupList.SelectedBackup = (m_wrapper.DataConnection ?? Program.DataConnection).GetObjectById<Schedule>(m_wrapper.ScheduleID);

            if (m_wrapper.PrimayAction == WizardSettingsWrapper.MainAction.Restore)
            {
                topLabel.Visible = false;
                RestoreOptions.Visible = true;
            }
            else
            {
                topLabel.Visible = true;
                RestoreOptions.Visible = false;
                ShowAdvancedPanel.Visible = false;
                topLabel.Text = this.Title;
            }

            if (m_valuesAutoLoaded)
            {

                m_skipFirstEvent = true;
            }

            args.TreatAsLast = false;
        }
Beispiel #27
0
 void IWizardControl.Display(IWizardForm owner, PageChangedArgs args)
 {
 }
Beispiel #28
0
        void SelectBackup_PageLeave(object sender, PageChangedArgs args)
        {
            if (args.Direction == PageChangedDirection.Back)
                return;

            if ((RestoreExisting.Checked && BackupList.SelectedBackup == null) || (!RestoreExisting.Checked && !DirectRestore.Checked))
            {
                MessageBox.Show(this, Strings.SelectBackup.NoActionSelected, Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Information);
                args.Cancel = true;
                return;
            }

            if (DirectRestore.Checked)
            {
                m_wrapper.SetupDefaults();
                m_wrapper.DataConnection = new System.Data.LightDatamodel.DataFetcherNested(Program.DataConnection);

                Schedule s = new Schedule();
                Task t = new Task();

                m_wrapper.DataConnection.Add(s);
                m_wrapper.DataConnection.Add(t);

                s.Task = t;

                m_wrapper.ScheduleID = s.ID;
                m_wrapper.PrimayAction = WizardSettingsWrapper.MainAction.Restore;
            }
            else
                m_wrapper.ReflectSchedule(BackupList.SelectedBackup);

            switch (m_wrapper.PrimayAction)
            {
                case WizardSettingsWrapper.MainAction.Edit:
                    args.NextPage = new Add_backup.SelectName();
                    break;
                case WizardSettingsWrapper.MainAction.Remove:
                    args.NextPage = new Delete_backup.DeleteFinished();
                    break;
                case WizardSettingsWrapper.MainAction.Restore:
                    m_wrapper.ShowAdvancedRestoreOptions = ShowAdvanced.Checked;
                    if (DirectRestore.Checked)
                        args.NextPage = new Add_backup.PasswordSettings();
                    else
                        args.NextPage = m_wrapper.ShowAdvancedRestoreOptions ? (IWizardControl)new Add_backup.SettingOverrides() : (IWizardControl)new Restore.SelectBackupVersion();
                    break;
                case WizardSettingsWrapper.MainAction.RunNow:
                    args.NextPage = new RunNow.RunNowFinished();
                    break;
                default:
                    args.NextPage = null;
                    args.Cancel = true;
                    return;
            }
        }
Beispiel #29
0
 void IWizardControl.Leave(IWizardForm owner, PageChangedArgs args)
 {
 }
 void SelectBackupVersion_PageEnter(object sender, PageChangedArgs args)
 {
     m_wrapper = new WizardSettingsWrapper(m_settings);
     m_wrapper.UpdateSchedule(m_wrapper.DataConnection.GetObjectById<Schedule>(m_wrapper.ScheduleID));
     BackupList.Setup(m_wrapper.DataConnection.GetObjectById<Schedule>(m_wrapper.ScheduleID));
 }