public SyncPresenter(Models.Synchronization sync) { IsEditingModel = true; Model = sync; WizardFormOptions options = new WizardFormOptions { DoValidate = true }; RegisterFormClass(typeof(SyncSelectAccountForm), options); RegisterFormClass(typeof(SyncProgressForm), options); //RegisterFormClass(typeof(SyncFinishedForm), options); }
public NewBackupPlanPresenter(Models.BackupPlan plan) { IsEditingModel = true; Model = plan; WizardFormOptions options = new WizardFormOptions { DoValidate = true }; RegisterFormClass(typeof(BackupPlanSelectAccountForm), options); RegisterFormClass(typeof(BackupPlanGiveNameForm), options); RegisterFormClass(typeof(BackupPlanSelectSourceForm), options); RegisterFormClass(typeof(SchedulablePlanForm <Models.BackupPlan>), options); RegisterFormClass(typeof(BackupPlanPurgeOptionsForm), options); RegisterFormClass(typeof(NotificationOptionsForm <Models.BackupPlan>), options); RegisterFormClass(typeof(ExecuteCommandsForm), options); }
public NewRestorePlanPresenter(Models.RestorePlan plan) { IsEditingModel = true; Model = plan; WizardFormOptions options = new WizardFormOptions { DoValidate = true }; // Only show `RestorePlanSelectAccountForm` if the `StorageAccount` is not already informed. if (plan.StorageAccount == null || !plan.StorageAccount.Id.HasValue) { RegisterFormClass(typeof(RestorePlanSelectAccountForm), options); } RegisterFormClass(typeof(RestorePlanGiveNameForm), options); RegisterFormClass(typeof(RestorePlanSelectSourceForm), options); RegisterFormClass(typeof(SchedulablePlanForm <Models.RestorePlan>), options); RegisterFormClass(typeof(NotificationOptionsForm <Models.RestorePlan>), options); }
protected virtual WizardForm InstantiateForm(int index, Form owner) { // Instantiate it. WizardFormOptions options = _RegisteredForms.ElementAt(index); object instance = Activator.CreateInstance(options.Type); WizardForm form = (WizardForm)instance; form.Owner = owner; form.IsLastForm = index == _RegisteredForms.Count - 1; form.FinishEnabled = form.IsLastForm; form.NextEnabled = !form.IsLastForm; form.PreviousEnabled = index > 0; form.FormClosedEvent += form_FormClosedEvent; form.CancelEvent += form_CancelEvent; form.FinishEvent += form_FinishEvent; form.PreviousEvent += form_PreviousEvent; form.NextEvent += form_NextEvent; form.Model = Model; form.DoValidate = options.DoValidate; return(form); }
public virtual void RegisterFormClass(Type wizardFormType, WizardFormOptions options = null) { bool isCompatible = typeof(WizardForm).IsAssignableFrom(wizardFormType); if (!isCompatible) { var message = String.Format("Type must be compatible with {0}", typeof(WizardForm).FullName); throw new ArgumentException(message, "wizardFormType"); } if (options != null) { _RegisteredForms.Add(new WizardFormOptions { Type = wizardFormType, DoValidate = options.DoValidate }); } else { _RegisteredForms.Add(new WizardFormOptions { Type = wizardFormType }); } }