Beispiel #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;
            }
        }
 /// <summary>
 /// Gets a source folder setup, based on the users filter selection
 /// </summary>
 /// <param name="wrapper">The wrapper instance with the user selection</param>
 /// <param name="filters">The filter settings</param>
 /// <returns>The source folder string</returns>
 public static string[] GetSourceFolders(Wizard_pages.WizardSettingsWrapper wrapper, ApplicationSettings settings, List <KeyValuePair <bool, string> > filters)
 {
     if (wrapper.SelectFilesUI.Version >= 2 && wrapper.SelectFilesUI.UseSimpleMode)
     {
         return(GetSourceFolders(
                    wrapper.SelectFilesUI.IncludeDocuments,
                    wrapper.SelectFilesUI.IncludeMusic,
                    wrapper.SelectFilesUI.IncludeImages,
                    wrapper.SelectFilesUI.IncludeDesktop,
                    wrapper.SelectFilesUI.IncludeSettings,
                    settings,
                    filters));
     }
     else
     {
         return(PrependFilterList(wrapper.SourcePath.Split(System.IO.Path.PathSeparator), settings, filters));
     }
 }
Beispiel #3
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, Duplicati.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 #4
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 #5
0
        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);
        }
Beispiel #6
0
 void MainPage_PageEnter(object sender, PageChangedArgs args)
 {
     m_wrapper = new WizardSettingsWrapper(m_settings);
     UpdateButtonState();
     args.TreatAsLast = false;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="PasswordSettingsUI"/> class.
 /// </summary>
 /// <param name="parent">The parent.</param>
 public PasswordSettingsUI(WizardSettingsWrapper parent)
 {
     m_parent = parent;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="CleanupSettingsUI"/> class.
 /// </summary>
 /// <param name="parent">The parent.</param>
 public CleanupSettingsUI(WizardSettingsWrapper parent)
 {
     m_parent = parent;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="SelectWhenUI"/> class.
 /// </summary>
 /// <param name="parent">The parent.</param>
 public SelectWhenUI(WizardSettingsWrapper parent)
 {
     m_parent = parent;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="SelectFilesUI"/> class.
 /// </summary>
 /// <param name="parent">The parent.</param>
 public SelectFilesUI(WizardSettingsWrapper parent)
 {
     m_parent = parent;
 }