private void handleRemovePage(object sender, EventArgs e) { MultiPanelPage page = this.Control as MultiPanelPage; IDesignerHost h = (IDesignerHost)GetService(typeof(IDesignerHost)); IComponentChangeService c = (IComponentChangeService)GetService(typeof(IComponentChangeService)); DesignerTransaction dt = h.CreateTransaction("Remove Page"); if (page.Parent is MultiPanel) { MultiPanel wiz = page.Parent as MultiPanel; c.OnComponentChanging(wiz, null); //Drop from MultiPanel 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(); }
private void handlePrevPage(object sender, EventArgs e) { MultiPanelPage page = this.Control as MultiPanelPage; if (page.Parent is MultiPanel) { MultiPanel wiz = page.Parent as MultiPanel; wiz.PageIndex--; } }
private void handleAddPage(object sender, EventArgs e) { MultiPanel wiz = this.Control as MultiPanel; IDesignerHost h = (IDesignerHost)GetService(typeof(IDesignerHost)); IComponentChangeService c = (IComponentChangeService)GetService(typeof(IComponentChangeService)); DesignerTransaction dt = h.CreateTransaction("Add Page"); MultiPanelPage page = (MultiPanelPage)h.CreateComponent(typeof(MultiPanelPage)); 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 MultiPanel that owns this collection /// </summary> /// <param name="parent">MultiPanel</param> public PageCollection(MultiPanel parent) : base() { vParent = parent; }