/// <summary> /// Adds a new tab to the tab panel, associated with given <paramref name="diagram"/> /// <param name="diagram">Diagram to which the new tab should be bound</param> /// </summary> internal DiagramTab AddTab(Diagram diagram) { DiagramTab newTab = null; if (diagram is PIMDiagram) { newTab = new PIMDiagramTab(); } else if (diagram is PSMDiagram) { newTab = new PSMDiagramTab(); } if (newTab != null) { newTab.BindTab(diagram); newTab.DiagramView.SuspendBindingInChildren = true; newTab.DiagramView.LoadDiagram(diagram); newTab.DiagramView.SelectionChanged += SelectedItems_CollectionChanged; newTab.Name = "D" + diagram.ID.ToString().Replace("-", "_"); ActivePane.Items.Add(newTab); ActivePane.UpdateLayout(); //ActivePane.BringHeaderToFront(newTab); if (newTab.ContainerPane != null) { DockManager.ActiveDocument = newTab; } newTab.DiagramView.SuspendBindingInChildren = false; } return(newTab); }
/// <inheritdoc /> protected override IEnumerable <ActivePane> FilterAndSort(IEnumerable <ActivePane> panes, ActivePane activePane) { return(from pane in panes orderby pane.Bounds.left, pane.Bounds.top select pane); }
/// <summary> /// Adds a new tab to the tab panel, associated with given <paramref name="diagram"/> /// <param name="diagram">Diagram to which the new tab should be bound</param> /// </summary> internal PanelWindow AddTab(Diagram diagram) { PanelWindow newTab = new PanelWindow(); if (diagram is PIMDiagram) { newTab.xCaseDrawComponent.Canvas.InitializeRegistrationSet(MainWindow.PIMRepresentantsSet); } if (diagram is PSMDiagram) { newTab.xCaseDrawComponent.Canvas.InitializeRegistrationSet(MainWindow.PSMRepresentantsSet); } newTab.BindToDiagram(diagram, diagram.Project.GetModelController()); newTab.xCaseDrawComponent.Canvas.SelectedItems.CollectionChanged += SelectedItems_CollectionChanged; ActivePane.Items.Add(newTab); ActivePane.UpdateLayout(); ActivePane.BringHeaderToFront(newTab); dockManager.ActiveDocument = newTab; #if DEBUG newTab.BindToLogWIndow(MainWindow.logWindow); #endif return(newTab); }
/// <inheritdoc /> protected override IEnumerable <ActivePane> FilterAndSort(IEnumerable <ActivePane> panes, ActivePane activePane) { return(from pane in panes // we always need the active window in the list where pane == activePane // only return those that aren't aligned vertically || pane.Bounds.left != activePane.Bounds.left orderby pane.Bounds.left, pane.Bounds.top select pane); }
public void GetSelectedRenderings([NotNull] Action <IEnumerable <RenderingItem> > completed) { Assert.ArgumentNotNull(completed, nameof(completed)); if (ActivePane == null) { completed(Enumerable.Empty <RenderingItem>()); return; } ActivePane.GetSelectedRenderings(completed); }
/// <summary> Looks up a pane by comparing the window of the pane to a given value. </summary> private static ActivePane LookupPaneByWindow(Window windowToSearchFor, List <ActivePane> activePanes) { ActivePane activePane = null; foreach (var pane in activePanes) { if (pane.Window == windowToSearchFor) { activePane = pane; break; } } return(activePane); }
/// <summary> /// 渲染 HTML 之前调用(AJAX回发) /// </summary> protected override void OnAjaxPreRender() { base.OnAjaxPreRender(); StringBuilder sb = new StringBuilder(); if (PropertyModified("ActivePaneIndex")) { if (ActivePane != null) { ActivePane.AddAjaxScript(String.Format("{0}.expand();", ActivePane.XID)); } } AddAjaxScript(sb); }
private void SetActivePane() { DockPane value = GetPaneFromHandle(NativeMethods.GetFocus()); if (ActivePane == value) { return; } if (ActivePane != null) { ActivePane.SetIsActivated(false); } ActivePane = value; if (ActivePane != null) { ActivePane.SetIsActivated(true); } }
/// <summary> /// Activates a diagram /// </summary> /// <param name="diagram">Diagram to be activated</param> public PanelWindow ActivateDiagram(Diagram diagram) { PanelWindow Tab = FindTab(diagram); if (Tab == null) { if (diagram is PSMDiagram) { View.TreeLayout.SwitchOff(); } Tab = AddTab(diagram); MainWindow.propertiesWindow.BindDiagram(ref MainWindow.dockManager); } else { dockManager.ActiveDocument = Tab; Tab.xCaseDrawComponent.Canvas.SelectedItems.CollectionChanged += SelectedItems_CollectionChanged; } ActivePane.BringHeaderToFront(Tab); return(Tab); }
/// <summary> /// How the document-windows should ordered. They should be ordered such that when /// <see cref="ShouldMoveForward"/> returns true the Nth + 1 element is the logical group to jump /// to. For example, if you sort the groups vertically (smallest first), then ShouldMoveFoward() /// should return true when moving down. /// </summary> /// <seealso cref="ShouldMoveForward"/> protected abstract IEnumerable <ActivePane> FilterAndSort(IEnumerable <ActivePane> panes, ActivePane activePane);
} //internal name of the shop public override void Update(GameTime gameTime) { base.Update(gameTime); var drawVector = new Point(TopLeft.X, TopLeft.Y); var buyPaneButton = new Rectangle(TopLeft.X + 16, TopLeft.Y + 104, 142, 38); if (game.Input.HasMouseClickedOnRectangle(buyPaneButton)) { activePane = ActivePane.BuyPane; activeItems = purchaseableItems.ToList <Item>(); itemValueDisplay = buyValue; for (int i = 0; i < activeItems.Count; i++) { if (activeItems[i] == null) { activeItems.RemoveAt(i); i--; } } } var sellPaneButton = new Rectangle(TopLeft.X + 164, TopLeft.Y + 104, 142, 38); if (game.Input.HasMouseClickedOnRectangle(sellPaneButton)) { activePane = ActivePane.SellPane; activeItems = activeCharacter.Inventory; itemValueDisplay = sellValue; if (game.gameFlags.ContainsKey("bShopBonus")) { if (game.gameFlags["bShopBonus"]) { itemValueDisplay += 0.2f; } } } drawVector = new Point(TopLeft.X + 32, TopLeft.Y + 29); for (int i = 0; i < CharacterButtons.Length; i++) { var chara = playerParty.GetPlayerCharacter(playerParty.ActiveCharacters[i]); if (game.Input.HasMouseClickedOnRectangle(CharacterButtons[i].Bounds)) { activeCharacterIndex = i; activeCharacter = chara; if (activePane == ActivePane.SellPane) { activeItems = chara.Inventory; } } drawVector.X += 65; } drawVector = new Point(TopLeft.X + 30, TopLeft.Y + 166); var itemRecs = new Rectangle[activeItems.Count]; for (int i = 0; i < activeItems.Count; i++) { itemRecs[i] = new Rectangle(drawVector.X, drawVector.Y, 80, 80); if (game.Input.HasMouseClickedOnRectangle(itemRecs[i])) { switch (activePane) { case (ActivePane.BuyPane): { BuyItem(activeItems[i]); break; } case (ActivePane.SellPane): { SellItem(i); break; } } break; } drawVector.X += 88; if (i == 3) { drawVector.X = TopLeft.X + 30; drawVector.Y = TopLeft.Y + 268; } if (i == 7) { drawVector.X = TopLeft.X + 30; drawVector.Y = TopLeft.Y + 370; } if (i == 11) { drawVector.X = TopLeft.X + 30; drawVector.Y = TopLeft.Y + 472; } } }
/// <summary> /// Returns a <see cref="System.String" /> that represents this instance. /// </summary> /// <returns> /// A <see cref="System.String" /> that represents this instance. /// </returns> public override string ToString() { return(ActivePane == Pane.Master ? ActiveTab.ToString(CultureInfo.InvariantCulture) : ActivePane.ToString()); }
private void EnableButtons() { OkButton.IsEnabled = ActivePane?.AreButtonsEnabled() ?? false; }