public void Float() { if (this.PreviousContainer == null || this.PreviousContainer.FindParent <LayoutFloatingWindow>() == null) { base.Root.Manager.StartDraggingFloatingWindowForContent(this, false); this.IsSelected = true; this.IsActive = true; return; } ILayoutPane parent = base.Parent as ILayoutPane; int num = (parent as ILayoutGroup).IndexOfChild(this); ILayoutGroup previousContainer = this.PreviousContainer as ILayoutGroup; if (this.PreviousContainerIndex >= previousContainer.ChildrenCount) { previousContainer.InsertChildAt(previousContainer.ChildrenCount, this); } else { previousContainer.InsertChildAt(this.PreviousContainerIndex, this); } this.PreviousContainer = parent; this.PreviousContainerIndex = num; this.IsSelected = true; this.IsActive = true; base.Root.CollectGarbage(); }
public void Dock() { if (this.PreviousContainer == null) { this.InternalDock(); } else { ILayoutContainer parent = base.Parent; int num = (parent is ILayoutGroup ? (parent as ILayoutGroup).IndexOfChild(this) : -1); ILayoutGroup previousContainer = this.PreviousContainer as ILayoutGroup; if (this.PreviousContainerIndex >= previousContainer.ChildrenCount) { previousContainer.InsertChildAt(previousContainer.ChildrenCount, this); } else { previousContainer.InsertChildAt(this.PreviousContainerIndex, this); } if (num <= -1) { this.PreviousContainer = null; this.PreviousContainerIndex = 0; } else { this.PreviousContainer = parent; this.PreviousContainerIndex = num; } this.IsSelected = true; this.IsActive = true; } base.Root.CollectGarbage(); }
public void Show() { if (this.IsVisible) { return; } if (!this.IsHidden) { throw new InvalidOperationException(); } this.RaisePropertyChanging("IsHidden"); this.RaisePropertyChanging("IsVisible"); bool flag = false; ILayoutRoot root = base.Root; if (root != null && root.Manager != null && root.Manager.LayoutUpdateStrategy != null) { flag = root.Manager.LayoutUpdateStrategy.BeforeInsertAnchorable(root as LayoutRoot, this, base.PreviousContainer); } if (!flag && base.PreviousContainer != null) { ILayoutGroup previousContainer = base.PreviousContainer as ILayoutGroup; if (base.PreviousContainerIndex >= previousContainer.ChildrenCount) { previousContainer.InsertChildAt(previousContainer.ChildrenCount, this); } else { previousContainer.InsertChildAt(base.PreviousContainerIndex, this); } base.IsSelected = true; base.IsActive = true; } if (root != null && root.Manager != null && root.Manager.LayoutUpdateStrategy != null) { root.Manager.LayoutUpdateStrategy.AfterInsertAnchorable(root as LayoutRoot, this); } base.PreviousContainer = null; base.PreviousContainerIndex = -1; this.RaisePropertyChanged("IsVisible"); this.RaisePropertyChanged("IsHidden"); this.NotifyIsVisibleChanged(); }
protected override void Drop(LayoutAnchorableFloatingWindow floatingWindow) { ILayoutAnchorablePane model = this._targetPane.Model as ILayoutAnchorablePane; LayoutAnchorable layoutAnchorable = floatingWindow.Descendents().OfType <LayoutAnchorable>().FirstOrDefault <LayoutAnchorable>(); switch (base.Type) { case DropTargetType.AnchorablePaneDockLeft: { ILayoutGroup parent = model.Parent as ILayoutGroup; ILayoutOrientableGroup layoutOrientableGroup = model.Parent as ILayoutOrientableGroup; int num = parent.IndexOfChild(model); if (layoutOrientableGroup.Orientation != Orientation.Horizontal && parent.ChildrenCount == 1) { layoutOrientableGroup.Orientation = Orientation.Horizontal; } if (layoutOrientableGroup.Orientation != Orientation.Horizontal) { ILayoutPositionableElement layoutPositionableElement = model as ILayoutPositionableElement; LayoutAnchorablePaneGroup layoutAnchorablePaneGroup = new LayoutAnchorablePaneGroup() { Orientation = Orientation.Horizontal, DockWidth = layoutPositionableElement.DockWidth, DockHeight = layoutPositionableElement.DockHeight }; parent.InsertChildAt(num, layoutAnchorablePaneGroup); layoutAnchorablePaneGroup.Children.Add(model); layoutAnchorablePaneGroup.Children.Insert(0, floatingWindow.RootPanel); break; } else { LayoutAnchorablePaneGroup rootPanel = floatingWindow.RootPanel; if (rootPanel == null || rootPanel.Children.Count != 1 && rootPanel.Orientation != Orientation.Horizontal) { parent.InsertChildAt(num, floatingWindow.RootPanel); break; } else { ILayoutAnchorablePane[] array = rootPanel.Children.ToArray <ILayoutAnchorablePane>(); for (int i = 0; i < (int)array.Length; i++) { parent.InsertChildAt(num + i, array[i]); } break; } } } case DropTargetType.AnchorablePaneDockTop: { ILayoutGroup layoutGroup = model.Parent as ILayoutGroup; ILayoutOrientableGroup parent1 = model.Parent as ILayoutOrientableGroup; int num1 = layoutGroup.IndexOfChild(model); if (parent1.Orientation != Orientation.Vertical && layoutGroup.ChildrenCount == 1) { parent1.Orientation = Orientation.Vertical; } if (parent1.Orientation != Orientation.Vertical) { ILayoutPositionableElement layoutPositionableElement1 = model as ILayoutPositionableElement; LayoutAnchorablePaneGroup layoutAnchorablePaneGroup1 = new LayoutAnchorablePaneGroup() { Orientation = Orientation.Vertical, DockWidth = layoutPositionableElement1.DockWidth, DockHeight = layoutPositionableElement1.DockHeight }; layoutGroup.InsertChildAt(num1, layoutAnchorablePaneGroup1); layoutAnchorablePaneGroup1.Children.Add(model); layoutAnchorablePaneGroup1.Children.Insert(0, floatingWindow.RootPanel); break; } else { LayoutAnchorablePaneGroup rootPanel1 = floatingWindow.RootPanel; if (rootPanel1 == null || rootPanel1.Children.Count != 1 && rootPanel1.Orientation != Orientation.Vertical) { layoutGroup.InsertChildAt(num1, floatingWindow.RootPanel); break; } else { ILayoutAnchorablePane[] layoutAnchorablePaneArray = rootPanel1.Children.ToArray <ILayoutAnchorablePane>(); for (int j = 0; j < (int)layoutAnchorablePaneArray.Length; j++) { layoutGroup.InsertChildAt(num1 + j, layoutAnchorablePaneArray[j]); } break; } } } case DropTargetType.AnchorablePaneDockRight: { ILayoutGroup layoutGroup1 = model.Parent as ILayoutGroup; ILayoutOrientableGroup layoutOrientableGroup1 = model.Parent as ILayoutOrientableGroup; int num2 = layoutGroup1.IndexOfChild(model); if (layoutOrientableGroup1.Orientation != Orientation.Horizontal && layoutGroup1.ChildrenCount == 1) { layoutOrientableGroup1.Orientation = Orientation.Horizontal; } if (layoutOrientableGroup1.Orientation != Orientation.Horizontal) { ILayoutPositionableElement layoutPositionableElement2 = model as ILayoutPositionableElement; LayoutAnchorablePaneGroup layoutAnchorablePaneGroup2 = new LayoutAnchorablePaneGroup() { Orientation = Orientation.Horizontal, DockWidth = layoutPositionableElement2.DockWidth, DockHeight = layoutPositionableElement2.DockHeight }; layoutGroup1.InsertChildAt(num2, layoutAnchorablePaneGroup2); layoutAnchorablePaneGroup2.Children.Add(model); layoutAnchorablePaneGroup2.Children.Add(floatingWindow.RootPanel); break; } else { LayoutAnchorablePaneGroup rootPanel2 = floatingWindow.RootPanel; if (rootPanel2 == null || rootPanel2.Children.Count != 1 && rootPanel2.Orientation != Orientation.Horizontal) { layoutGroup1.InsertChildAt(num2 + 1, floatingWindow.RootPanel); break; } else { ILayoutAnchorablePane[] array1 = rootPanel2.Children.ToArray <ILayoutAnchorablePane>(); for (int k = 0; k < (int)array1.Length; k++) { layoutGroup1.InsertChildAt(num2 + 1 + k, array1[k]); } break; } } } case DropTargetType.AnchorablePaneDockBottom: { ILayoutGroup parent2 = model.Parent as ILayoutGroup; ILayoutOrientableGroup layoutOrientableGroup2 = model.Parent as ILayoutOrientableGroup; int num3 = parent2.IndexOfChild(model); if (layoutOrientableGroup2.Orientation != Orientation.Vertical && parent2.ChildrenCount == 1) { layoutOrientableGroup2.Orientation = Orientation.Vertical; } if (layoutOrientableGroup2.Orientation != Orientation.Vertical) { ILayoutPositionableElement layoutPositionableElement3 = model as ILayoutPositionableElement; LayoutAnchorablePaneGroup layoutAnchorablePaneGroup3 = new LayoutAnchorablePaneGroup() { Orientation = Orientation.Vertical, DockWidth = layoutPositionableElement3.DockWidth, DockHeight = layoutPositionableElement3.DockHeight }; parent2.InsertChildAt(num3, layoutAnchorablePaneGroup3); layoutAnchorablePaneGroup3.Children.Add(model); layoutAnchorablePaneGroup3.Children.Add(floatingWindow.RootPanel); break; } else { LayoutAnchorablePaneGroup rootPanel3 = floatingWindow.RootPanel; if (rootPanel3 == null || rootPanel3.Children.Count != 1 && rootPanel3.Orientation != Orientation.Vertical) { parent2.InsertChildAt(num3 + 1, floatingWindow.RootPanel); break; } else { ILayoutAnchorablePane[] layoutAnchorablePaneArray1 = rootPanel3.Children.ToArray <ILayoutAnchorablePane>(); for (int l = 0; l < (int)layoutAnchorablePaneArray1.Length; l++) { parent2.InsertChildAt(num3 + 1 + l, layoutAnchorablePaneArray1[l]); } break; } } } case DropTargetType.AnchorablePaneDockInside: { LayoutAnchorablePane layoutAnchorablePane = model as LayoutAnchorablePane; LayoutAnchorablePaneGroup rootPanel4 = floatingWindow.RootPanel; int num4 = (this._tabIndex == -1 ? 0 : this._tabIndex); LayoutAnchorable[] layoutAnchorableArray = rootPanel4.Descendents().OfType <LayoutAnchorable>().ToArray <LayoutAnchorable>(); for (int m = 0; m < (int)layoutAnchorableArray.Length; m++) { LayoutAnchorable layoutAnchorable1 = layoutAnchorableArray[m]; layoutAnchorablePane.Children.Insert(num4, layoutAnchorable1); num4++; } break; } } layoutAnchorable.IsActive = true; base.Drop(floatingWindow); }