private DataContext GetDataContextForRefresh(WizardForm wizardForm, IRefreshable defaultRefreshObject)
        {
            WizardPage  wizardPage = wizardForm.WizardPages[wizardForm.WizardPages.Count - 1];
            DataContext context    = wizardPage.Context;

            if (wizardForm.RefreshOnFinish != null)
            {
                context.RefreshOnSave = wizardForm.RefreshOnFinish;
            }
            else
            {
                context.RefreshOnSave = (context.RefreshOnSave ?? defaultRefreshObject);
            }
            return(context);
        }
        void IExchangeFormOwner.OnExchangeFormClosed(ExchangeForm formToClose)
        {
            WizardForm wizardForm = formToClose as WizardForm;

            if (wizardForm != null && wizardForm.WizardPages.Count > 0 && this.ListControl != null)
            {
                WizardPage wizardPage = wizardForm.WizardPages[wizardForm.WizardPages.Count - 1];
                if (wizardPage != null && wizardPage.Context != null && wizardPage.Context.DataHandler != null && wizardPage.Context.DataHandler.SavedResults != null && wizardPage.Context.DataHandler.SavedResults.Count == 1)
                {
                    this.ListControl.SelectItemBySpecifiedIdentity(this.GetIdentityFromObject(wizardPage.Context.DataHandler.SavedResults[0]), false);
                }
            }
            if (formToClose != null)
            {
                this.childrenFormsList.Remove(formToClose);
            }
        }
        private WizardForm InternalCreateWizardForm()
        {
            WizardForm   wizardForm           = this.CreateWizardForm();
            IRefreshable defaultRefreshObject = base.GetDefaultRefreshObject();

            wizardForm.OriginatingCommand = base.Command;
            wizardForm.FormClosed        += delegate(object param0, FormClosedEventArgs param1)
            {
                if (wizardForm.Wizard.IsDataChanged)
                {
                    this.RefreshResultsThreadSafely(this.GetDataContextForRefresh(wizardForm, defaultRefreshObject));
                }
            };
            wizardForm.Load += delegate(object param0, EventArgs param1)
            {
                string text = this.CheckPreCondition((wizardForm.Context != null) ? wizardForm.Context.DataHandler.DataSource : null);
                if (!string.IsNullOrEmpty(text))
                {
                    wizardForm.Close();
                    this.ResultPane.ShowError(text);
                }
            };
            return(wizardForm);
        }
        protected override void OnSetActive(EventArgs e)
        {
            base.ElapsedTimeText = string.Empty;
            string text = base.ShortDescription.Trim();

            if (string.IsNullOrEmpty(text))
            {
                if (base.Wizard != null && base.Wizard.ParentForm is WizardForm)
                {
                    string action = ExchangeUserControl.RemoveAccelerator(base.NextButtonText);
                    text = Strings.WizardWillUseConfigurationBelow(action);
                }
                else
                {
                    text = base.DataHandler.InProgressDescription.Trim();
                }
                base.ShortDescription = text;
            }
            base.WorkUnitsPanel.TaskState = 0;
            this.scenario = this.GetPageScenario();
            if (base.CheckReadOnlyAndDisablePage())
            {
                base.CanGoForward           = false;
                this.allowTaskToRun         = false;
                base.CanCancel              = true;
                base.InformationDescription = string.Empty;
                base.Status = string.Empty;
                if (base.Context != null)
                {
                    base.ShortDescription = Strings.WizardCannotEditObject(base.DataHandler.ObjectReadOnlyReason);
                }
                base.WorkUnitsPanel.Visible = false;
            }
            else if (base.DataHandler != null && this.NeedToRunTask)
            {
                CollapsiblePanel.Animate = false;
                base.WorkUnitsPanel.SuspendLayout();
                base.DataHandler.WorkUnits.RaiseListChangedEvents = false;
                try
                {
                    base.DataHandler.UpdateWorkUnits();
                    WizardForm wizardForm = (WizardForm)base.FindForm();
                    if (wizardForm != null && wizardForm.Icon != null)
                    {
                        foreach (WorkUnit workUnit in base.WorkUnits)
                        {
                            if (workUnit.Icon == null)
                            {
                                workUnit.Icon = wizardForm.Icon;
                            }
                            workUnit.Status = WorkUnitStatus.NotStarted;
                        }
                    }
                }
                finally
                {
                    base.Status = base.DataHandler.WorkUnits.Description;
                    base.WorkUnitsPanel.ResumeLayout(false);
                    base.DataHandler.WorkUnits.RaiseListChangedEvents = true;
                    base.DataHandler.WorkUnits.ResetBindings();
                    CollapsiblePanel.Animate = true;
                }
            }
            base.OnSetActive(e);
            if ((this.RunTaskOnSetActive || this.scenario.RunTaskOnSetActive) && this.NeedToRunTask)
            {
                this.StartTheTask();
            }
        }
 private void ShowWizardForm(WizardForm wizardForm)
 {
     wizardForm.ShowModeless(base.ResultPane);
 }
 private void ShowWizardForm(WizardForm wizardForm, string formName)
 {
     wizardForm.Name = formName;
     this.ShowWizardForm(wizardForm);
 }