Example #1
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 #2
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();
            }
        }
Example #3
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;
            }
        }