internal LayoutAnchorableFloatingWindowControl(LayoutAnchorableFloatingWindow model) : base(model) { _model = model; HideWindowCommand = new DelegateCommand(OnExecuteHideWindowCommand, CanExecuteHideWindowCommand); Loaded += LayoutAnchorableFloatingWindowControl_Loaded; }
internal LayoutAnchorableFloatingWindowControl(LayoutAnchorableFloatingWindow model) : base(model) { _model = model; HideWindowCommand = new RelayCommand((p) => OnExecuteHideWindowCommand(p), (p) => CanExecuteHideWindowCommand(p)); UpdateThemeResources(); }
/// <summary> /// Method is invoked to complete a drag & drop operation with a (new) docking position /// by docking of the LayoutAnchorable <paramref name="floatingWindow"/> into this drop target. /// </summary> /// <param name="floatingWindow"></param> protected override void Drop(LayoutAnchorableFloatingWindow floatingWindow) { ILayoutPane targetModel = _targetPane.Model as ILayoutPane; switch (Type) { case DropTargetType.DocumentPaneGroupDockInside: #region DropTargetType.DocumentPaneGroupDockInside { var paneGroupModel = targetModel as LayoutDocumentPaneGroup; var paneModel = paneGroupModel.Children[0] as LayoutDocumentPane; var layoutAnchorablePaneGroup = floatingWindow.RootPanel as LayoutAnchorablePaneGroup; int i = 0; foreach (var anchorableToImport in layoutAnchorablePaneGroup.Descendents().OfType <LayoutAnchorable>().ToArray()) { // BD: 18.07.2020 Remove that bodge and handle CanClose=false && CanHide=true in XAML //anchorableToImport.SetCanCloseInternal(true); paneModel.Children.Insert(i, anchorableToImport); i++; } } break; #endregion DropTargetType.DocumentPaneGroupDockInside } base.Drop(floatingWindow); }
protected override void Drop(LayoutAnchorableFloatingWindow floatingWindow) { var targetModel = _targetPane.Model as ILayoutDocumentPane; LayoutDocumentPaneGroup parentGroup; LayoutPanel parentGroupPanel; FindParentLayoutDocumentPane(targetModel, out parentGroup, out parentGroupPanel); switch (Type) { case DropTargetType.DocumentPaneDockAsAnchorableBottom: #region DropTargetType.DocumentPaneDockAsAnchorableBottom { if (parentGroupPanel is not null && parentGroupPanel.ChildrenCount == 1) { parentGroupPanel.Orientation = Orientation.Vertical; } if (parentGroupPanel is not null && parentGroupPanel.Orientation == Orientation.Vertical) { parentGroupPanel.Children.Insert( parentGroupPanel.IndexOfChild(parentGroup is not null ? parentGroup : targetModel) + 1, floatingWindow.RootPanel); }
protected override void Drop(LayoutAnchorableFloatingWindow floatingWindow) { ILayoutPane targetModel = _targetPane.Model as ILayoutPane; switch (Type) { case DropTargetType.DocumentPaneGroupDockInside: { var paneGroupModel = targetModel as LayoutDocumentPaneGroup; if (paneGroupModel != null) { var paneModel = paneGroupModel.Children[0] as LayoutDocumentPane; var layoutAnchorablePaneGroup = floatingWindow.RootPanel; int i = 0; foreach ( var anchorableToImport in layoutAnchorablePaneGroup.Descendents().OfType <LayoutAnchorable>().ToArray()) { paneModel?.Children.Insert(i, anchorableToImport); i++; } } } break; } base.Drop(floatingWindow); }
protected override void Drop(LayoutAnchorableFloatingWindow floatingWindow) { var targetModel = _targetPane.Model as ILayoutPane; switch (Type) { case DropTargetType.DocumentPaneGroupDockInside: #region DropTargetType.DocumentPaneGroupDockInside { var paneGroupModel = targetModel as LayoutDocumentPaneGroup; var paneModel = paneGroupModel.Children[0] as LayoutDocumentPane; var layoutAnchorablePaneGroup = floatingWindow.RootPanel; var i = 0; foreach (var anchorableToImport in layoutAnchorablePaneGroup.Descendents() .OfType <LayoutAnchorable>().ToArray()) { anchorableToImport.SetCanCloseInternal(true); paneModel.Children.Insert(i, anchorableToImport); i++; } } break; #endregion } base.Drop(floatingWindow); }
public override Geometry GetPreviewPath(OverlayWindow overlayWindow, LayoutFloatingWindow floatingWindowModel) { LayoutAnchorableFloatingWindow layoutAnchorableFloatingWindow = floatingWindowModel as LayoutAnchorableFloatingWindow; ILayoutPositionableElement rootPanel = layoutAnchorableFloatingWindow.RootPanel; ILayoutPositionableElementWithActualSize layoutPositionableElementWithActualSize = layoutAnchorableFloatingWindow.RootPanel; Rect screenArea = base.TargetElement.GetScreenArea(); switch (base.Type) { case DropTargetType.DockingManagerDockLeft: { double num = (rootPanel.DockWidth.IsAbsolute ? rootPanel.DockWidth.Value : layoutPositionableElementWithActualSize.ActualWidth); return(new RectangleGeometry(new Rect(screenArea.Left - overlayWindow.Left, screenArea.Top - overlayWindow.Top, Math.Min(num, screenArea.Width / 2), screenArea.Height))); } case DropTargetType.DockingManagerDockTop: { double num1 = (rootPanel.DockHeight.IsAbsolute ? rootPanel.DockHeight.Value : layoutPositionableElementWithActualSize.ActualHeight); return(new RectangleGeometry(new Rect(screenArea.Left - overlayWindow.Left, screenArea.Top - overlayWindow.Top, screenArea.Width, Math.Min(num1, screenArea.Height / 2)))); } case DropTargetType.DockingManagerDockRight: { double num2 = (rootPanel.DockWidth.IsAbsolute ? rootPanel.DockWidth.Value : layoutPositionableElementWithActualSize.ActualWidth); return(new RectangleGeometry(new Rect(screenArea.Right - overlayWindow.Left - Math.Min(num2, screenArea.Width / 2), screenArea.Top - overlayWindow.Top, Math.Min(num2, screenArea.Width / 2), screenArea.Height))); } case DropTargetType.DockingManagerDockBottom: { double num3 = (rootPanel.DockHeight.IsAbsolute ? rootPanel.DockHeight.Value : layoutPositionableElementWithActualSize.ActualHeight); return(new RectangleGeometry(new Rect(screenArea.Left - overlayWindow.Left, screenArea.Bottom - overlayWindow.Top - Math.Min(num3, screenArea.Height / 2), screenArea.Width, Math.Min(num3, screenArea.Height / 2)))); } } throw new InvalidOperationException(); }
internal LayoutAnchorableFloatingWindowControl(LayoutAnchorableFloatingWindow model, bool isContentImmutable) : base(model, isContentImmutable) { _model = model; HideWindowCommand = new RelayCommand(p => OnExecuteHideWindowCommand(p), p => CanExecuteHideWindowCommand(p)); CloseWindowCommand = new RelayCommand(p => OnExecuteCloseWindowCommand(p), p => CanExecuteCloseWindowCommand(p)); UpdateThemeResources(); }
protected override void Drop(LayoutAnchorableFloatingWindow floatingWindow) { var targetModel = _targetPane.Model as ILayoutAnchorablePane; var anchorableActive = floatingWindow.Descendents().OfType <LayoutAnchorable>().FirstOrDefault(); switch (Type) { case DropTargetType.AnchorablePaneDockBottom: #region DropTargetType.AnchorablePaneDockBottom { var parentModel = targetModel.Parent as ILayoutGroup; var parentModelOrientable = targetModel.Parent as ILayoutOrientableGroup; var insertToIndex = parentModel.IndexOfChild(targetModel); if (parentModelOrientable.Orientation != Orientation.Vertical && parentModel.ChildrenCount == 1) { parentModelOrientable.Orientation = Orientation.Vertical; } if (parentModelOrientable.Orientation == Orientation.Vertical) { var layoutAnchorablePaneGroup = floatingWindow.RootPanel; if (layoutAnchorablePaneGroup is not null && (layoutAnchorablePaneGroup.Children.Count == 1 || layoutAnchorablePaneGroup.Orientation == Orientation.Vertical)) { var anchorablesToMove = layoutAnchorablePaneGroup.Children.ToArray(); for (var i = 0; i < anchorablesToMove.Length; i++) { parentModel.InsertChildAt(insertToIndex + 1 + i, anchorablesToMove[i]); } } else { parentModel.InsertChildAt(insertToIndex + 1, floatingWindow.RootPanel); } } else { var targetModelAsPositionableElement = targetModel as ILayoutPositionableElement; var newOrientedPanel = new LayoutAnchorablePaneGroup { Orientation = Orientation.Vertical, DockWidth = targetModelAsPositionableElement.DockWidth, DockHeight = targetModelAsPositionableElement.DockHeight }; parentModel.InsertChildAt(insertToIndex, newOrientedPanel); newOrientedPanel.Children.Add(targetModel); newOrientedPanel.Children.Add(floatingWindow.RootPanel); } }
public void ClearBindingOfHiddenWindowTest() { LayoutAnchorable layoutAnchorable = new LayoutAnchorable { FloatingWidth = 50, FloatingHeight = 100, ContentId = "Test" }; LayoutAnchorablePane layoutAnchorablePane = new LayoutAnchorablePane(layoutAnchorable); LayoutAnchorablePaneGroup layoutAnchorablePaneGroup = new LayoutAnchorablePaneGroup(layoutAnchorablePane); LayoutAnchorableFloatingWindow layoutFloatingWindow = new LayoutAnchorableFloatingWindow { RootPanel = layoutAnchorablePaneGroup }; var ctor = typeof(LayoutAnchorableFloatingWindowControl) .GetTypeInfo() .GetConstructors(BindingFlags.NonPublic | BindingFlags.Instance) .First(x => x.GetParameters().Length == 1); LayoutAnchorableFloatingWindowControl floatingWindowControl = ctor.Invoke(new object[] { layoutFloatingWindow }) as LayoutAnchorableFloatingWindowControl; floatingWindowControl.SetBinding( UIElement.VisibilityProperty, new Binding("IsVisible") { Source = floatingWindowControl.Model, Converter = new BoolToVisibilityConverter(), Mode = BindingMode.OneWay, ConverterParameter = Visibility.Hidden }); BindingExpression visibilityBinding = floatingWindowControl.GetBindingExpression(UIElement.VisibilityProperty); Assert.IsNotNull(visibilityBinding); layoutAnchorable.Show(); layoutAnchorable.Hide(); visibilityBinding = floatingWindowControl.GetBindingExpression(UIElement.VisibilityProperty); Assert.IsNotNull(visibilityBinding); floatingWindowControl.Hide(); visibilityBinding = floatingWindowControl.GetBindingExpression(UIElement.VisibilityProperty); Assert.IsNull(visibilityBinding); }
internal LayoutAnchorableFloatingWindowControl(LayoutAnchorableFloatingWindow model, bool isContentImmutable) : base(model, isContentImmutable) { _model = model; HideWindowCommand = new RelayCommand((p) => OnExecuteHideWindowCommand(p), (p) => CanExecuteHideWindowCommand(p)); CloseWindowCommand = new RelayCommand((p) => OnExecuteCloseWindowCommand(p), (p) => CanExecuteCloseWindowCommand(p)); Activated += LayoutAnchorableFloatingWindowControl_Activated; UpdateThemeResources(); MinWidth = _model.RootPanel.CalculatedDockMinWidth(); MinHeight = _model.RootPanel.CalculatedDockMinHeight(); if (_model.Root is LayoutRoot root) { root.Updated += OnRootUpdated; } _model.IsVisibleChanged += _model_IsVisibleChanged; }
public void RegisterAnchorable <T>(string viewName, int defaultWidth = 250, int defaultHeight = 400) where T : new() { _Contents.Add(viewName, new Lazy <object>(() => new T())); _ShowViews.Add(viewName, () => { var anchorable = Find <LayoutAnchorable>(viewName); if (anchorable == null) { anchorable = new LayoutAnchorable(); anchorable.Title = viewName; anchorable.ContentId = viewName; anchorable.FloatingWidth = defaultWidth; anchorable.FloatingHeight = defaultHeight; LayoutFloatingWindow layoutFloatingWindow = new LayoutAnchorableFloatingWindow { RootPanel = new LayoutAnchorablePaneGroup(new LayoutAnchorablePane(anchorable) { //DockMinHeight = layoutPositionableElement.DockMinHeight, //DockMinWidth = layoutPositionableElement.DockMinWidth, //FloatingLeft = layoutPositionableElement.FloatingLeft, //FloatingTop = layoutPositionableElement.FloatingTop, FloatingWidth = defaultWidth, FloatingHeight = defaultHeight, }) }; dockManager.Layout.FloatingWindows.Add(layoutFloatingWindow); AttachToUI(layoutFloatingWindow, anchorable); } if (anchorable.Content == null) { anchorable.Content = FindContent(viewName); } if (anchorable.IsHidden) { anchorable.Show(); } anchorable.IsActive = true; }); MenuItem subMenu = new MenuItem(); subMenu.Header = viewName; viewMenu.Items.Add(subMenu); subMenu.Click += (s, a) => ShowView(viewName); }
internal LayoutAnchorableFloatingWindowControl(LayoutAnchorableFloatingWindow model, bool isContentImmutable) : base(model, isContentImmutable) { _model = model; HideWindowCommand = new RelayCommand((p) => OnExecuteHideWindowCommand(p), (p) => CanExecuteHideWindowCommand(p)); CloseWindowCommand = new RelayCommand((p) => OnExecuteCloseWindowCommand(p), (p) => CanExecuteCloseWindowCommand(p)); UpdateThemeResources(); MinWidth = _model.RootPanel.CalculatedDockMinWidth(); MinHeight = _model.RootPanel.CalculatedDockMinHeight(); LayoutRoot root = _model.Root as LayoutRoot; if (root != null) { root.Updated += OnRootUpdated; } }
protected override void Drop(LayoutAnchorableFloatingWindow floatingWindow) { switch (Type) { case DropTargetType.DockingManagerDockLeft: #region DropTargetType.DockingManagerDockLeft { if (_manager.Layout.RootPanel.Orientation != Orientation.Horizontal && _manager.Layout.RootPanel.Children.Count == 1) { _manager.Layout.RootPanel.Orientation = Orientation.Horizontal; } if (_manager.Layout.RootPanel.Orientation == Orientation.Horizontal) { var layoutAnchorablePaneGroup = floatingWindow.RootPanel; if (layoutAnchorablePaneGroup is not null && layoutAnchorablePaneGroup.Orientation == Orientation.Horizontal) { var childrenToTransfer = layoutAnchorablePaneGroup.Children.ToArray(); for (var i = 0; i < childrenToTransfer.Length; i++) { _manager.Layout.RootPanel.Children.Insert(i, childrenToTransfer[i]); } } else { _manager.Layout.RootPanel.Children.Insert(0, floatingWindow.RootPanel); } } else { var newOrientedPanel = new LayoutPanel { Orientation = Orientation.Horizontal }; newOrientedPanel.Children.Add(floatingWindow.RootPanel); newOrientedPanel.Children.Add(_manager.Layout.RootPanel); _manager.Layout.RootPanel = newOrientedPanel; } }
protected override void Drop(LayoutAnchorableFloatingWindow floatingWindow) { ILayoutPane model = this._targetPane.Model as ILayoutPane; if (base.Type == DropTargetType.DocumentPaneGroupDockInside) { LayoutDocumentPane item = (model as LayoutDocumentPaneGroup).Children[0] as LayoutDocumentPane; int num = 0; LayoutAnchorable[] array = floatingWindow.RootPanel.Descendents().OfType <LayoutAnchorable>().ToArray <LayoutAnchorable>(); for (int i = 0; i < (int)array.Length; i++) { LayoutAnchorable layoutAnchorable = array[i]; item.Children.Insert(num, layoutAnchorable); num++; } } base.Drop(floatingWindow); }
protected override void OnMouseLeftButtonDown(MouseButtonEventArgs e) { base.OnMouseLeftButtonDown(e); if (!e.Handled) { bool flag = false; LayoutAnchorableFloatingWindow layoutAnchorableFloatingWindow = this.Model.FindParent <LayoutAnchorableFloatingWindow>(); if (layoutAnchorableFloatingWindow != null) { flag = layoutAnchorableFloatingWindow.Descendents().OfType <LayoutAnchorablePane>().Count <LayoutAnchorablePane>() == 1; } if (flag) { this.Model.Root.Manager.FloatingWindows.Single <LayoutFloatingWindowControl>((LayoutFloatingWindowControl fwc) => fwc.Model == layoutAnchorableFloatingWindow).AttachDrag(false); return; } this._isMouseDown = true; } }
public void Drop(LayoutFloatingWindow floatingWindow) { ILayoutRoot root = floatingWindow.Root; LayoutContent activeContent = floatingWindow.Root.ActiveContent; LayoutAnchorableFloatingWindow layoutAnchorableFloatingWindow = floatingWindow as LayoutAnchorableFloatingWindow; if (layoutAnchorableFloatingWindow == null) { this.Drop(floatingWindow as LayoutDocumentFloatingWindow); } else { this.Drop(layoutAnchorableFloatingWindow); } base.Dispatcher.BeginInvoke(new Action(() => { activeContent.IsSelected = false; activeContent.IsActive = false; activeContent.IsActive = true; }), DispatcherPriority.Background, new object[0]); }
protected override void Drop(LayoutAnchorableFloatingWindow floatingWindow) { ILayoutAnchorablePane[] childrenToTransfer = new ILayoutAnchorablePane[0]; LayoutAnchorablePaneGroup layoutAnchorablePaneGroup = (LayoutAnchorablePaneGroup)(floatingWindow.RootPanel); if (layoutAnchorablePaneGroup != null) { childrenToTransfer = layoutAnchorablePaneGroup.Children.ToArray(); } switch (Type) { case DropTargetType.DockingManagerDockLeft: #region DropTargetType.DockingManagerDockLeft { if (_manager.Layout.RootPanel.Orientation != System.Windows.Controls.Orientation.Horizontal && _manager.Layout.RootPanel.Children.Count == 1) { _manager.Layout.RootPanel.Orientation = System.Windows.Controls.Orientation.Horizontal; } if (_manager.Layout.RootPanel.Orientation == System.Windows.Controls.Orientation.Horizontal) { //layoutAnchorablePaneGroup = floatingWindow.RootPanel as LayoutAnchorablePaneGroup; if (layoutAnchorablePaneGroup != null && layoutAnchorablePaneGroup.Orientation == System.Windows.Controls.Orientation.Horizontal) { //childrenToTransfer = layoutAnchorablePaneGroup.Children.ToArray(); for (int i = 0; i < childrenToTransfer.Length; i++) { _manager.Layout.RootPanel.Children.Insert(i, childrenToTransfer[i]); } } else { _manager.Layout.RootPanel.Children.Insert(0, floatingWindow.RootPanel); } } else { var newOrientedPanel = new LayoutPanel() { Orientation = System.Windows.Controls.Orientation.Horizontal }; newOrientedPanel.Children.Add(floatingWindow.RootPanel); newOrientedPanel.Children.Add(_manager.Layout.RootPanel); _manager.Layout.RootPanel = newOrientedPanel; } } break; #endregion case DropTargetType.DockingManagerDockRight: #region DropTargetType.DockingManagerDockRight { if (_manager.Layout.RootPanel.Orientation != System.Windows.Controls.Orientation.Horizontal && _manager.Layout.RootPanel.Children.Count == 1) { _manager.Layout.RootPanel.Orientation = System.Windows.Controls.Orientation.Horizontal; } if (_manager.Layout.RootPanel.Orientation == System.Windows.Controls.Orientation.Horizontal) { //layoutAnchorablePaneGroup = floatingWindow.RootPanel as LayoutAnchorablePaneGroup; if (layoutAnchorablePaneGroup != null && layoutAnchorablePaneGroup.Orientation == System.Windows.Controls.Orientation.Horizontal) { //childrenToTransfer = layoutAnchorablePaneGroup.Children.ToArray(); for (int i = 0; i < childrenToTransfer.Length; i++) { _manager.Layout.RootPanel.Children.Add(childrenToTransfer[i]); } } else { _manager.Layout.RootPanel.Children.Add(floatingWindow.RootPanel); } } else { var newOrientedPanel = new LayoutPanel() { Orientation = System.Windows.Controls.Orientation.Horizontal }; newOrientedPanel.Children.Add(_manager.Layout.RootPanel); newOrientedPanel.Children.Add(floatingWindow.RootPanel); _manager.Layout.RootPanel = newOrientedPanel; } } break; #endregion case DropTargetType.DockingManagerDockTop: #region DropTargetType.DockingManagerDockTop { if (_manager.Layout.RootPanel.Orientation != System.Windows.Controls.Orientation.Vertical && _manager.Layout.RootPanel.Children.Count == 1) { _manager.Layout.RootPanel.Orientation = System.Windows.Controls.Orientation.Vertical; } if (_manager.Layout.RootPanel.Orientation == System.Windows.Controls.Orientation.Vertical) { //layoutAnchorablePaneGroup = floatingWindow.RootPanel as LayoutAnchorablePaneGroup; if (layoutAnchorablePaneGroup != null && layoutAnchorablePaneGroup.Orientation == System.Windows.Controls.Orientation.Vertical) { //childrenToTransfer = layoutAnchorablePaneGroup.Children.ToArray(); for (int i = 0; i < childrenToTransfer.Length; i++) { _manager.Layout.RootPanel.Children.Insert(i, childrenToTransfer[i]); } } else { _manager.Layout.RootPanel.Children.Insert(0, floatingWindow.RootPanel); } } else { var newOrientedPanel = new LayoutPanel() { Orientation = System.Windows.Controls.Orientation.Vertical }; newOrientedPanel.Children.Add(floatingWindow.RootPanel); newOrientedPanel.Children.Add(_manager.Layout.RootPanel); _manager.Layout.RootPanel = newOrientedPanel; } } break; #endregion case DropTargetType.DockingManagerDockBottom: #region DropTargetType.DockingManagerDockBottom { if (_manager.Layout.RootPanel.Orientation != System.Windows.Controls.Orientation.Vertical && _manager.Layout.RootPanel.Children.Count == 1) { _manager.Layout.RootPanel.Orientation = System.Windows.Controls.Orientation.Vertical; } if (_manager.Layout.RootPanel.Orientation == System.Windows.Controls.Orientation.Vertical) { //layoutAnchorablePaneGroup = floatingWindow.RootPanel as LayoutAnchorablePaneGroup; if (layoutAnchorablePaneGroup != null && layoutAnchorablePaneGroup.Orientation == System.Windows.Controls.Orientation.Vertical) { //childrenToTransfer = layoutAnchorablePaneGroup.Children.ToArray(); for (int i = 0; i < childrenToTransfer.Length; i++) { _manager.Layout.RootPanel.Children.Add(childrenToTransfer[i]); } } else { _manager.Layout.RootPanel.Children.Add(floatingWindow.RootPanel); } } else { var newOrientedPanel = new LayoutPanel() { Orientation = System.Windows.Controls.Orientation.Vertical }; newOrientedPanel.Children.Add(_manager.Layout.RootPanel); newOrientedPanel.Children.Add(floatingWindow.RootPanel); _manager.Layout.RootPanel = newOrientedPanel; } } break; #endregion } foreach (LayoutAnchorablePane lapane in childrenToTransfer) { //LayoutAnchorablePane lapane = (LayoutAnchorablePane)ilapane; foreach (LayoutAnchorable lanch in lapane.Children) { lanch.IsDock = true; switch (Type) { case DropTargetType.DockingManagerDockLeft: Global.LayoutSetting.AddDefaultSideAnchorable( lanch.Title, "LEFT"); break; case DropTargetType.DockingManagerDockRight: Global.LayoutSetting.AddDefaultSideAnchorable( lanch.Title, "RIGHT"); break; case DropTargetType.DockingManagerDockTop: Global.LayoutSetting.AddDefaultSideAnchorable( lanch.Title, "TOP"); break; case DropTargetType.DockingManagerDockBottom: Global.LayoutSetting.AddDefaultSideAnchorable( lanch.Title, "DOWN"); break; } } } base.Drop(floatingWindow); }
protected override void Drop(LayoutAnchorableFloatingWindow floatingWindow) { ILayoutAnchorablePane targetModel = _targetPane.Model as ILayoutAnchorablePane; LayoutAnchorable anchorableActive = floatingWindow.Descendents().OfType <LayoutAnchorable>().FirstOrDefault(); switch (Type) { case DropTargetType.AnchorablePaneDockBottom: #region DropTargetType.AnchorablePaneDockBottom { var parentModel = targetModel.Parent as ILayoutGroup; var parentModelOrientable = targetModel.Parent as ILayoutOrientableGroup; int insertToIndex = parentModel.IndexOfChild(targetModel); if (parentModelOrientable.Orientation != System.Windows.Controls.Orientation.Vertical && parentModel.ChildrenCount == 1) { parentModelOrientable.Orientation = System.Windows.Controls.Orientation.Vertical; } if (parentModelOrientable.Orientation == System.Windows.Controls.Orientation.Vertical) { var layoutAnchorablePaneGroup = floatingWindow.RootPanel as LayoutAnchorablePaneGroup; if (layoutAnchorablePaneGroup != null && (layoutAnchorablePaneGroup.Children.Count == 1 || layoutAnchorablePaneGroup.Orientation == System.Windows.Controls.Orientation.Vertical)) { var anchorablesToMove = layoutAnchorablePaneGroup.Children.ToArray(); for (int i = 0; i < anchorablesToMove.Length; i++) { parentModel.InsertChildAt(insertToIndex + 1 + i, anchorablesToMove[i]); } } else { parentModel.InsertChildAt(insertToIndex + 1, floatingWindow.RootPanel); } } else { var targetModelAsPositionableElement = targetModel as ILayoutPositionableElement; var newOrientedPanel = new LayoutAnchorablePaneGroup() { Orientation = System.Windows.Controls.Orientation.Vertical, DockWidth = targetModelAsPositionableElement.DockWidth, DockHeight = targetModelAsPositionableElement.DockHeight, }; parentModel.InsertChildAt(insertToIndex, newOrientedPanel); newOrientedPanel.Children.Add(targetModel); newOrientedPanel.Children.Add(floatingWindow.RootPanel); } } break; #endregion case DropTargetType.AnchorablePaneDockTop: #region DropTargetType.AnchorablePaneDockTop { var parentModel = targetModel.Parent as ILayoutGroup; var parentModelOrientable = targetModel.Parent as ILayoutOrientableGroup; int insertToIndex = parentModel.IndexOfChild(targetModel); if (parentModelOrientable.Orientation != System.Windows.Controls.Orientation.Vertical && parentModel.ChildrenCount == 1) { parentModelOrientable.Orientation = System.Windows.Controls.Orientation.Vertical; } if (parentModelOrientable.Orientation == System.Windows.Controls.Orientation.Vertical) { var layoutAnchorablePaneGroup = floatingWindow.RootPanel as LayoutAnchorablePaneGroup; if (layoutAnchorablePaneGroup != null && (layoutAnchorablePaneGroup.Children.Count == 1 || layoutAnchorablePaneGroup.Orientation == System.Windows.Controls.Orientation.Vertical)) { var anchorablesToMove = layoutAnchorablePaneGroup.Children.ToArray(); for (int i = 0; i < anchorablesToMove.Length; i++) { parentModel.InsertChildAt(insertToIndex + i, anchorablesToMove[i]); } } else { parentModel.InsertChildAt(insertToIndex, floatingWindow.RootPanel); } } else { var targetModelAsPositionableElement = targetModel as ILayoutPositionableElement; var newOrientedPanel = new LayoutAnchorablePaneGroup() { Orientation = System.Windows.Controls.Orientation.Vertical, DockWidth = targetModelAsPositionableElement.DockWidth, DockHeight = targetModelAsPositionableElement.DockHeight, }; parentModel.InsertChildAt(insertToIndex, newOrientedPanel); //the floating window must be added after the target modal as it could be raise a CollectGarbage call newOrientedPanel.Children.Add(targetModel); newOrientedPanel.Children.Insert(0, floatingWindow.RootPanel); } } break; #endregion case DropTargetType.AnchorablePaneDockLeft: #region DropTargetType.AnchorablePaneDockLeft { var parentModel = targetModel.Parent as ILayoutGroup; var parentModelOrientable = targetModel.Parent as ILayoutOrientableGroup; int insertToIndex = parentModel.IndexOfChild(targetModel); if (parentModelOrientable.Orientation != System.Windows.Controls.Orientation.Horizontal && parentModel.ChildrenCount == 1) { parentModelOrientable.Orientation = System.Windows.Controls.Orientation.Horizontal; } if (parentModelOrientable.Orientation == System.Windows.Controls.Orientation.Horizontal) { var layoutAnchorablePaneGroup = floatingWindow.RootPanel as LayoutAnchorablePaneGroup; if (layoutAnchorablePaneGroup != null && (layoutAnchorablePaneGroup.Children.Count == 1 || layoutAnchorablePaneGroup.Orientation == System.Windows.Controls.Orientation.Horizontal)) { var anchorablesToMove = layoutAnchorablePaneGroup.Children.ToArray(); for (int i = 0; i < anchorablesToMove.Length; i++) { parentModel.InsertChildAt(insertToIndex + i, anchorablesToMove[i]); } } else { parentModel.InsertChildAt(insertToIndex, floatingWindow.RootPanel); } } else { var targetModelAsPositionableElement = targetModel as ILayoutPositionableElement; var newOrientedPanel = new LayoutAnchorablePaneGroup() { Orientation = System.Windows.Controls.Orientation.Horizontal, DockWidth = targetModelAsPositionableElement.DockWidth, DockHeight = targetModelAsPositionableElement.DockHeight, }; parentModel.InsertChildAt(insertToIndex, newOrientedPanel); //the floating window must be added after the target modal as it could be raise a CollectGarbage call newOrientedPanel.Children.Add(targetModel); newOrientedPanel.Children.Insert(0, floatingWindow.RootPanel); } } break; #endregion case DropTargetType.AnchorablePaneDockRight: #region DropTargetType.AnchorablePaneDockRight { var parentModel = targetModel.Parent as ILayoutGroup; var parentModelOrientable = targetModel.Parent as ILayoutOrientableGroup; int insertToIndex = parentModel.IndexOfChild(targetModel); if (parentModelOrientable.Orientation != System.Windows.Controls.Orientation.Horizontal && parentModel.ChildrenCount == 1) { parentModelOrientable.Orientation = System.Windows.Controls.Orientation.Horizontal; } if (parentModelOrientable.Orientation == System.Windows.Controls.Orientation.Horizontal) { var layoutAnchorablePaneGroup = floatingWindow.RootPanel as LayoutAnchorablePaneGroup; if (layoutAnchorablePaneGroup != null && (layoutAnchorablePaneGroup.Children.Count == 1 || layoutAnchorablePaneGroup.Orientation == System.Windows.Controls.Orientation.Horizontal)) { var anchorablesToMove = layoutAnchorablePaneGroup.Children.ToArray(); for (int i = 0; i < anchorablesToMove.Length; i++) { parentModel.InsertChildAt(insertToIndex + 1 + i, anchorablesToMove[i]); } } else { parentModel.InsertChildAt(insertToIndex + 1, floatingWindow.RootPanel); } } else { var targetModelAsPositionableElement = targetModel as ILayoutPositionableElement; var newOrientedPanel = new LayoutAnchorablePaneGroup() { Orientation = System.Windows.Controls.Orientation.Horizontal, DockWidth = targetModelAsPositionableElement.DockWidth, DockHeight = targetModelAsPositionableElement.DockHeight, }; parentModel.InsertChildAt(insertToIndex, newOrientedPanel); newOrientedPanel.Children.Add(targetModel); newOrientedPanel.Children.Add(floatingWindow.RootPanel); } } break; #endregion case DropTargetType.AnchorablePaneDockInside: #region DropTargetType.AnchorablePaneDockInside { var paneModel = targetModel as LayoutAnchorablePane; var layoutAnchorablePaneGroup = floatingWindow.RootPanel as LayoutAnchorablePaneGroup; int i = _tabIndex == -1 ? 0 : _tabIndex; foreach (var anchorableToImport in layoutAnchorablePaneGroup.Descendents().OfType <LayoutAnchorable>().ToArray()) { paneModel.Children.Insert(i, anchorableToImport); i++; } } break; #endregion } anchorableActive.IsActive = true; base.Drop(floatingWindow); }
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); }
protected override void Drop(LayoutAnchorableFloatingWindow floatingWindow) { LayoutDocumentPaneGroup layoutDocumentPaneGroup; LayoutPanel layoutPanel; ILayoutElement layoutElement; ILayoutPanelElement layoutPanelElement; ILayoutElement layoutElement1; ILayoutElement layoutElement2; ILayoutPanelElement layoutPanelElement1; ILayoutElement layoutElement3; ILayoutElement layoutElement4; ILayoutPanelElement layoutPanelElement2; ILayoutElement layoutElement5; ILayoutElement layoutElement6; ILayoutPanelElement layoutPanelElement3; ILayoutElement layoutElement7; ILayoutDocumentPane model = this._targetPane.Model as ILayoutDocumentPane; this.FindParentLayoutDocumentPane(model, out layoutDocumentPaneGroup, out layoutPanel); switch (base.Type) { case DropTargetType.DocumentPaneDockAsAnchorableLeft: { if (layoutPanel != null && layoutPanel.ChildrenCount == 1) { layoutPanel.Orientation = Orientation.Horizontal; } if (layoutPanel == null || layoutPanel.Orientation != Orientation.Horizontal) { if (layoutPanel == null) { throw new NotImplementedException(); } LayoutPanel layoutPanel1 = new LayoutPanel() { Orientation = Orientation.Horizontal }; LayoutPanel layoutPanel2 = layoutPanel; if (layoutDocumentPaneGroup != null) { layoutElement = layoutDocumentPaneGroup; } else { layoutElement = model; } layoutPanel2.ReplaceChild(layoutElement, layoutPanel1); ObservableCollection <ILayoutPanelElement> children = layoutPanel1.Children; if (layoutDocumentPaneGroup != null) { layoutPanelElement = layoutDocumentPaneGroup; } else { layoutPanelElement = model; } children.Add(layoutPanelElement); layoutPanel1.Children.Insert(0, floatingWindow.RootPanel); break; } else { ObservableCollection <ILayoutPanelElement> observableCollection = layoutPanel.Children; LayoutPanel layoutPanel3 = layoutPanel; if (layoutDocumentPaneGroup != null) { layoutElement1 = layoutDocumentPaneGroup; } else { layoutElement1 = model; } observableCollection.Insert(layoutPanel3.IndexOfChild(layoutElement1), floatingWindow.RootPanel); break; } } case DropTargetType.DocumentPaneDockAsAnchorableTop: { if (layoutPanel != null && layoutPanel.ChildrenCount == 1) { layoutPanel.Orientation = Orientation.Vertical; } if (layoutPanel == null || layoutPanel.Orientation != Orientation.Vertical) { if (layoutPanel == null) { throw new NotImplementedException(); } LayoutPanel layoutPanel4 = new LayoutPanel() { Orientation = Orientation.Vertical }; LayoutPanel layoutPanel5 = layoutPanel; if (layoutDocumentPaneGroup != null) { layoutElement2 = layoutDocumentPaneGroup; } else { layoutElement2 = model; } layoutPanel5.ReplaceChild(layoutElement2, layoutPanel4); ObservableCollection <ILayoutPanelElement> children1 = layoutPanel4.Children; if (layoutDocumentPaneGroup != null) { layoutPanelElement1 = layoutDocumentPaneGroup; } else { layoutPanelElement1 = model; } children1.Add(layoutPanelElement1); layoutPanel4.Children.Insert(0, floatingWindow.RootPanel); break; } else { ObservableCollection <ILayoutPanelElement> observableCollection1 = layoutPanel.Children; LayoutPanel layoutPanel6 = layoutPanel; if (layoutDocumentPaneGroup != null) { layoutElement3 = layoutDocumentPaneGroup; } else { layoutElement3 = model; } observableCollection1.Insert(layoutPanel6.IndexOfChild(layoutElement3), floatingWindow.RootPanel); break; } } case DropTargetType.DocumentPaneDockAsAnchorableRight: { if (layoutPanel != null && layoutPanel.ChildrenCount == 1) { layoutPanel.Orientation = Orientation.Horizontal; } if (layoutPanel == null || layoutPanel.Orientation != Orientation.Horizontal) { if (layoutPanel == null) { throw new NotImplementedException(); } LayoutPanel layoutPanel7 = new LayoutPanel() { Orientation = Orientation.Horizontal }; LayoutPanel layoutPanel8 = layoutPanel; if (layoutDocumentPaneGroup != null) { layoutElement4 = layoutDocumentPaneGroup; } else { layoutElement4 = model; } layoutPanel8.ReplaceChild(layoutElement4, layoutPanel7); ObservableCollection <ILayoutPanelElement> children2 = layoutPanel7.Children; if (layoutDocumentPaneGroup != null) { layoutPanelElement2 = layoutDocumentPaneGroup; } else { layoutPanelElement2 = model; } children2.Add(layoutPanelElement2); layoutPanel7.Children.Add(floatingWindow.RootPanel); break; } else { ObservableCollection <ILayoutPanelElement> observableCollection2 = layoutPanel.Children; LayoutPanel layoutPanel9 = layoutPanel; if (layoutDocumentPaneGroup != null) { layoutElement5 = layoutDocumentPaneGroup; } else { layoutElement5 = model; } observableCollection2.Insert(layoutPanel9.IndexOfChild(layoutElement5) + 1, floatingWindow.RootPanel); break; } } case DropTargetType.DocumentPaneDockAsAnchorableBottom: { if (layoutPanel != null && layoutPanel.ChildrenCount == 1) { layoutPanel.Orientation = Orientation.Vertical; } if (layoutPanel == null || layoutPanel.Orientation != Orientation.Vertical) { if (layoutPanel == null) { throw new NotImplementedException(); } LayoutPanel layoutPanel10 = new LayoutPanel() { Orientation = Orientation.Vertical }; LayoutPanel layoutPanel11 = layoutPanel; if (layoutDocumentPaneGroup != null) { layoutElement6 = layoutDocumentPaneGroup; } else { layoutElement6 = model; } layoutPanel11.ReplaceChild(layoutElement6, layoutPanel10); ObservableCollection <ILayoutPanelElement> children3 = layoutPanel10.Children; if (layoutDocumentPaneGroup != null) { layoutPanelElement3 = layoutDocumentPaneGroup; } else { layoutPanelElement3 = model; } children3.Add(layoutPanelElement3); layoutPanel10.Children.Add(floatingWindow.RootPanel); break; } else { ObservableCollection <ILayoutPanelElement> observableCollection3 = layoutPanel.Children; LayoutPanel layoutPanel12 = layoutPanel; if (layoutDocumentPaneGroup != null) { layoutElement7 = layoutDocumentPaneGroup; } else { layoutElement7 = model; } observableCollection3.Insert(layoutPanel12.IndexOfChild(layoutElement7) + 1, floatingWindow.RootPanel); break; } } } base.Drop(floatingWindow); }
protected override void Drop(LayoutAnchorableFloatingWindow floatingWindow) { ILayoutDocumentPane targetModel = _targetPane.Model as ILayoutDocumentPane; switch (Type) { case DropTargetType.DocumentPaneDockBottom: #region DropTargetType.DocumentPaneDockBottom { var parentModel = targetModel.Parent as LayoutDocumentPaneGroup; var newLayoutDocumentPane = new LayoutDocumentPane(); if (parentModel == null) { var parentContainer = targetModel.Parent as ILayoutContainer; var newParentModel = new LayoutDocumentPaneGroup() { Orientation = System.Windows.Controls.Orientation.Vertical }; parentContainer.ReplaceChild(targetModel, newParentModel); newParentModel.Children.Add(targetModel as LayoutDocumentPane); newParentModel.Children.Add(newLayoutDocumentPane); } else { var manager = parentModel.Root.Manager; if (!manager.AllowMixedOrientation || parentModel.Orientation == System.Windows.Controls.Orientation.Vertical) { parentModel.Orientation = System.Windows.Controls.Orientation.Vertical; int targetPaneIndex = parentModel.IndexOfChild(targetModel); parentModel.Children.Insert(targetPaneIndex + 1, newLayoutDocumentPane); } else { LayoutDocumentPaneGroup newChildGroup = new LayoutDocumentPaneGroup(); newChildGroup.Orientation = System.Windows.Controls.Orientation.Vertical; parentModel.ReplaceChild(targetModel, newChildGroup); newChildGroup.Children.Add(targetModel); newChildGroup.Children.Add(newLayoutDocumentPane); } } foreach (var cntToTransfer in floatingWindow.RootPanel.Descendents().OfType <LayoutAnchorable>().ToArray()) { newLayoutDocumentPane.Children.Add(cntToTransfer); } } break; #endregion case DropTargetType.DocumentPaneDockTop: #region DropTargetType.DocumentPaneDockTop { var parentModel = targetModel.Parent as LayoutDocumentPaneGroup; var newLayoutDocumentPane = new LayoutDocumentPane(); if (parentModel == null) { var parentContainer = targetModel.Parent as ILayoutContainer; var newParentModel = new LayoutDocumentPaneGroup() { Orientation = System.Windows.Controls.Orientation.Vertical }; parentContainer.ReplaceChild(targetModel, newParentModel); newParentModel.Children.Add(newLayoutDocumentPane); newParentModel.Children.Add(targetModel as LayoutDocumentPane); } else { var manager = parentModel.Root.Manager; if (!manager.AllowMixedOrientation || parentModel.Orientation == System.Windows.Controls.Orientation.Vertical) { parentModel.Orientation = System.Windows.Controls.Orientation.Vertical; int targetPaneIndex = parentModel.IndexOfChild(targetModel); parentModel.Children.Insert(targetPaneIndex, newLayoutDocumentPane); } else { LayoutDocumentPaneGroup newChildGroup = new LayoutDocumentPaneGroup(); newChildGroup.Orientation = System.Windows.Controls.Orientation.Vertical; parentModel.ReplaceChild(targetModel, newChildGroup); newChildGroup.Children.Add(newLayoutDocumentPane); newChildGroup.Children.Add(targetModel); } } foreach (var cntToTransfer in floatingWindow.RootPanel.Descendents().OfType <LayoutAnchorable>().ToArray()) { newLayoutDocumentPane.Children.Add(cntToTransfer); } } break; #endregion case DropTargetType.DocumentPaneDockLeft: #region DropTargetType.DocumentPaneDockLeft { var parentModel = targetModel.Parent as LayoutDocumentPaneGroup; var newLayoutDocumentPane = new LayoutDocumentPane(); if (parentModel == null) { var parentContainer = targetModel.Parent as ILayoutContainer; var newParentModel = new LayoutDocumentPaneGroup() { Orientation = System.Windows.Controls.Orientation.Horizontal }; parentContainer.ReplaceChild(targetModel, newParentModel); newParentModel.Children.Add(newLayoutDocumentPane); newParentModel.Children.Add(targetModel as LayoutDocumentPane); } else { var manager = parentModel.Root.Manager; if (!manager.AllowMixedOrientation || parentModel.Orientation == System.Windows.Controls.Orientation.Horizontal) { parentModel.Orientation = System.Windows.Controls.Orientation.Horizontal; int targetPaneIndex = parentModel.IndexOfChild(targetModel); parentModel.Children.Insert(targetPaneIndex, newLayoutDocumentPane); } else { LayoutDocumentPaneGroup newChildGroup = new LayoutDocumentPaneGroup(); newChildGroup.Orientation = System.Windows.Controls.Orientation.Horizontal; parentModel.ReplaceChild(targetModel, newChildGroup); newChildGroup.Children.Add(newLayoutDocumentPane); newChildGroup.Children.Add(targetModel); } } foreach (var cntToTransfer in floatingWindow.RootPanel.Descendents().OfType <LayoutAnchorable>().ToArray()) { newLayoutDocumentPane.Children.Add(cntToTransfer); } } break; #endregion case DropTargetType.DocumentPaneDockRight: #region DropTargetType.DocumentPaneDockRight { var parentModel = targetModel.Parent as LayoutDocumentPaneGroup; var newLayoutDocumentPane = new LayoutDocumentPane(); if (parentModel == null) { var parentContainer = targetModel.Parent as ILayoutContainer; var newParentModel = new LayoutDocumentPaneGroup() { Orientation = System.Windows.Controls.Orientation.Horizontal }; parentContainer.ReplaceChild(targetModel, newParentModel); newParentModel.Children.Add(targetModel as LayoutDocumentPane); newParentModel.Children.Add(newLayoutDocumentPane); } else { var manager = parentModel.Root.Manager; if (!manager.AllowMixedOrientation || parentModel.Orientation == System.Windows.Controls.Orientation.Horizontal) { parentModel.Orientation = System.Windows.Controls.Orientation.Horizontal; int targetPaneIndex = parentModel.IndexOfChild(targetModel); parentModel.Children.Insert(targetPaneIndex + 1, newLayoutDocumentPane); } else { LayoutDocumentPaneGroup newChildGroup = new LayoutDocumentPaneGroup(); newChildGroup.Orientation = System.Windows.Controls.Orientation.Horizontal; parentModel.ReplaceChild(targetModel, newChildGroup); newChildGroup.Children.Add(targetModel); newChildGroup.Children.Add(newLayoutDocumentPane); } } foreach (var cntToTransfer in floatingWindow.RootPanel.Descendents().OfType <LayoutAnchorable>().ToArray()) { newLayoutDocumentPane.Children.Add(cntToTransfer); } } break; #endregion case DropTargetType.DocumentPaneDockInside: #region DropTargetType.DocumentPaneDockInside { var paneModel = targetModel as LayoutDocumentPane; var layoutAnchorablePaneGroup = floatingWindow.RootPanel as LayoutAnchorablePaneGroup; bool checkPreviousContainer = true; int i = 0; if (_tabIndex != -1) { i = _tabIndex; checkPreviousContainer = false; } LayoutAnchorable anchorableToActivate = null; foreach (var anchorableToImport in layoutAnchorablePaneGroup.Descendents().OfType <LayoutAnchorable>().ToArray()) { if (checkPreviousContainer) { var previousContainer = (( ILayoutPreviousContainer )anchorableToImport).PreviousContainer; if (object.ReferenceEquals(previousContainer, targetModel) && (anchorableToImport.PreviousContainerIndex != -1)) { i = anchorableToImport.PreviousContainerIndex; } checkPreviousContainer = false; } if (anchorableToImport.CanClose) { anchorableToImport.SetCanCloseInternal(true); } paneModel.Children.Insert(Math.Min(i, paneModel.Children.Count), anchorableToImport); i++; anchorableToActivate = anchorableToImport; } anchorableToActivate.IsActive = true; } break; #endregion } base.Drop(floatingWindow); }
internal LayoutAnchorableFloatingWindowControl(LayoutAnchorableFloatingWindow model) : base(model) { this._model = model; this.HideWindowCommand = new RelayCommand((object p) => this.OnExecuteHideWindowCommand(p), (object p) => this.CanExecuteHideWindowCommand(p)); }
protected override void Drop(LayoutAnchorableFloatingWindow floatingWindow) { switch (Type) { case DropTargetType.DockingManagerDockLeft: #region DropTargetType.DockingManagerDockLeft { if (_manager.Layout.RootPanel.Orientation != System.Windows.Controls.Orientation.Horizontal && _manager.Layout.RootPanel.Children.Count == 1) { _manager.Layout.RootPanel.Orientation = System.Windows.Controls.Orientation.Horizontal; } if (_manager.Layout.RootPanel.Orientation == System.Windows.Controls.Orientation.Horizontal) { var layoutAnchorablePaneGroup = floatingWindow.RootPanel as LayoutAnchorablePaneGroup; if (layoutAnchorablePaneGroup != null && layoutAnchorablePaneGroup.Orientation == System.Windows.Controls.Orientation.Horizontal) { var childrenToTransfer = layoutAnchorablePaneGroup.Children.ToArray(); for (int i = 0; i < childrenToTransfer.Length; i++) { _manager.Layout.RootPanel.Children.Insert(i, childrenToTransfer[i]); } } else { _manager.Layout.RootPanel.Children.Insert(0, floatingWindow.RootPanel); } } else { var newOrientedPanel = new LayoutPanel() { Orientation = System.Windows.Controls.Orientation.Horizontal }; newOrientedPanel.Children.Add(floatingWindow.RootPanel); newOrientedPanel.Children.Add(_manager.Layout.RootPanel); _manager.Layout.RootPanel = newOrientedPanel; } } break; #endregion case DropTargetType.DockingManagerDockRight: #region DropTargetType.DockingManagerDockRight { if (_manager.Layout.RootPanel.Orientation != System.Windows.Controls.Orientation.Horizontal && _manager.Layout.RootPanel.Children.Count == 1) { _manager.Layout.RootPanel.Orientation = System.Windows.Controls.Orientation.Horizontal; } if (_manager.Layout.RootPanel.Orientation == System.Windows.Controls.Orientation.Horizontal) { var layoutAnchorablePaneGroup = floatingWindow.RootPanel as LayoutAnchorablePaneGroup; if (layoutAnchorablePaneGroup != null && layoutAnchorablePaneGroup.Orientation == System.Windows.Controls.Orientation.Horizontal) { var childrenToTransfer = layoutAnchorablePaneGroup.Children.ToArray(); for (int i = 0; i < childrenToTransfer.Length; i++) { _manager.Layout.RootPanel.Children.Add(childrenToTransfer[i]); } } else { _manager.Layout.RootPanel.Children.Add(floatingWindow.RootPanel); } } else { var newOrientedPanel = new LayoutPanel() { Orientation = System.Windows.Controls.Orientation.Horizontal }; newOrientedPanel.Children.Add(floatingWindow.RootPanel); newOrientedPanel.Children.Insert(0, _manager.Layout.RootPanel); _manager.Layout.RootPanel = newOrientedPanel; } } break; #endregion case DropTargetType.DockingManagerDockTop: #region DropTargetType.DockingManagerDockTop { if (_manager.Layout.RootPanel.Orientation != System.Windows.Controls.Orientation.Vertical && _manager.Layout.RootPanel.Children.Count == 1) { _manager.Layout.RootPanel.Orientation = System.Windows.Controls.Orientation.Vertical; } if (_manager.Layout.RootPanel.Orientation == System.Windows.Controls.Orientation.Vertical) { var layoutAnchorablePaneGroup = floatingWindow.RootPanel as LayoutAnchorablePaneGroup; if (layoutAnchorablePaneGroup != null && layoutAnchorablePaneGroup.Orientation == System.Windows.Controls.Orientation.Vertical) { var childrenToTransfer = layoutAnchorablePaneGroup.Children.ToArray(); for (int i = 0; i < childrenToTransfer.Length; i++) { _manager.Layout.RootPanel.Children.Insert(i, childrenToTransfer[i]); } } else { _manager.Layout.RootPanel.Children.Insert(0, floatingWindow.RootPanel); } } else { var newOrientedPanel = new LayoutPanel() { Orientation = System.Windows.Controls.Orientation.Vertical }; newOrientedPanel.Children.Add(floatingWindow.RootPanel); newOrientedPanel.Children.Add(_manager.Layout.RootPanel); _manager.Layout.RootPanel = newOrientedPanel; } } break; #endregion case DropTargetType.DockingManagerDockBottom: #region DropTargetType.DockingManagerDockBottom { if (_manager.Layout.RootPanel.Orientation != System.Windows.Controls.Orientation.Vertical && _manager.Layout.RootPanel.Children.Count == 1) { _manager.Layout.RootPanel.Orientation = System.Windows.Controls.Orientation.Vertical; } if (_manager.Layout.RootPanel.Orientation == System.Windows.Controls.Orientation.Vertical) { var layoutAnchorablePaneGroup = floatingWindow.RootPanel as LayoutAnchorablePaneGroup; if (layoutAnchorablePaneGroup != null && layoutAnchorablePaneGroup.Orientation == System.Windows.Controls.Orientation.Vertical) { var childrenToTransfer = layoutAnchorablePaneGroup.Children.ToArray(); for (int i = 0; i < childrenToTransfer.Length; i++) { _manager.Layout.RootPanel.Children.Add(childrenToTransfer[i]); } } else { _manager.Layout.RootPanel.Children.Add(floatingWindow.RootPanel); } } else { var newOrientedPanel = new LayoutPanel() { Orientation = System.Windows.Controls.Orientation.Vertical }; newOrientedPanel.Children.Add(floatingWindow.RootPanel); newOrientedPanel.Children.Insert(0, _manager.Layout.RootPanel); _manager.Layout.RootPanel = newOrientedPanel; } } break; #endregion } base.Drop(floatingWindow); }
protected virtual void Drop(LayoutAnchorableFloatingWindow floatingWindow) { }
internal LayoutAnchorableFloatingWindowControl(LayoutAnchorableFloatingWindow model) : this(model, false) { }
protected override void Drop(LayoutAnchorableFloatingWindow floatingWindow) { ILayoutDocumentPane targetModel = _targetPane.Model as ILayoutDocumentPane; switch (Type) { case DropTargetType.DocumentPaneDockBottom: #region DropTargetType.DocumentPaneDockBottom { var parentModel = targetModel.Parent as LayoutDocumentPaneGroup; var newLayoutDocumentPane = new LayoutDocumentPane(); if (parentModel == null) { var parentContainer = targetModel.Parent as ILayoutContainer; var newParentModel = new LayoutDocumentPaneGroup() { Orientation = System.Windows.Controls.Orientation.Vertical }; parentContainer.ReplaceChild(targetModel, newParentModel); newParentModel.Children.Add(targetModel as LayoutDocumentPane); newParentModel.Children.Add(newLayoutDocumentPane); } else { var manager = parentModel.Root.Manager; if (!manager.AllowMixedOrientation || parentModel.Orientation == System.Windows.Controls.Orientation.Vertical) { parentModel.Orientation = System.Windows.Controls.Orientation.Vertical; int targetPaneIndex = parentModel.IndexOfChild(targetModel); parentModel.Children.Insert(targetPaneIndex + 1, newLayoutDocumentPane); } else { LayoutDocumentPaneGroup newChildGroup = new LayoutDocumentPaneGroup(); newChildGroup.Orientation = System.Windows.Controls.Orientation.Vertical; parentModel.ReplaceChild(targetModel, newChildGroup); newChildGroup.Children.Add(targetModel); newChildGroup.Children.Add(newLayoutDocumentPane); } } foreach (var cntToTransfer in floatingWindow.RootPanel.Descendents().OfType <LayoutAnchorable>().ToArray()) { newLayoutDocumentPane.Children.Add(cntToTransfer); } } break; #endregion case DropTargetType.DocumentPaneDockTop: #region DropTargetType.DocumentPaneDockTop { var parentModel = targetModel.Parent as LayoutDocumentPaneGroup; var newLayoutDocumentPane = new LayoutDocumentPane(); if (parentModel == null) { var parentContainer = targetModel.Parent as ILayoutContainer; var newParentModel = new LayoutDocumentPaneGroup() { Orientation = System.Windows.Controls.Orientation.Vertical }; parentContainer.ReplaceChild(targetModel, newParentModel); newParentModel.Children.Add(newLayoutDocumentPane); newParentModel.Children.Add(targetModel as LayoutDocumentPane); } else { var manager = parentModel.Root.Manager; if (!manager.AllowMixedOrientation || parentModel.Orientation == System.Windows.Controls.Orientation.Vertical) { parentModel.Orientation = System.Windows.Controls.Orientation.Vertical; int targetPaneIndex = parentModel.IndexOfChild(targetModel); parentModel.Children.Insert(targetPaneIndex, newLayoutDocumentPane); } else { LayoutDocumentPaneGroup newChildGroup = new LayoutDocumentPaneGroup(); newChildGroup.Orientation = System.Windows.Controls.Orientation.Vertical; parentModel.ReplaceChild(targetModel, newChildGroup); newChildGroup.Children.Add(newLayoutDocumentPane); newChildGroup.Children.Add(targetModel); } } foreach (var cntToTransfer in floatingWindow.RootPanel.Descendents().OfType <LayoutAnchorable>().ToArray()) { newLayoutDocumentPane.Children.Add(cntToTransfer); } } break; #endregion case DropTargetType.DocumentPaneDockLeft: #region DropTargetType.DocumentPaneDockLeft { var parentModel = targetModel.Parent as LayoutDocumentPaneGroup; var newLayoutDocumentPane = new LayoutDocumentPane(); if (parentModel == null) { var parentContainer = targetModel.Parent as ILayoutContainer; var newParentModel = new LayoutDocumentPaneGroup() { Orientation = System.Windows.Controls.Orientation.Horizontal }; parentContainer.ReplaceChild(targetModel, newParentModel); newParentModel.Children.Add(newLayoutDocumentPane); newParentModel.Children.Add(targetModel as LayoutDocumentPane); } else { var manager = parentModel.Root.Manager; if (!manager.AllowMixedOrientation || parentModel.Orientation == System.Windows.Controls.Orientation.Horizontal) { parentModel.Orientation = System.Windows.Controls.Orientation.Horizontal; int targetPaneIndex = parentModel.IndexOfChild(targetModel); parentModel.Children.Insert(targetPaneIndex, newLayoutDocumentPane); } else { LayoutDocumentPaneGroup newChildGroup = new LayoutDocumentPaneGroup(); newChildGroup.Orientation = System.Windows.Controls.Orientation.Horizontal; parentModel.ReplaceChild(targetModel, newChildGroup); newChildGroup.Children.Add(newLayoutDocumentPane); newChildGroup.Children.Add(targetModel); } } foreach (var cntToTransfer in floatingWindow.RootPanel.Descendents().OfType <LayoutAnchorable>().ToArray()) { newLayoutDocumentPane.Children.Add(cntToTransfer); } } break; #endregion case DropTargetType.DocumentPaneDockRight: #region DropTargetType.DocumentPaneDockRight { var parentModel = targetModel.Parent as LayoutDocumentPaneGroup; var newLayoutDocumentPane = new LayoutDocumentPane(); if (parentModel == null) { var parentContainer = targetModel.Parent as ILayoutContainer; var newParentModel = new LayoutDocumentPaneGroup() { Orientation = System.Windows.Controls.Orientation.Horizontal }; parentContainer.ReplaceChild(targetModel, newParentModel); newParentModel.Children.Add(targetModel as LayoutDocumentPane); newParentModel.Children.Add(newLayoutDocumentPane); } else { var manager = parentModel.Root.Manager; if (!manager.AllowMixedOrientation || parentModel.Orientation == System.Windows.Controls.Orientation.Horizontal) { parentModel.Orientation = System.Windows.Controls.Orientation.Horizontal; int targetPaneIndex = parentModel.IndexOfChild(targetModel); parentModel.Children.Insert(targetPaneIndex + 1, newLayoutDocumentPane); } else { LayoutDocumentPaneGroup newChildGroup = new LayoutDocumentPaneGroup(); newChildGroup.Orientation = System.Windows.Controls.Orientation.Horizontal; parentModel.ReplaceChild(targetModel, newChildGroup); newChildGroup.Children.Add(targetModel); newChildGroup.Children.Add(newLayoutDocumentPane); } } foreach (var cntToTransfer in floatingWindow.RootPanel.Descendents().OfType <LayoutAnchorable>().ToArray()) { newLayoutDocumentPane.Children.Add(cntToTransfer); } } break; #endregion case DropTargetType.DocumentPaneDockInside: #region DropTargetType.DocumentPaneDockInside { var paneModel = targetModel as LayoutDocumentPane; var layoutAnchorablePaneGroup = floatingWindow.RootPanel as LayoutAnchorablePaneGroup; int i = _tabIndex == -1 ? 0 : _tabIndex; LayoutAnchorable anchorableToActivate = null; foreach (var anchorableToImport in layoutAnchorablePaneGroup.Descendents().OfType <LayoutAnchorable>().ToArray()) { paneModel.Children.Insert(i, anchorableToImport); i++; anchorableToActivate = anchorableToImport; } anchorableToActivate.IsActive = true; } break; #endregion } base.Drop(floatingWindow); }
internal LayoutAnchorableFloatingWindowControl(LayoutAnchorableFloatingWindow model) : base(model) { _model = model; HideWindowCommand = new Core.RelayCommand <ICommand>((p) => OnExecuteHideWindowCommand(p), (p) => CanExecuteHideWindowCommand(p)); }
protected override void Drop(LayoutAnchorableFloatingWindow floatingWindow) { ILayoutDocumentPane targetModel = _targetPane.Model as ILayoutDocumentPane; LayoutDocumentPaneGroup parentGroup; LayoutPanel parentGroupPanel; FindParentLayoutDocumentPane(targetModel, out parentGroup, out parentGroupPanel); switch (Type) { case DropTargetType.DocumentPaneDockAsAnchorableBottom: #region DropTargetType.DocumentPaneDockAsAnchorableBottom { if (parentGroupPanel != null && parentGroupPanel.ChildrenCount == 1) { parentGroupPanel.Orientation = System.Windows.Controls.Orientation.Vertical; } if (parentGroupPanel != null && parentGroupPanel.Orientation == System.Windows.Controls.Orientation.Vertical) { parentGroupPanel.Children.Insert( parentGroupPanel.IndexOfChild(parentGroup != null ? parentGroup : targetModel) + 1, floatingWindow.RootPanel); } else if (parentGroupPanel != null) { var newParentPanel = new LayoutPanel() { Orientation = System.Windows.Controls.Orientation.Vertical }; parentGroupPanel.ReplaceChild(parentGroup != null ? parentGroup : targetModel, newParentPanel); newParentPanel.Children.Add(parentGroup != null ? parentGroup : targetModel); newParentPanel.Children.Add(floatingWindow.RootPanel); } else { throw new NotImplementedException(); } } break; #endregion case DropTargetType.DocumentPaneDockAsAnchorableTop: #region DropTargetType.DocumentPaneDockAsAnchorableTop { if (parentGroupPanel != null && parentGroupPanel.ChildrenCount == 1) { parentGroupPanel.Orientation = System.Windows.Controls.Orientation.Vertical; } if (parentGroupPanel != null && parentGroupPanel.Orientation == System.Windows.Controls.Orientation.Vertical) { parentGroupPanel.Children.Insert( parentGroupPanel.IndexOfChild(parentGroup != null ? parentGroup : targetModel), floatingWindow.RootPanel); } else if (parentGroupPanel != null) { var newParentPanel = new LayoutPanel() { Orientation = System.Windows.Controls.Orientation.Vertical }; parentGroupPanel.ReplaceChild(parentGroup != null ? parentGroup : targetModel, newParentPanel); newParentPanel.Children.Add(parentGroup != null ? parentGroup : targetModel); newParentPanel.Children.Insert(0, floatingWindow.RootPanel); } else { throw new NotImplementedException(); } } break; #endregion case DropTargetType.DocumentPaneDockAsAnchorableLeft: #region DropTargetType.DocumentPaneDockAsAnchorableLeft { if (parentGroupPanel != null && parentGroupPanel.ChildrenCount == 1) { parentGroupPanel.Orientation = System.Windows.Controls.Orientation.Horizontal; } if (parentGroupPanel != null && parentGroupPanel.Orientation == System.Windows.Controls.Orientation.Horizontal) { parentGroupPanel.Children.Insert( parentGroupPanel.IndexOfChild(parentGroup != null ? parentGroup : targetModel), floatingWindow.RootPanel); } else if (parentGroupPanel != null) { var newParentPanel = new LayoutPanel() { Orientation = System.Windows.Controls.Orientation.Horizontal }; parentGroupPanel.ReplaceChild(parentGroup != null ? parentGroup : targetModel, newParentPanel); newParentPanel.Children.Add(parentGroup != null ? parentGroup : targetModel); newParentPanel.Children.Insert(0, floatingWindow.RootPanel); } else { throw new NotImplementedException(); } } break; #endregion case DropTargetType.DocumentPaneDockAsAnchorableRight: #region DropTargetType.DocumentPaneDockAsAnchorableRight { if (parentGroupPanel != null && parentGroupPanel.ChildrenCount == 1) { parentGroupPanel.Orientation = System.Windows.Controls.Orientation.Horizontal; } if (parentGroupPanel != null && parentGroupPanel.Orientation == System.Windows.Controls.Orientation.Horizontal) { parentGroupPanel.Children.Insert( parentGroupPanel.IndexOfChild(parentGroup != null ? parentGroup : targetModel) + 1, floatingWindow.RootPanel); } else if (parentGroupPanel != null) { var newParentPanel = new LayoutPanel() { Orientation = System.Windows.Controls.Orientation.Horizontal }; parentGroupPanel.ReplaceChild(parentGroup != null ? parentGroup : targetModel, newParentPanel); newParentPanel.Children.Add(parentGroup != null ? parentGroup : targetModel); newParentPanel.Children.Add(floatingWindow.RootPanel); } else { throw new NotImplementedException(); } } break; #endregion } base.Drop(floatingWindow); }
protected override void Drop(LayoutAnchorableFloatingWindow floatingWindow) { switch (base.Type) { case DropTargetType.DockingManagerDockLeft: { if (this._manager.Layout.RootPanel.Orientation != Orientation.Horizontal && this._manager.Layout.RootPanel.Children.Count == 1) { this._manager.Layout.RootPanel.Orientation = Orientation.Horizontal; } if (this._manager.Layout.RootPanel.Orientation != Orientation.Horizontal) { LayoutPanel layoutPanel = new LayoutPanel() { Orientation = Orientation.Horizontal }; layoutPanel.Children.Add(floatingWindow.RootPanel); layoutPanel.Children.Add(this._manager.Layout.RootPanel); this._manager.Layout.RootPanel = layoutPanel; break; } else { LayoutAnchorablePaneGroup rootPanel = floatingWindow.RootPanel; if (rootPanel == null || rootPanel.Orientation != Orientation.Horizontal) { this._manager.Layout.RootPanel.Children.Insert(0, floatingWindow.RootPanel); break; } else { ILayoutAnchorablePane[] array = rootPanel.Children.ToArray <ILayoutAnchorablePane>(); for (int i = 0; i < (int)array.Length; i++) { this._manager.Layout.RootPanel.Children.Insert(i, array[i]); } break; } } } case DropTargetType.DockingManagerDockTop: { if (this._manager.Layout.RootPanel.Orientation != Orientation.Vertical && this._manager.Layout.RootPanel.Children.Count == 1) { this._manager.Layout.RootPanel.Orientation = Orientation.Vertical; } if (this._manager.Layout.RootPanel.Orientation != Orientation.Vertical) { LayoutPanel layoutPanel1 = new LayoutPanel() { Orientation = Orientation.Vertical }; layoutPanel1.Children.Add(floatingWindow.RootPanel); layoutPanel1.Children.Add(this._manager.Layout.RootPanel); this._manager.Layout.RootPanel = layoutPanel1; break; } else { LayoutAnchorablePaneGroup layoutAnchorablePaneGroup = floatingWindow.RootPanel; if (layoutAnchorablePaneGroup == null || layoutAnchorablePaneGroup.Orientation != Orientation.Vertical) { this._manager.Layout.RootPanel.Children.Insert(0, floatingWindow.RootPanel); break; } else { ILayoutAnchorablePane[] layoutAnchorablePaneArray = layoutAnchorablePaneGroup.Children.ToArray <ILayoutAnchorablePane>(); for (int j = 0; j < (int)layoutAnchorablePaneArray.Length; j++) { this._manager.Layout.RootPanel.Children.Insert(j, layoutAnchorablePaneArray[j]); } break; } } } case DropTargetType.DockingManagerDockRight: { if (this._manager.Layout.RootPanel.Orientation != Orientation.Horizontal && this._manager.Layout.RootPanel.Children.Count == 1) { this._manager.Layout.RootPanel.Orientation = Orientation.Horizontal; } if (this._manager.Layout.RootPanel.Orientation != Orientation.Horizontal) { LayoutPanel layoutPanel2 = new LayoutPanel() { Orientation = Orientation.Horizontal }; layoutPanel2.Children.Add(this._manager.Layout.RootPanel); layoutPanel2.Children.Add(floatingWindow.RootPanel); this._manager.Layout.RootPanel = layoutPanel2; break; } else { LayoutAnchorablePaneGroup rootPanel1 = floatingWindow.RootPanel; if (rootPanel1 == null || rootPanel1.Orientation != Orientation.Horizontal) { this._manager.Layout.RootPanel.Children.Add(floatingWindow.RootPanel); break; } else { ILayoutAnchorablePane[] array1 = rootPanel1.Children.ToArray <ILayoutAnchorablePane>(); for (int k = 0; k < (int)array1.Length; k++) { this._manager.Layout.RootPanel.Children.Add(array1[k]); } break; } } } case DropTargetType.DockingManagerDockBottom: { if (this._manager.Layout.RootPanel.Orientation != Orientation.Vertical && this._manager.Layout.RootPanel.Children.Count == 1) { this._manager.Layout.RootPanel.Orientation = Orientation.Vertical; } if (this._manager.Layout.RootPanel.Orientation != Orientation.Vertical) { LayoutPanel layoutPanel3 = new LayoutPanel() { Orientation = Orientation.Vertical }; layoutPanel3.Children.Add(this._manager.Layout.RootPanel); layoutPanel3.Children.Add(floatingWindow.RootPanel); this._manager.Layout.RootPanel = layoutPanel3; break; } else { LayoutAnchorablePaneGroup layoutAnchorablePaneGroup1 = floatingWindow.RootPanel; if (layoutAnchorablePaneGroup1 == null || layoutAnchorablePaneGroup1.Orientation != Orientation.Vertical) { this._manager.Layout.RootPanel.Children.Add(floatingWindow.RootPanel); break; } else { ILayoutAnchorablePane[] layoutAnchorablePaneArray1 = layoutAnchorablePaneGroup1.Children.ToArray <ILayoutAnchorablePane>(); for (int l = 0; l < (int)layoutAnchorablePaneArray1.Length; l++) { this._manager.Layout.RootPanel.Children.Add(layoutAnchorablePaneArray1[l]); } break; } } } } base.Drop(floatingWindow); }