private void handleRemovePage(object sender, EventArgs e) { WizardPage page = this.Control as WizardPage; IDesignerHost h = (IDesignerHost)GetService(typeof(IDesignerHost)); IComponentChangeService c = (IComponentChangeService)GetService(typeof(IComponentChangeService)); DesignerTransaction dt = h.CreateTransaction("Remove Page"); if (page.Parent is Controls.KryptonWizard) { Controls.KryptonWizard wiz = page.Parent as Controls.KryptonWizard; c.OnComponentChanging(wiz, null); //Drop from wizard wiz.Pages.Remove(page); wiz.Controls.Remove(page); c.OnComponentChanged(wiz, null, null, null); h.DestroyComponent(page); } else { c.OnComponentChanging(page, null); //Mark for destruction page.Dispose(); c.OnComponentChanged(page, null, null, null); } dt.Commit(); }
/// <summary> /// Fires the showFromNext event /// </summary> /// <param name="wiz">Sender</param> public void OnShowFromNext(Controls.KryptonWizard wiz) { if (ShowFromNext != null) { ShowFromNext(wiz, EventArgs.Empty); } }
/// <summary> /// Fires the CloseFromNextEvent /// </summary> /// <param name="wiz">Sender</param> public int OnCloseFromNext(Controls.KryptonWizard wiz) { //Event args thinks that the next pgae will be the one before this one PageEventArgs e = new PageEventArgs(wiz.PageIndex + 1, wiz.Pages); //Tell anybody who listens if (CloseFromNext != null) { CloseFromNext(wiz, e); } //And then tell whomever called me what the prefered page is return(e.PageIndex); }
protected override bool GetHitTest(Point point) { Controls.KryptonWizard wiz = this.Control as Controls.KryptonWizard; if (wiz.btnNext.Enabled && wiz.btnNext.ClientRectangle.Contains(wiz.btnNext.PointToClient(point))) { //Next can handle that return(true); } if (wiz.btnBack.Enabled && wiz.btnBack.ClientRectangle.Contains(wiz.btnBack.PointToClient(point))) { //Back can handle that return(true); } //Nope not interested return(false); }
private void handleAddPage(object sender, EventArgs e) { Controls.KryptonWizard wiz = this.Control as Controls.KryptonWizard; IDesignerHost h = (IDesignerHost)GetService(typeof(IDesignerHost)); IComponentChangeService c = (IComponentChangeService)GetService(typeof(IComponentChangeService)); DesignerTransaction dt = h.CreateTransaction("Add Page"); WizardPage page = (WizardPage)h.CreateComponent(typeof(WizardPage)); c.OnComponentChanging(wiz, null); //Add a new page to the collection wiz.Pages.Add(page); wiz.Controls.Add(page); wiz.ActivatePage(page); c.OnComponentChanged(wiz, null, null, null); dt.Commit(); }
/// <summary> /// Constructor requires the wizard that owns this collection /// </summary> /// <param name="parent">Wizard</param> public PageCollection(Controls.KryptonWizard parent) : base() { vParent = parent; }