private void Handler_RemovePage(object sender, EventArgs eevent) { MultiPaneControl aCtl = DesignedControl; if (aCtl == null) { return; } else if (aCtl.Controls.Count < 1) { return; } var aHost = (IDesignerHost)GetService(typeof(IDesignerHost)); if (aHost == null) { return; } myInTransaction = true; DesignerTransactionUtility.DoInTransaction ( aHost, "MultiPaneControlRemovePage", Transaction_RemovePage, null ); myInTransaction = false; }
private object Transaction_RemovePage(IDesignerHost theHost, object theParam) { if (mySelectedPage == null) { return(null); } MultiPaneControl aCtl = DesignedControl; MemberDescriptor aMember_Controls = TypeDescriptor.GetProperties(aCtl)["Controls"]; RaiseComponentChanging(aMember_Controls); try { theHost.DestroyComponent(mySelectedPage); // NOTE: we don't process anything here because processing will // be performed in Handler_ComponentRemoving } catch { } RaiseComponentChanged(aMember_Controls, null, null); return(null); }
private object Transaction_UpdateSelectedPage(IDesignerHost theHost, object theParam) { MultiPaneControl aCtl = DesignedControl; MultiPanePage aPgTemp = mySelectedPage; int aCurIndex = aCtl.Controls.IndexOf(mySelectedPage); if (mySelectedPage == aCtl.SelectedPage) //we also need to update the SelectedPage property { MemberDescriptor aMember_SelectedPage = TypeDescriptor.GetProperties(aCtl)["SelectedPage"]; RaiseComponentChanging(aMember_SelectedPage); if (aCtl.Controls.Count > 1) { // begin update current page if (aCurIndex == aCtl.Controls.Count - 1) // NOTE: after SelectedPage has { aCtl.SelectedPage = (MultiPanePage)aCtl.Controls[aCurIndex - 1]; } // been updated, mySelectedPage else // has also changed { aCtl.SelectedPage = (MultiPanePage)aCtl.Controls[aCurIndex + 1]; } // end update current page } else { aCtl.SelectedPage = null; } RaiseComponentChanged(aMember_SelectedPage, null, null); } else { if (aCtl.Controls.Count > 1) { if (aCurIndex == aCtl.Controls.Count - 1) { DesignerSelectedPage = (MultiPanePage)aCtl.Controls[aCurIndex - 1]; } else { DesignerSelectedPage = (MultiPanePage)aCtl.Controls[aCurIndex + 1]; } } else { DesignerSelectedPage = null; } } return(null); }
private object Transaction_SetSelectedPageAsConcrete(IDesignerHost theHost, object theParam) { MultiPaneControl aCtl = DesignedControl; MemberDescriptor aMember_SelectedPage = TypeDescriptor.GetProperties(aCtl)["SelectedPage"]; RaiseComponentChanging(aMember_SelectedPage); aCtl.SelectedPage = (MultiPanePage)theParam; RaiseComponentChanged(aMember_SelectedPage, null, null); return(null); }
private object Transaction_AddPage(IDesignerHost theHost, object theParam) { MultiPaneControl aCtl = DesignedControl; var aNewPage = (MultiPanePage)theHost.CreateComponent(typeof(MultiPanePage)); MemberDescriptor aMem_Controls = TypeDescriptor.GetProperties(aCtl)["Controls"]; RaiseComponentChanging(aMem_Controls); aCtl.Controls.Add(aNewPage); DesignerSelectedPage = aNewPage; RaiseComponentChanged(aMem_Controls, null, null); return(null); }
protected override void OnDragOver(DragEventArgs theDragEvents) { MultiPaneControl aCtl = DesignedControl; Point pt = aCtl.PointToClient(new Point(theDragEvents.X, theDragEvents.Y)); if (!aCtl.DisplayRectangle.Contains(pt)) { theDragEvents.Effect = DragDropEffects.None; } else { MultiPanePageDesigner aDsgn_Sel = GetSelectedPageDesigner(); if (aDsgn_Sel != null) { aDsgn_Sel.InternalOnDragOver(theDragEvents); } } }
private void Handler_SelectionChanged(object sender, EventArgs e) { var aSrv = (ISelectionService)GetService(typeof(ISelectionService)); if (aSrv == null) { return; } ICollection aSel = aSrv.GetSelectedComponents(); MultiPaneControl aCtl = DesignedControl; foreach (object aIt in aSel) { MultiPanePage aPage = GetPageOfControl(aIt); if ((aPage != null) && (aPage.Parent == aCtl)) { DesignerSelectedPage = aPage; break; } } }
private void Handler_ComponentRemoving(object theSender, ComponentEventArgs theArgs) { if (!(theArgs.Component is MultiPanePage)) { return; } MultiPaneControl aCtl = DesignedControl; var aPg = (MultiPanePage)theArgs.Component; if (!aCtl.Controls.Contains(aPg)) { return; } var aHost = (IDesignerHost)GetService(typeof(IDesignerHost)); if (!myInTransaction) { myInTransaction = true; DesignerTransactionUtility.DoInTransaction ( aHost, "MultiPaneControlRemoveComponent", Transaction_UpdateSelectedPage, null ); myInTransaction = false; } else { Transaction_UpdateSelectedPage(aHost, null); } CheckVerbStatus(); }