void IncrementalSettings_PageEnter(object sender, PageChangedArgs args) { m_wrapper = new WizardSettingsWrapper(m_settings); bool hasWarnedClean = m_wrapper.CleanupSettingsUI.HasWarnedClean; if (!m_valuesAutoLoaded) { if (m_wrapper.MaxFullBackups > 0) { CleanFullBackupCount.Value = m_wrapper.MaxFullBackups; EnableFullBackupClean.Checked = true; } else { CleanFullBackupCount.Value = 4; EnableFullBackupClean.Checked = false; } CleanupDuration.Value = m_wrapper.BackupExpireInterval; EnableCleanupDuration.Checked = !string.IsNullOrEmpty(m_wrapper.BackupExpireInterval); if (!EnableCleanupDuration.Checked) { CleanupDuration.Value = m_wrapper.FullBackupInterval; } IgnoreTimestamps.Checked = m_wrapper.IgnoreFileTimestamps; } m_wrapper.CleanupSettingsUI.HasWarnedClean = hasWarnedClean; }
public void TestWizardSetting() { var dict = new Dictionary<string, object>(); dict["WSW_Backend"] = "file"; var wsw = new WizardSettingsWrapper(dict); Assert.AreEqual("file", wsw.Backend); }
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 DeleteFinished_PageEnter(object sender, PageChangedArgs args) { m_wrapper = new WizardSettingsWrapper(m_settings); Summary.Text = string.Format(Strings.DeleteFinished.SummaryText, m_wrapper.ScheduleName); args.TreatAsLast = true; }
void TargetFolder_PageEnter(object sender, PageChangedArgs args) { m_wrapper = new WizardSettingsWrapper(m_settings); if (PartialRestore.Checked) { PartialRestore_CheckedChanged(null, null); } }
public void TestWizardSetting() { var dict = new Dictionary <string, object>(); dict["WSW_Backend"] = "file"; var wsw = new WizardSettingsWrapper(dict); Assert.AreEqual("file", wsw.Backend); }
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 AdvancedOptions_PageEnter(object sender, PageChangedArgs args) { m_wrapper = new WizardSettingsWrapper(m_settings); if (!m_valuesAutoLoaded) { IncludeDuplicatiSetup.Checked = m_wrapper.IncludeSetup; EditOverrides.Checked = m_wrapper.Overrides.Count > 0; } }
void FilterEditor_PageEnter(object sender, System.Windows.Forms.Wizard.PageChangedArgs args) { m_wrapper = new WizardSettingsWrapper(m_settings); filterEditor1.FilterXml = m_wrapper.EncodedFilterXml; List<KeyValuePair<bool, string>> lst = new List<KeyValuePair<bool, string>>(); filterEditor1.BasePath = DynamicSetupHelper.GetSourceFolders(m_wrapper, new ApplicationSettings(m_wrapper.DataConnection ?? Program.DataConnection), lst); filterEditor1.DynamicFilter = Library.Utility.FilenameFilter.EncodeAsFilter(lst); }
void FilterEditor_PageEnter(object sender, System.Windows.Forms.Wizard.PageChangedArgs args) { m_wrapper = new WizardSettingsWrapper(m_settings); filterEditor1.FilterXml = m_wrapper.EncodedFilterXml; List <KeyValuePair <bool, string> > lst = new List <KeyValuePair <bool, string> >(); filterEditor1.BasePath = DynamicSetupHelper.GetSourceFolders(m_wrapper, new ApplicationSettings(m_wrapper.DataConnection ?? Program.DataConnection), lst); filterEditor1.DynamicFilter = Library.Utility.FilenameFilter.EncodeAsFilter(lst); }
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; }
void FirstLaunch_PageLeave(object sender, System.Windows.Forms.Wizard.PageChangedArgs args) { WizardSettingsWrapper wrapper = new WizardSettingsWrapper(m_settings); if (CreateNew.Checked) { //If there are no existing backups, the mainpage just selects add, and sets the defaults args.NextPage = new MainPage(); wrapper.DataConnection = Program.DataConnection; wrapper.PrimayAction = WizardSettingsWrapper.MainAction.Add; } else if (RestoreSetup.Checked) { DialogResult res = MessageBox.Show(this, Strings.FirstLaunch.ShowAdvancedQuestion, Application.ProductName, MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2); if (res == DialogResult.Cancel) { args.Cancel = true; return; } wrapper.SetupDefaults(); wrapper.ShowAdvancedRestoreOptions = res == DialogResult.Yes; args.NextPage = new Add_backup.PasswordSettings(); wrapper.DataConnection = Program.DataConnection; wrapper.PrimayAction = WizardSettingsWrapper.MainAction.RestoreSetup; } else if (RestoreFiles.Checked) { wrapper.SetupDefaults(); wrapper.DataConnection = new System.Data.LightDatamodel.DataFetcherNested(Program.DataConnection); Datamodel.Schedule s = new Datamodel.Schedule(); Datamodel.Task t = new Datamodel.Task(); wrapper.DataConnection.Add(s); wrapper.DataConnection.Add(t); s.Task = t; wrapper.ScheduleID = s.ID; args.NextPage = new Add_backup.PasswordSettings(); wrapper.PrimayAction = WizardSettingsWrapper.MainAction.Restore; } else { MessageBox.Show(this, Strings.FirstLaunch.NoActionSelection, Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Information); args.Cancel = true; args.NextPage = null; return; } }
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 { } }
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 { } }
public static List<Library.Interface.ICommandLineArgument> GetModuleOptions(WizardSettingsWrapper wrapper, Control parent) { List<Library.Interface.ICommandLineArgument> res = new List<Library.Interface.ICommandLineArgument>(); try { res.AddRange(Library.DynamicLoader.BackendLoader.GetSupportedCommands(wrapper.Backend)); } catch (Exception ex) { if (parent != null) MessageBox.Show(parent, string.Format(Strings.SettingOverrides.BackendLoadError, ex), Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Error); } try { res.AddRange(Library.DynamicLoader.EncryptionLoader.GetSupportedCommands(wrapper.EncryptionModule)); } catch (Exception ex) { if (parent != null) MessageBox.Show(parent, string.Format(Strings.SettingOverrides.EncryptionLoadError, ex), Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Error); } try { res.AddRange(Library.DynamicLoader.CompressionLoader.GetSupportedCommands(wrapper.CompressionModule)); } catch (Exception ex) { if (parent != null) MessageBox.Show(parent, string.Format(Strings.SettingOverrides.CompressionLoadError, ex), Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Error); } try { foreach (Library.Interface.IGenericModule m in Library.DynamicLoader.GenericLoader.Modules) if (m.SupportedCommands != null) res.AddRange(m.SupportedCommands); } catch (Exception ex) { if (parent != null) MessageBox.Show(parent, string.Format(Strings.SettingOverrides.GenericModuleLoadError, ex), Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Error); } return res; }
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; } }
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; } }
void SettingOverrides_PageEnter(object sender, System.Windows.Forms.Wizard.PageChangedArgs args) { if (!OptionGrid.Unsupported) { m_wrapper = new WizardSettingsWrapper(m_settings); if (!m_settings.ContainsKey("Overrides:Table")) { IList <Library.Interface.ICommandLineArgument> primary = new Library.Main.Options(new Dictionary <string, string>()).SupportedCommands; IList <Library.Interface.ICommandLineArgument> secondary = GetModuleOptions(m_wrapper, this); OptionGrid.Setup(primary, secondary, m_wrapper.Overrides); m_settings["Overrides:Table"] = OptionGrid.DataSet; m_settings["Overrides:DataElementCache"] = OptionGrid.DataElementCache; } else { OptionGrid.DataSet = (DataSet)m_settings["Overrides:Table"]; OptionGrid.DataElementCache = (Dictionary <string, Library.Interface.ICommandLineArgument>)m_settings["Overrides:DataElementCache"]; } } }
void ThrottleOptions_PageEnter(object sender, System.Windows.Forms.Wizard.PageChangedArgs args) { m_wrapper = new WizardSettingsWrapper(m_settings); if (!m_valuesAutoLoaded) { Bandwidth.UploadLimit = m_wrapper.UploadSpeedLimit; Bandwidth.DownloadLimit = m_wrapper.DownloadSpeedLimit; if (string.IsNullOrEmpty(m_wrapper.BackupSizeLimit) || Library.Utility.Sizeparser.ParseSize(m_wrapper.BackupSizeLimit) == 0) { BackupLimitEnabled.Checked = false; } else { BackupLimitEnabled.Checked = true; BackupLimit.CurrentSize = m_wrapper.BackupSizeLimit; } VolumeSize.CurrentSize = m_wrapper.VolumeSize; AsyncEnabled.Checked = m_wrapper.AsyncTransfer; ThreadPriorityPicker.SelectedPriority = string.IsNullOrEmpty(m_wrapper.ThreadPriority) ? null : (System.Threading.ThreadPriority?)Library.Utility.Utility.ParsePriority(m_wrapper.ThreadPriority); } }
public SelectBackup(WizardSettingsWrapper.MainAction action) : this() { m_action = action; }
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; }
void IncrementalSettings_PageEnter(object sender, PageChangedArgs args) { m_wrapper = new WizardSettingsWrapper(m_settings); bool hasWarnedClean = m_wrapper.CleanupSettingsUI.HasWarnedClean; if (!m_valuesAutoLoaded) { if (m_wrapper.MaxFullBackups > 0) { CleanFullBackupCount.Value = m_wrapper.MaxFullBackups; EnableFullBackupClean.Checked = true; } else { CleanFullBackupCount.Value = 4; EnableFullBackupClean.Checked = false; } CleanupDuration.Value = m_wrapper.BackupExpireInterval; EnableCleanupDuration.Checked = !string.IsNullOrEmpty(m_wrapper.BackupExpireInterval); if (!EnableCleanupDuration.Checked) CleanupDuration.Value = m_wrapper.FullBackupInterval; IgnoreTimestamps.Checked = m_wrapper.IgnoreFileTimestamps; } m_wrapper.CleanupSettingsUI.HasWarnedClean = hasWarnedClean; }
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)); }
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; }
void SelectFiles_PageEnter(object sender, PageChangedArgs args) { m_wrapper = new WizardSettingsWrapper(m_settings); m_owner.Cancelled += new CancelEventHandler(m_owner_Cancelled); if (m_settings.ContainsKey("Files:Sizes")) { m_sizes = (Dictionary <string, long>)m_settings["Files:Sizes"]; } if (!m_valuesAutoLoaded) { if (m_wrapper.SelectFilesUI.Version < 2) { //Either upgrade or fresh copy if (string.IsNullOrEmpty(m_wrapper.SourcePath)) { //Set defaults DocumentsRadio.Checked = true; IncludeDocuments.Checked = true; IncludeImages.Checked = true; IncludeMusic.Checked = false; IncludeDesktop.Checked = true; IncludeSettings.Checked = false; } else { UpgradeFromVersionOne(); } } else { //Multifolder version if (m_wrapper.SelectFilesUI.UseSimpleMode) { IncludeDocuments.Checked = m_wrapper.SelectFilesUI.IncludeDocuments; IncludeImages.Checked = m_wrapper.SelectFilesUI.IncludeImages; IncludeMusic.Checked = m_wrapper.SelectFilesUI.IncludeMusic; IncludeDesktop.Checked = m_wrapper.SelectFilesUI.IncludeDesktop; IncludeSettings.Checked = m_wrapper.SelectFilesUI.IncludeSettings; DocumentsRadio.Checked = true; } else { FolderRadio.Checked = true; } } } //Always populate the list InnerControlContainer.Controls.Clear(); if (!string.IsNullOrEmpty(m_wrapper.SourcePath)) { foreach (string s in m_wrapper.SourcePath.Split(System.IO.Path.PathSeparator)) { if (!string.IsNullOrEmpty(s)) { AddFolderControl().SelectedPath = s; } } } Rescan(); //Make sure we resize correctly TargetType_CheckedChanged(null, null); }
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; }
void SelectWhen_PageEnter(object sender, PageChangedArgs args) { m_wrapper = new WizardSettingsWrapper(m_settings); bool hasWarnedNoSchedule = m_wrapper.SelectWhenUI.HasWarnedNoSchedule; bool HasWarnedTooManyIncremental = m_wrapper.SelectWhenUI.HasWarnedTooManyIncremental; bool hasWarnedNoIncrementals = m_wrapper.SelectWhenUI.HasWarnedNoIncrementals; DayOfWeek d = System.Globalization.CultureInfo.CurrentUICulture.DateTimeFormat.FirstDayOfWeek; CheckBox[] chks = new CheckBox[] { Sunday, Monday, Tuesday, Wednesday, Thursday, Friday, Saturday }; Label[] lbls = new Label[] { Day1Label, Day2Label, Day3Label, Day4Label, Day5Label, Day6Label, Day7Label }; int spacing = AllowedDaysPanel.Width / 7; int offset = spacing / 2; for (int i = 0; i < 7; i++) { int index = (((int)d) + i) % 7; chks[index].Left = offset + (spacing * i); lbls[index].Text = System.Globalization.CultureInfo.CurrentUICulture.DateTimeFormat.AbbreviatedDayNames[index]; lbls[index].Left = chks[index].Left + (chks[index].Width / 2) - (lbls[index].Width / 2); } if (!m_valuesAutoLoaded) { OffsetDate.Value = m_wrapper.BackupTimeOffset; OffsetTime.Value = m_wrapper.BackupTimeOffset; ScheduleRadio.Checked = !string.IsNullOrEmpty(m_wrapper.RepeatInterval); if (string.IsNullOrEmpty(m_wrapper.RepeatInterval)) RepeatInterval.Value = "1D"; else RepeatInterval.Value = m_wrapper.RepeatInterval; NoScheduleRadio.Checked = ! ScheduleRadio.Checked; if (m_wrapper.AllowedWeekdays == null || m_wrapper.AllowedWeekdays.Length == 0) { foreach (CheckBox c in chks) c.Checked = true; } else { foreach (CheckBox c in chks) c.Checked = false; foreach (DayOfWeek day in m_wrapper.AllowedWeekdays) chks[(int)day].Checked = true; } if (string.IsNullOrEmpty(m_wrapper.FullBackupInterval)) { NeverFullRadio.Checked = true; FullDuration.Value = "1M"; } else if (m_wrapper.FullBackupInterval.Equals("1s")) //TODO: Is this the best way? { AlwaysFullRadio.Checked = true; FullDuration.Value = "1M"; } else { IncrementalPeriodRadio.Checked = true; FullDuration.Value = m_wrapper.FullBackupInterval; } } m_wrapper.SelectWhenUI.HasWarnedNoSchedule = hasWarnedNoSchedule; m_wrapper.SelectWhenUI.HasWarnedNoIncrementals = hasWarnedNoIncrementals; m_wrapper.SelectWhenUI.HasWarnedTooManyIncremental = HasWarnedTooManyIncremental; }
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; }
void TargetFolder_PageEnter(object sender, PageChangedArgs args) { m_wrapper = new WizardSettingsWrapper(m_settings); if (PartialRestore.Checked) PartialRestore_CheckedChanged(null, null); }
void SettingOverrides_PageEnter(object sender, System.Windows.Forms.Wizard.PageChangedArgs args) { if (!OptionGrid.Unsupported) { m_wrapper = new WizardSettingsWrapper(m_settings); if (!m_settings.ContainsKey("Overrides:Table")) { IList<Library.Interface.ICommandLineArgument> primary = new Library.Main.Options(new Dictionary<string, string>()).SupportedCommands; IList<Library.Interface.ICommandLineArgument> secondary = GetModuleOptions(m_wrapper, this); OptionGrid.Setup(primary, secondary, m_wrapper.Overrides); m_settings["Overrides:Table"] = OptionGrid.DataSet; m_settings["Overrides:DataElementCache"] = OptionGrid.DataElementCache; } else { OptionGrid.DataSet = (DataSet)m_settings["Overrides:Table"]; OptionGrid.DataElementCache = (Dictionary<string, Library.Interface.ICommandLineArgument>)m_settings["Overrides:DataElementCache"]; } } }
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)); }
void PasswordSettings_PageEnter(object sender, PageChangedArgs args) { m_wrapper = new WizardSettingsWrapper(m_settings); bool hasWarnedNoPassword = m_wrapper.PasswordSettingsUI.WarnedNoPassword; if (!m_valuesAutoLoaded) { EnablePassword.Checked = !string.IsNullOrEmpty(m_wrapper.BackupPassword) || (m_wrapper.PrimayAction == WizardSettingsWrapper.MainAction.Add || m_wrapper.PrimayAction == WizardSettingsWrapper.MainAction.RestoreSetup || m_wrapper.PrimayAction == WizardSettingsWrapper.MainAction.Restore); Password.Text = Password.InitialPassword = m_wrapper.BackupPassword; Password.AskToEnterNewPassword = !string.IsNullOrEmpty(m_wrapper.BackupPassword); m_settingsChanged = false; if (Program.DataConnection.GetObjects<Schedule>().Length == 0) UseSettingsAsDefault.Checked = true; } bool tmp = m_settingsChanged; for (int i = 0; i < EncryptionModule.Items.Count; i++) if (((ComboBoxItemPair<Library.Interface.IEncryption>)EncryptionModule.Items[i]).Value.FilenameExtension == m_wrapper.EncryptionModule) { EncryptionModule.SelectedIndex = i; break; } //Force update of UI EncryptionModule_SelectedIndexChanged(EncryptionModule, null); m_settingsChanged = tmp; m_wrapper.PasswordSettingsUI.WarnedNoPassword = hasWarnedNoPassword; if (m_settings.ContainsKey("Password:WarnedChanged")) m_warnedChanged = (bool)m_settings["Password:WarnedChanged"]; if (m_settings.ContainsKey("Password:NewPasswordGenerated")) m_hasGeneratedNewPassword = (bool)m_settings["Password:NewPasswordGenerated"]; if (m_settings.ContainsKey("Password:AskToEnterNewPassword")) Password.AskToEnterNewPassword = (bool)m_settings.ContainsKey("Password:AskToEnterNewPassword"); if (m_settings.ContainsKey("Password:InitialPassword")) Password.InitialPassword = (string)m_settings["Password:InitialPassword"]; if (m_settings.ContainsKey("Password:Password")) Password.Text = (string)m_settings["Password:Password"]; if (m_settings.ContainsKey("Password:SettingsChanged")) m_settingsChanged = (bool)m_settings["Password:SettingsChanged"]; if (m_wrapper.PrimayAction == WizardSettingsWrapper.MainAction.RestoreSetup || m_wrapper.PrimayAction == WizardSettingsWrapper.MainAction.Restore) { PasswordHelptext.Visible = GeneratePasswordButton.Visible = EncryptionModuleLabel.Visible = EncryptionModule.Visible = EncryptionControlContainer.Visible = UseSettingsAsDefault.Visible = false; EnablePassword.Text = Strings.PasswordSettings.EnablePasswordRestoreText; } }
void ThrottleOptions_PageEnter(object sender, System.Windows.Forms.Wizard.PageChangedArgs args) { m_wrapper = new WizardSettingsWrapper(m_settings); if (!m_valuesAutoLoaded) { Bandwidth.UploadLimit = m_wrapper.UploadSpeedLimit; Bandwidth.DownloadLimit = m_wrapper.DownloadSpeedLimit; if (string.IsNullOrEmpty(m_wrapper.BackupSizeLimit) || Library.Utility.Sizeparser.ParseSize(m_wrapper.BackupSizeLimit) == 0) BackupLimitEnabled.Checked = false; else { BackupLimitEnabled.Checked = true; BackupLimit.CurrentSize = m_wrapper.BackupSizeLimit; } VolumeSize.CurrentSize = m_wrapper.VolumeSize; AsyncEnabled.Checked = m_wrapper.AsyncTransfer; ThreadPriorityPicker.SelectedPriority = string.IsNullOrEmpty(m_wrapper.ThreadPriority) ? null : (System.Threading.ThreadPriority?)Library.Utility.Utility.ParsePriority(m_wrapper.ThreadPriority); } }
public static List <Library.Interface.ICommandLineArgument> GetModuleOptions(WizardSettingsWrapper wrapper, Control parent) { List <Library.Interface.ICommandLineArgument> res = new List <Library.Interface.ICommandLineArgument>(); try { res.AddRange(Library.DynamicLoader.BackendLoader.GetSupportedCommands(wrapper.Backend)); } catch (Exception ex) { if (parent != null) { MessageBox.Show(parent, string.Format(Strings.SettingOverrides.BackendLoadError, ex), Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Error); } } try { res.AddRange(Library.DynamicLoader.EncryptionLoader.GetSupportedCommands(wrapper.EncryptionModule)); } catch (Exception ex) { if (parent != null) { MessageBox.Show(parent, string.Format(Strings.SettingOverrides.EncryptionLoadError, ex), Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Error); } } try { res.AddRange(Library.DynamicLoader.CompressionLoader.GetSupportedCommands(wrapper.CompressionModule)); } catch (Exception ex) { if (parent != null) { MessageBox.Show(parent, string.Format(Strings.SettingOverrides.CompressionLoadError, ex), Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Error); } } try { foreach (Library.Interface.IGenericModule m in Library.DynamicLoader.GenericLoader.Modules) { if (m.SupportedCommands != null) { res.AddRange(m.SupportedCommands); } } } catch (Exception ex) { if (parent != null) { MessageBox.Show(parent, string.Format(Strings.SettingOverrides.GenericModuleLoadError, ex), Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Error); } } return(res); }
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; }
void PasswordSettings_PageEnter(object sender, PageChangedArgs args) { m_wrapper = new WizardSettingsWrapper(m_settings); bool hasWarnedNoPassword = m_wrapper.PasswordSettingsUI.WarnedNoPassword; if (!m_valuesAutoLoaded) { EnablePassword.Checked = !string.IsNullOrEmpty(m_wrapper.BackupPassword) || (m_wrapper.PrimayAction == WizardSettingsWrapper.MainAction.Add || m_wrapper.PrimayAction == WizardSettingsWrapper.MainAction.RestoreSetup || m_wrapper.PrimayAction == WizardSettingsWrapper.MainAction.Restore); Password.Text = Password.InitialPassword = m_wrapper.BackupPassword; Password.AskToEnterNewPassword = !string.IsNullOrEmpty(m_wrapper.BackupPassword); m_settingsChanged = false; if (Program.DataConnection.GetObjects <Schedule>().Length == 0) { UseSettingsAsDefault.Checked = true; } } bool tmp = m_settingsChanged; for (int i = 0; i < EncryptionModule.Items.Count; i++) { if (((ComboBoxItemPair <Library.Interface.IEncryption>)EncryptionModule.Items[i]).Value.FilenameExtension == m_wrapper.EncryptionModule) { EncryptionModule.SelectedIndex = i; break; } } //Force update of UI EncryptionModule_SelectedIndexChanged(EncryptionModule, null); m_settingsChanged = tmp; m_wrapper.PasswordSettingsUI.WarnedNoPassword = hasWarnedNoPassword; if (m_settings.ContainsKey("Password:WarnedChanged")) { m_warnedChanged = (bool)m_settings["Password:WarnedChanged"]; } if (m_settings.ContainsKey("Password:NewPasswordGenerated")) { m_hasGeneratedNewPassword = (bool)m_settings["Password:NewPasswordGenerated"]; } if (m_settings.ContainsKey("Password:AskToEnterNewPassword")) { Password.AskToEnterNewPassword = (bool)m_settings.ContainsKey("Password:AskToEnterNewPassword"); } if (m_settings.ContainsKey("Password:InitialPassword")) { Password.InitialPassword = (string)m_settings["Password:InitialPassword"]; } if (m_settings.ContainsKey("Password:Password")) { Password.Text = (string)m_settings["Password:Password"]; } if (m_settings.ContainsKey("Password:SettingsChanged")) { m_settingsChanged = (bool)m_settings["Password:SettingsChanged"]; } if (m_wrapper.PrimayAction == WizardSettingsWrapper.MainAction.RestoreSetup || m_wrapper.PrimayAction == WizardSettingsWrapper.MainAction.Restore) { PasswordHelptext.Visible = GeneratePasswordButton.Visible = EncryptionModuleLabel.Visible = EncryptionModule.Visible = EncryptionControlContainer.Visible = UseSettingsAsDefault.Visible = false; EnablePassword.Text = Strings.PasswordSettings.EnablePasswordRestoreText; } }
void MainPage_PageEnter(object sender, PageChangedArgs args) { m_wrapper = new WizardSettingsWrapper(m_settings); UpdateButtonState(); args.TreatAsLast = false; }
void SelectFiles_PageEnter(object sender, PageChangedArgs args) { m_wrapper = new WizardSettingsWrapper(m_settings); m_owner.Cancelled += new CancelEventHandler(m_owner_Cancelled); if (m_settings.ContainsKey("Files:Sizes")) m_sizes = (Dictionary<string, long>)m_settings["Files:Sizes"]; if (!m_valuesAutoLoaded) { if (m_wrapper.SelectFilesUI.Version < 2) { //Either upgrade or fresh copy if (string.IsNullOrEmpty(m_wrapper.SourcePath)) { //Set defaults DocumentsRadio.Checked = true; IncludeDocuments.Checked = true; IncludeImages.Checked = true; IncludeMusic.Checked = false; IncludeDesktop.Checked = true; IncludeSettings.Checked = false; } else UpgradeFromVersionOne(); } else { //Multifolder version if (m_wrapper.SelectFilesUI.UseSimpleMode) { IncludeDocuments.Checked = m_wrapper.SelectFilesUI.IncludeDocuments; IncludeImages.Checked = m_wrapper.SelectFilesUI.IncludeImages; IncludeMusic.Checked = m_wrapper.SelectFilesUI.IncludeMusic; IncludeDesktop.Checked = m_wrapper.SelectFilesUI.IncludeDesktop; IncludeSettings.Checked = m_wrapper.SelectFilesUI.IncludeSettings; DocumentsRadio.Checked = true; } else { FolderRadio.Checked = true; } } } //Always populate the list InnerControlContainer.Controls.Clear(); if (!string.IsNullOrEmpty(m_wrapper.SourcePath)) foreach (string s in m_wrapper.SourcePath.Split(System.IO.Path.PathSeparator)) if (!string.IsNullOrEmpty(s)) AddFolderControl().SelectedPath = s; Rescan(); //Make sure we resize correctly TargetType_CheckedChanged(null, null); }
void GUIContainer_PageEnter(object sender, PageChangedArgs args) { m_wrapper = new WizardSettingsWrapper(m_settings); m_backendOptions = m_wrapper.BackendSettings; //We inject a marker option here so the backend can make // intelligent testing based on the current action string marker; switch (m_wrapper.PrimayAction) { case WizardSettingsWrapper.MainAction.Add: marker = "add"; break; case WizardSettingsWrapper.MainAction.Edit: marker = "edit"; break; case WizardSettingsWrapper.MainAction.Restore: case WizardSettingsWrapper.MainAction.RestoreSetup: marker = "restore"; break; default: marker = "unknown"; break; } m_backendOptions[ACTION_MARKER] = marker; m_control = m_interface.GetControl(m_wrapper.ApplicationSettings, m_backendOptions); m_control.SetBounds(0, 0, this.Width, this.Height); m_control.Visible = true; this.Controls.Clear(); this.Controls.Add(m_control); }
void SelectWhen_PageEnter(object sender, PageChangedArgs args) { m_wrapper = new WizardSettingsWrapper(m_settings); bool hasWarnedNoSchedule = m_wrapper.SelectWhenUI.HasWarnedNoSchedule; bool HasWarnedTooManyIncremental = m_wrapper.SelectWhenUI.HasWarnedTooManyIncremental; bool hasWarnedNoIncrementals = m_wrapper.SelectWhenUI.HasWarnedNoIncrementals; DayOfWeek d = System.Globalization.CultureInfo.CurrentUICulture.DateTimeFormat.FirstDayOfWeek; CheckBox[] chks = new CheckBox[] { Sunday, Monday, Tuesday, Wednesday, Thursday, Friday, Saturday }; Label[] lbls = new Label[] { Day1Label, Day2Label, Day3Label, Day4Label, Day5Label, Day6Label, Day7Label }; int spacing = AllowedDaysPanel.Width / 7; int offset = spacing / 2; for (int i = 0; i < 7; i++) { int index = (((int)d) + i) % 7; chks[index].Left = offset + (spacing * i); lbls[index].Text = System.Globalization.CultureInfo.CurrentUICulture.DateTimeFormat.AbbreviatedDayNames[index]; lbls[index].Left = chks[index].Left + (chks[index].Width / 2) - (lbls[index].Width / 2); } if (!m_valuesAutoLoaded) { OffsetDate.Value = m_wrapper.BackupTimeOffset; OffsetTime.Value = m_wrapper.BackupTimeOffset; ScheduleRadio.Checked = !string.IsNullOrEmpty(m_wrapper.RepeatInterval); if (string.IsNullOrEmpty(m_wrapper.RepeatInterval)) { RepeatInterval.Value = "1D"; } else { RepeatInterval.Value = m_wrapper.RepeatInterval; } NoScheduleRadio.Checked = !ScheduleRadio.Checked; if (m_wrapper.AllowedWeekdays == null || m_wrapper.AllowedWeekdays.Length == 0) { foreach (CheckBox c in chks) { c.Checked = true; } } else { foreach (CheckBox c in chks) { c.Checked = false; } foreach (DayOfWeek day in m_wrapper.AllowedWeekdays) { chks[(int)day].Checked = true; } } if (string.IsNullOrEmpty(m_wrapper.FullBackupInterval)) { NeverFullRadio.Checked = true; FullDuration.Value = "1M"; } else if (m_wrapper.FullBackupInterval.Equals("1s")) //TODO: Is this the best way? { AlwaysFullRadio.Checked = true; FullDuration.Value = "1M"; } else { IncrementalPeriodRadio.Checked = true; FullDuration.Value = m_wrapper.FullBackupInterval; } } m_wrapper.SelectWhenUI.HasWarnedNoSchedule = hasWarnedNoSchedule; m_wrapper.SelectWhenUI.HasWarnedNoIncrementals = hasWarnedNoIncrementals; m_wrapper.SelectWhenUI.HasWarnedTooManyIncremental = HasWarnedTooManyIncremental; }