/// <summary> /// Show the Next Step /// </summary> internal void Next() { IWizardForm now = prevsteps.Tail(); if (now == null) { return; } if (now.GetType().GetInterface("IWizardFinish", false) == typeof(IWizardFinish)) { IWizardFinish wf = (IWizardFinish)now; wf.Finit(); prevsteps = new Stack(); prevsteps.Push(step1); ShowStep(step1, true); } else { now.WizardWindow.Visible = false; now = now.Next; if (now == null) { return; } prevsteps.Push(now); ShowStep(now, true); } }
public WizardHandler(IWizardControl[] pages) { m_form = new Dialog(); m_form.Title = Strings.WizardHandler.WizardFormTitle; #if DEBUG m_form.Title += " (DEBUG)"; #endif m_form.Pages.Clear(); if (pages == null || pages.Length == 0) { long count = 0; lock (Program.MainLock) count = Program.DataConnection.GetObjects<Schedule>().Length; if (count == 0) m_form.Pages.AddRange(new IWizardControl[] { new Wizard_pages.FirstLaunch() }); else m_form.Pages.AddRange(new IWizardControl[] { new Wizard_pages.MainPage() }); } else m_form.Pages.AddRange(pages); m_form.DefaultImage = Properties.Resources.Duplicati; m_form.Dialog.Icon = Properties.Resources.TrayNormal; m_form.Finished += new System.ComponentModel.CancelEventHandler(m_form_Finished); }
public WizardHandler(IWizardControl[] pages) { m_form = new Dialog(); m_form.Title = "HMB v" + System.Reflection.Assembly.GetEntryAssembly().GetName().Version.ToString() + " - Setup Wizard";//Strings.WizardHandler.WizardFormTitle; #if DEBUG m_form.Title += " (DEBUG)"; #endif m_form.Pages.Clear(); if (pages == null || pages.Length == 0) { long count = 0; lock (Program.MainLock) count = Program.DataConnection.GetObjects <Schedule>().Length; if (count == 0) { m_form.Pages.AddRange(new IWizardControl[] { new Wizard_pages.FirstLaunch() }); } else { m_form.Pages.AddRange(new IWizardControl[] { new Wizard_pages.MainPage() }); } } else { m_form.Pages.AddRange(pages); } m_form.DefaultImage = Properties.Resources.HMB; m_form.Dialog.Icon = Properties.Resources.TrayNormal; m_form.Finished += new System.ComponentModel.CancelEventHandler(m_form_Finished); }
private void StartWizard(object sender, LinkLabelLinkClickedEventArgs e) { LinkLabel ll = (LinkLabel)sender; wizard = (IWizardForm)ll.Tag; Form1.form1.Next(); }
/// <summary> /// Called upon changes in a Step Form /// </summary> /// <param name="sender">the current Wizard Step</param> /// <param name="autonext">true if the page wanted to go to the next Wizard Step NOW</param> void ContentChanged(IWizardForm sender, bool autonext) { llnext.Enabled = sender.CanContinue; if (autonext) { this.Next(); } }
/// <summary> /// Remove the last Stack Item /// </summary> /// <returns>The Removed item</returns> /// <remarks>Returns null if the stack was empty</remarks> public IWizardForm Pop() { if (!IsEmpty) { IWizardForm wf = Tail(); stack.Remove(wf); return(wf); } return(null); }
/// <summary> /// Display a new Step /// </summary> /// <param name="step">The Step you want to Show</param> void ShowStep(IWizardForm step, bool init) { Panel pn = step.WizardWindow; //this.Height = pn.Height + 320; pn.Visible = false; pn.Parent = this.pndrop; pn.Dock = DockStyle.None; pn.Anchor = ((System.Windows.Forms.AnchorStyles)(AnchorStyles.Left | AnchorStyles.Top | AnchorStyles.Right | AnchorStyles.Bottom)); pn.BackColor = Color.White; pn.Left = 16; pn.Top = 0; pn.Width = pndrop.Width - 2 * pn.Left; pn.Height = pndrop.Height - (pn.Top + llnext.Height); lbmsg.Text = step.WizardMessage; lbstep.Text = step.WizardStep.ToString(); //lbmsg.Left = lbstep.Left - lbmsg.Width; lbmsg.Width = lbstep.Left - lbmsg.Left + 2; llback.Enabled = (prevsteps.Count > 1); if (step.GetType().GetInterface("IWizardFinish", false) == typeof(IWizardFinish)) { llnext.Text = "Finish"; llnext.Enabled = true; } else { llnext.Text = "Next >"; llnext.Enabled = (step.Next != null); } llnext.Enabled = llnext.Enabled & step.CanContinue; llopt.Visible = (prevsteps.Count <= 1); bool show = true; if (init) { show = step.Init(new ChangedContent(this.ContentChanged)); } pn.Visible = show; lbmsg.SendToBack(); lbstep.SendToBack(); pbtop.SendToBack(); pbstretch.SendToBack(); }
/// <summary> /// Show the Prev Step /// </summary> internal void Prev() { IWizardForm now = prevsteps.Pop(); if (now == null) { return; } now.WizardWindow.Visible = false; now = prevsteps.Tail(); if (now == null) { return; } ShowStep(now, false); }
/// <summary> /// Determines if the project item should be added. /// </summary> /// <remarks> /// This is called once per file in the item template (i.e. twice). The flag /// indicating the first call is reset after the item file name has been captured. /// </remarks> /// <param name="filePath">The file to be added.</param> /// <returns>True if the file can be added, false otherwise.</returns> public bool ShouldAddProjectItem(string filePath) { bool ans; if (this.firstCall) { WizardData wizardData = null; try { using (IWizardForm wizard = this.formFactory()) { wizard.WizardCompleting += new EventHandler <CancellableWizardEventArgs>(this.WizardCompletingHandler); ans = wizard.RunWizard(); wizardData = wizard.WizardData; } } catch (Exception ex) { this.errorDisplay(ex.Message); throw; } finally { // Handle cancellation if (wizardData != null && !string.IsNullOrEmpty(wizardData.TraceFile) && wizardData.TraceFileSource == TraceFileSource.Dynamic) { File.Delete(wizardData.TraceFile); } } } else { ans = true; } if (!ans) { throw new WizardCancelledException(); } return(ans); }
void InitTemplateUI(object[] customParams) { selectedTemplate = IdentifyTemplateType(customParams); // Display a form to the user to gather their project requirements if (selectedTemplate.VSTemplateFileName == "AuMVCTSWP.vstemplate") { inputForm = new AuVSTemplateForm(); inputForm.SelectedTemplateItem = selectedTemplate; inputForm.BindForm(); ((Form)inputForm).ShowDialog(); } if (selectedTemplate.VSTemplateFileName == "AuMVCBLWP.vstemplate") { inputForm = new AuVSTemplateForm(); inputForm.SelectedTemplateItem = selectedTemplate; inputForm.BindForm(); ((Form)inputForm).ShowDialog(); } }
void IWizardControl.Leave(IWizardForm owner, PageChangedArgs args) { }
void IWizardControl.Enter(IWizardForm owner, PageChangedArgs args) { }
void IWizardControl.Display(IWizardForm owner, PageChangedArgs args) { }
void IWizardControl.Enter(IWizardForm owner, PageChangedArgs args) { m_owner = args.Owner; m_settings = args.Settings; if (m_autoFillValues) m_valuesAutoLoaded = LoadDialogSettings(); if (PageEnter != null) PageEnter(owner, args); }
void IWizardControl.Leave(IWizardForm owner, PageChangedArgs args) { if (PageLeave != null) PageLeave(owner, args); if (m_autoFillValues) SaveDialogSettings(); }
/// <summary> /// Add a new Object to the Stack /// </summary> /// <param name="obj">The Object you yant to put on the Stack</param> public void Push(IWizardForm obj) { stack.Add(obj); }
void IWizardControl.Display(IWizardForm owner, PageChangedArgs args) { if (PageDisplay != null) PageDisplay(owner, args); }
public PageChangedArgs(IWizardForm owner, bool treatAsLast, PageChangedDirection direction) : base() { this.Owner = owner; this.Settings = owner.Settings; this.Direction = direction; this.TreatAsLast = treatAsLast; }