/// <summary>
        /// Clears all settings, and makes the setting object reflect the schedule
        /// </summary>
        /// <param name="schedule">The schedule to reflect</param>
        public void ReflectSchedule(Datamodel.Schedule schedule)
        {
            MainAction action = this.PrimayAction;

            System.Data.LightDatamodel.IDataFetcherWithRelations connection = this.DataConnection;
            m_settings.Clear();

            this.ScheduleID       = schedule.ID;
            this.ScheduleName     = schedule.Name;
            this.SchedulePath     = schedule.Path;
            this.SourcePath       = schedule.Task.SourcePath;
            this.EncodedFilterXml = schedule.Task.FilterXml;
            this.BackupPassword   = schedule.Task.Encryptionkey;

            this.Backend         = schedule.Task.Service;
            this.BackendSettings = new Dictionary <string, string>(schedule.Task.BackendSettingsLookup);

            this.BackupTimeOffset             = schedule.When;
            this.RepeatInterval               = schedule.Repeat;
            this.AllowedWeekdays              = schedule.AllowedWeekdays;
            this.FullBackupInterval           = schedule.Task.FullAfter;
            this.MaxFullBackups               = (int)schedule.Task.KeepFull;
            this.BackupExpireInterval         = schedule.Task.KeepTime;
            this.UploadSpeedLimit             = schedule.Task.Extensions.UploadBandwidth;
            this.DownloadSpeedLimit           = schedule.Task.Extensions.DownloadBandwidth;
            this.BackupSizeLimit              = schedule.Task.Extensions.MaxUploadSize;
            this.VolumeSize                   = schedule.Task.Extensions.VolumeSize;
            this.ThreadPriority               = schedule.Task.Extensions.ThreadPriority;
            this.AsyncTransfer                = schedule.Task.Extensions.AsyncTransfer;
            this.EncryptionModule             = schedule.Task.EncryptionModule;
            this.IncludeSetup                 = schedule.Task.IncludeSetup;
            this.IgnoreFileTimestamps         = schedule.Task.Extensions.IgnoreTimestamps;
            this.FileSizeLimit                = schedule.Task.Extensions.FileSizeLimit;
            this.DisableAESFallbackEncryption = schedule.Task.Extensions.DisableAESFallbackDecryption;

            //Handle the "Select Files" portion
            this.SelectFilesUI.Version          = schedule.Task.Extensions.SelectFiles_Version;
            this.SelectFilesUI.UseSimpleMode    = schedule.Task.Extensions.SelectFiles_UseSimpleMode;
            this.SelectFilesUI.IncludeDocuments = schedule.Task.Extensions.SelectFiles_IncludeDocuments;
            this.SelectFilesUI.IncludeDesktop   = schedule.Task.Extensions.SelectFiles_IncludeDesktop;
            this.SelectFilesUI.IncludeMusic     = schedule.Task.Extensions.SelectFiles_IncludeMusic;
            this.SelectFilesUI.IncludeImages    = schedule.Task.Extensions.SelectFiles_IncludeImages;
            this.SelectFilesUI.IncludeSettings  = schedule.Task.Extensions.SelectFiles_IncludeAppData;

            this.SelectWhenUI.HasWarnedNoSchedule         = schedule.Task.Extensions.SelectWhen_WarnedNoSchedule;
            this.SelectWhenUI.HasWarnedTooManyIncremental = schedule.Task.Extensions.SelectWhen_WarnedTooManyIncrementals;
            this.SelectWhenUI.HasWarnedNoIncrementals     = schedule.Task.Extensions.SelectWhen_WarnedNoIncrementals;

            this.PasswordSettingsUI.WarnedNoPassword = schedule.Task.Extensions.PasswordSettings_WarnedNoPassword;

            this.CleanupSettingsUI.HasWarnedClean = schedule.Task.Extensions.CleanupSettings_WarnedNoCleanup;

            this.Overrides           = new Dictionary <string, string>(schedule.Task.TaskOverridesLookup);
            this.EncryptionSettings  = new Dictionary <string, string>(schedule.Task.EncryptionSettingsLookup);
            this.CompressionSettings = new Dictionary <string, string>(schedule.Task.CompressionSettingsLookup);
            this.ApplicationSettings = ApplicationSetup.GetApplicationSettings(schedule.DataParent);

            this.PrimayAction   = action;
            this.DataConnection = connection;
        }
        /// <summary>
        /// Writes all values from the session object back into a schedule object
        /// </summary>
        /// <param name="schedule"></param>
        public void UpdateSchedule(Datamodel.Schedule schedule)
        {
            schedule.Name = this.ScheduleName;
            schedule.Path = this.SchedulePath;
            if (schedule.Task == null)
            {
                schedule.Task = schedule.DataParent.Add <Datamodel.Task>();
            }
            schedule.Task.SourcePath    = this.SourcePath;
            schedule.Task.FilterXml     = this.EncodedFilterXml;
            schedule.Task.Encryptionkey = this.BackupPassword;

            schedule.Task.Service = this.Backend;
            SyncLookupTables(this.BackendSettings, schedule.Task.BackendSettingsLookup);

            schedule.When            = this.BackupTimeOffset;
            schedule.Repeat          = this.RepeatInterval;
            schedule.AllowedWeekdays = this.AllowedWeekdays;
            schedule.Task.FullAfter  = this.FullBackupInterval;
            schedule.Task.KeepFull   = this.MaxFullBackups;

            schedule.Task.KeepTime = this.BackupExpireInterval;
            schedule.Task.Extensions.UploadBandwidth   = this.UploadSpeedLimit;
            schedule.Task.Extensions.DownloadBandwidth = this.DownloadSpeedLimit;
            schedule.Task.Extensions.MaxUploadSize     = this.BackupSizeLimit;

            schedule.Task.Extensions.VolumeSize     = this.VolumeSize;
            schedule.Task.Extensions.ThreadPriority = this.ThreadPriority;
            schedule.Task.Extensions.AsyncTransfer  = this.AsyncTransfer;

            schedule.Task.EncryptionModule                        = this.EncryptionModule;
            schedule.Task.IncludeSetup                            = this.IncludeSetup;
            schedule.Task.Extensions.IgnoreTimestamps             = this.IgnoreFileTimestamps;
            schedule.Task.Extensions.FileSizeLimit                = this.FileSizeLimit;
            schedule.Task.Extensions.DisableAESFallbackDecryption = this.DisableAESFallbackEncryption;

            schedule.Task.Extensions.SelectFiles_Version          = this.SelectFilesUI.Version;
            schedule.Task.Extensions.SelectFiles_UseSimpleMode    = this.SelectFilesUI.UseSimpleMode;
            schedule.Task.Extensions.SelectFiles_IncludeDocuments = this.SelectFilesUI.IncludeDocuments;
            schedule.Task.Extensions.SelectFiles_IncludeDesktop   = this.SelectFilesUI.IncludeDesktop;
            schedule.Task.Extensions.SelectFiles_IncludeMusic     = this.SelectFilesUI.IncludeMusic;
            schedule.Task.Extensions.SelectFiles_IncludeImages    = this.SelectFilesUI.IncludeImages;
            schedule.Task.Extensions.SelectFiles_IncludeAppData   = this.SelectFilesUI.IncludeSettings;

            schedule.Task.Extensions.SelectWhen_WarnedNoSchedule          = this.SelectWhenUI.HasWarnedNoSchedule;
            schedule.Task.Extensions.SelectWhen_WarnedTooManyIncrementals = this.SelectWhenUI.HasWarnedTooManyIncremental;
            schedule.Task.Extensions.SelectWhen_WarnedNoIncrementals      = this.SelectWhenUI.HasWarnedNoIncrementals;

            schedule.Task.Extensions.PasswordSettings_WarnedNoPassword = this.PasswordSettingsUI.WarnedNoPassword;

            schedule.Task.Extensions.CleanupSettings_WarnedNoCleanup = this.CleanupSettingsUI.HasWarnedClean;

            SyncLookupTables(this.Overrides, schedule.Task.TaskOverridesLookup);

            SyncLookupTables(this.EncryptionSettings, schedule.Task.EncryptionSettingsLookup);
            SyncLookupTables(this.CompressionSettings, schedule.Task.CompressionSettingsLookup);

            ApplicationSetup.SaveExtensionSettings(schedule.DataParent, this.ApplicationSettings);
        }
Example #3
0
        public void Setup(Schedule schedule)
        {
            m_schedule            = schedule;
            WaitPanel.Visible     = true;
            WaitPanel.Dock        = DockStyle.None;
            statusLabel.TextAlign = ContentAlignment.MiddleCenter;
            progressBar.Visible   = true;
            listView.Visible      = false;

            backgroundWorker.RunWorkerAsync(schedule);
        }
Example #4
0
        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;
            }
        }
Example #5
0
        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;
            }
        }
Example #6
0
        public void Setup(Schedule schedule)
        {
            m_schedule = schedule;
            WaitPanel.Visible = true;
            WaitPanel.Dock = DockStyle.None;
            statusLabel.TextAlign = ContentAlignment.MiddleCenter;
            progressBar.Visible = true;
            listView.Visible = false;

            backgroundWorker.RunWorkerAsync(schedule);
        }
Example #7
0
 public void ShowList(Control owner, Datamodel.Schedule schedule, DateTime when)
 {
     backgroundWorker1.RunWorkerAsync(new object[] { schedule, when });
     this.ShowDialog(owner);
 }