void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 1: this.dockManager = ((AvalonDock.DockingManager)(target)); return; case 2: this.SideBarExplorer = ((AvalonDock.DockablePane)(target)); return; case 3: this.MainComponentContainer = ((AvalonDock.DocumentPane)(target)); return; case 4: this.errorsContent = ((AvalonDock.DockableContent)(target)); return; case 5: this.output = ((AvalonDock.DockableContent)(target)); return; } this._contentLoaded = true; }
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 1: this.dockManager = ((AvalonDock.DockingManager)(target)); return; case 2: this.SideBarExplorer = ((AvalonDock.DockablePane)(target)); #line 7 "..\..\Panels.xaml" this.SideBarExplorer.SelectionChanged += new System.Windows.Controls.SelectionChangedEventHandler(this.SideBarExplorerSelectionChanged); #line default #line hidden return; case 3: this.MainComponentContainer = ((AvalonDock.DocumentPane)(target)); #line 8 "..\..\Panels.xaml" this.MainComponentContainer.SelectionChanged += new System.Windows.Controls.SelectionChangedEventHandler(this.MainComponentContainerSelectionChanged); #line default #line hidden return; case 4: this.BottomBar = ((AvalonDock.DockablePane)(target)); return; case 5: this.errorPane = ((AvalonDock.DockableContent)(target)); return; case 6: this.outputPane = ((AvalonDock.DockableContent)(target)); return; case 7: this.listView1 = ((System.Windows.Controls.ListView)(target)); return; } this._contentLoaded = true; }
static DockablePane FindChildDockablePane(UIElement parent, AnchorStyle desideredAnchor) { if (parent is DockablePane && ((DockablePane)parent).Anchor == desideredAnchor) { return(parent as DockablePane); } if (parent is ResizingPanel) { foreach (UIElement childObject in ((ResizingPanel)parent).Children) { DockablePane foundPane = FindChildDockablePane(childObject, desideredAnchor); if (foundPane != null) { return(foundPane); } } } return(null); }
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 1: #line 12 "..\..\..\Window1.xaml" ((System.Windows.Controls.MenuItem)(target)).Click += new System.Windows.RoutedEventHandler(this.MenuItem_Click); #line default #line hidden return; case 2: this.dockManager = ((AvalonDock.DockingManager)(target)); return; case 3: this.resizeScenarioPanel = ((AvalonDock.ResizingPanel)(target)); return; case 4: this.scenarioDocumentPane = ((AvalonDock.DocumentPane)(target)); return; case 5: this.messagesDockPane = ((AvalonDock.DockablePane)(target)); return; case 6: this.messagesPane = ((AvalonDock.DockableContent)(target)); return; case 7: this.txtMessages = ((System.Windows.Controls.TextBox)(target)); return; } this._contentLoaded = true; }
public FlyoutDockablePane(DockableContent content) { _referencedPane = content.ContainerPane as DockablePane; _manager = _referencedPane.GetManager(); //save current content position in container pane _arrayIndexPreviousPane = _referencedPane.Items.IndexOf(content); Anchor = _referencedPane.Anchor; //SetValue(ResizingPanel.ResizeWidthProperty, new GridLength(ResizingPanel.GetEffectiveSize(_referencedPane).Width)); //SetValue(ResizingPanel.ResizeHeightProperty, new GridLength(ResizingPanel.GetEffectiveSize(_referencedPane).Height)); this.Style = _referencedPane.Style; //remove content from container pane //and add content to my temporary pane _referencedPane.Items.RemoveAt(_arrayIndexPreviousPane); this.Items.Add(content); //select the single content in this pane SelectedItem = this.Items[0]; }
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 1: this.DockManager = ((AvalonDock.DockingManager)(target)); return; case 2: this.VerticalResizingPanel = ((AvalonDock.ResizingPanel)(target)); return; case 3: this.HorizontalResizingPanel = ((AvalonDock.ResizingPanel)(target)); return; case 4: this.DesignerDockablePane = ((AvalonDock.DocumentPane)(target)); return; case 5: this.Placeholder1 = ((AvalonDock.DockablePane)(target)); return; case 6: this.Placeholder2 = ((AvalonDock.DockablePane)(target)); return; case 7: this.TabsPane = ((AvalonDock.DockablePane)(target)); return; case 8: this.Status = ((System.Windows.Controls.TextBlock)(target)); return; } this._contentLoaded = true; }
//protected override void OnClosed(EventArgs e) //{ // base.OnClosed(e); // DockableContent[] cntsToClose = new DockableContent[HostedPane.Items.Count]; // HostedPane.Items.CopyTo(cntsToClose, 0); // foreach (DockableContent cntToClose in cntsToClose) // { // //HostedPane.CloseOrHide(HostedPane.Items[0] as DockableContent, ForcedClosing); // cntToClose.CloseOrHide(ForcedClosing); // } // Manager.UnregisterFloatingWindow(this); //} public override Pane ClonePane() { DockablePane paneToAnchor = new DockablePane(); ResizingPanel.SetEffectiveSize(paneToAnchor, new Size(Width, Height)); //if (HostedPane.Style != null) // paneToAnchor.Style = HostedPane.Style; int selectedIndex = HostedPane.SelectedIndex; //transfer contents from hosted pane in the floating window and //the new created dockable pane while (HostedPane.Items.Count > 0) { paneToAnchor.Items.Add( HostedPane.RemoveContent(0)); } paneToAnchor.SelectedIndex = selectedIndex; return(paneToAnchor); }
public FlyoutDockablePane(DockableContent content) { _referencedPane = content.ContainerPane as DockablePane; _manager = _referencedPane.GetManager(); //save current content position in container pane _arrayIndexPreviousPane = _referencedPane.Items.IndexOf(content); Anchor = _referencedPane.Anchor; //SetValue(ResizingPanel.ResizeWidthProperty, new GridLength(ResizingPanel.GetEffectiveSize(_referencedPane).Width)); //SetValue(ResizingPanel.ResizeHeightProperty, new GridLength(ResizingPanel.GetEffectiveSize(_referencedPane).Height)); Style = _referencedPane.Style; //remove content from container pane //and add content to my temporary pane _referencedPane.Items.RemoveAt(_arrayIndexPreviousPane); Items.Add(content); //select the single content in this pane SelectedItem = Items[0]; }
public override Pane ClonePane() { DockablePane paneToAnchor = new DockablePane(); //transfer the resizing panel sizes paneToAnchor.SetValue(ResizingPanel.ResizeWidthProperty, HostedPane.GetValue(ResizingPanel.ResizeWidthProperty)); paneToAnchor.SetValue(ResizingPanel.ResizeHeightProperty, HostedPane.GetValue(ResizingPanel.ResizeHeightProperty)); int selectedIndex = HostedPane.SelectedIndex; //transfer contents from hosted pane in the floating window and //the new created dockable pane while (HostedPane.Items.Count > 0) { paneToAnchor.Items.Add( HostedPane.RemoveContent(0)); } paneToAnchor.SelectedIndex = selectedIndex; return(paneToAnchor); }
public DockableContentStateAndPosition( DockableContent cntToSave) { ContainerPane = cntToSave.ContainerPane; if (ContainerPane != null) { ChildIndex = ContainerPane.Items.IndexOf(cntToSave); Width = Math.Max(ContainerPane.ActualWidth, 100.0); Height = Math.Max(ContainerPane.ActualHeight, 100.0); } else { Width = 100; Height = 100; } State = cntToSave.State; DockablePane dockablePane = ContainerPane as DockablePane; if (dockablePane != null) { Anchor = dockablePane.Anchor; } }
internal FloatingDockablePane(DockableFloatingWindow floatingWindow, DockablePane paneToTransfer) { _floatingWindow = floatingWindow; _paneToTransfer = paneToTransfer; }
void AttachStyleFromPane(DockablePane copyFromPane) { if (copyFromPane == null) return; //Binding bnd = new Binding("Style"); //bnd.Source = copyFromPane; //bnd.Mode = BindingMode.OneWay; //SetBinding(StyleProperty, bnd); }
public void Register( RenderWindowManager rwm ) { this.rwm = rwm; //var tabItem = new TabItem(); //tabItem.Header = "Pokus"; // var tabItems = TabControl.Items; var resHorizontalPanel = new ResizingPanel() { Orientation = Orientation.Horizontal }; var resVerticalPanel = new ResizingPanel() { Orientation = Orientation.Vertical }; /* OpenGLWindow tempGLWin = rwm.RenderWindows[0].GlWindows[0]; var wfh = new WindowsFormsHost(); wfh.Child = tempGLWin; var dockPane = new DockablePane(); var documentPane = new DocumentPane(); dockPane.Items.Add( new DockableContent() { Name = "classesContent", Title = "Classes" } ); */ var dockPane = new DockablePane(); var documentPane = new DocumentPane(); foreach ( var openglWindow in rwm.RenderWindows ) { var formHost = new WindowsFormsHost() { Child = openglWindow.GlWindows[0] }; documentPane.Items.Add ( new DocumentContent() { Content = formHost, Title = "a" } ); } //var a = new DocumentContent(); //a.Content = wfh; //a.Title = "Raycast"; //documentPane.Items.Add( a ); //documentPane.Items.Add( new DocumentContent() //{ // Title = "My Document!" //} ); //dockPane.Items.Add( new DockableContent() //{ // Name = "classesContent", // Title = "Logs", //} ); //var logDockPane = new DockablePane(); //logDockPane.Items.Add( new DockableContent() //{ // Name = "classesContent", // Title = "Logs", //} //); //resVerticalPanel.Children.Add( logDockPane ); ResizingPanel XXX = DockingManager.Content as ResizingPanel; XXX.Children.Add( dockPane ); XXX.Children.Add( documentPane ); //resHorizontalPanel.Children.Add( logDockPane); DockingManager.Content = XXX; }
internal void Drag(DockablePane dockablePane, Point point, Point offset) { if (CaptureMouse()) { var floatingWindow = new DockableFloatingWindow(this); floatingWindow.Content = dockablePane; floatingWindow.Owner = Window.GetWindow(this); Drag(floatingWindow, point, offset); } }
/// <summary> /// Show a dockable content in its container with a desidered state /// </summary> /// <param name="content">Content to show</param> /// <param name="desideredState">State desidered</param> /// <param name="desideredAnchor">Border to which anchor the newly created container pane</param> /// <remarks></remarks> internal void Show(DockableContent content, DockableContentState desideredState, AnchorStyle desideredAnchor) { Debug.WriteLine(string.Format("Show Content={0}, desideredState={1}, desideredAnchor={2}", content.Name, desideredState, desideredAnchor)); #region Dockable content if (desideredState == DockableContentState.Hidden)//??!!show hidden? Hide(content); if (content.State == DockableContentState.AutoHide) { //first redock the content (content.ContainerPane as DockablePane).ToggleAutoHide(); //then show it as desidered Show(content, desideredState, desideredAnchor); } else if (content.State == DockableContentState.Docked || content.State == DockableContentState.Document || content.State == DockableContentState.None) { if (content.ContainerPane == null || content.State == DockableContentState.None) { //Problem!? try to rescue if (content.State == DockableContentState.Docked || content.State == DockableContentState.None) { //find the the pane which the desidered anchor style //DockablePane foundPane = this.FindChildDockablePane(desideredAnchor != AnchorStyle.None ? desideredAnchor : AnchorStyle.Right); //first search for a pane with other contents (avoiding empty panes which are containers for hidden contents) ILinqToTree<DependencyObject> itemFound = new LogicalTreeAdapter(this).Descendants().FirstOrDefault(el => el.Item is DockablePane && (el.Item as DockablePane).Anchor == desideredAnchor && (el.Item as DockablePane).IsDocked); if (itemFound == null)//search for all panes (even empty) itemFound = new LogicalTreeAdapter(this).Descendants().FirstOrDefault(el => el.Item is DockablePane && (el.Item as DockablePane).Anchor == desideredAnchor && (el.Item as DockablePane).Items.Count == 0); DockablePane foundPane = itemFound != null ? itemFound.Item as DockablePane : null; if (foundPane != null) { content.SetStateToDock(); foundPane.Items.Add(content); var containerPanel = foundPane.Parent as ResizingPanel; if (containerPanel != null) containerPanel.InvalidateMeasure(); } else { //if no suitable pane was found create e new one on the fly if (content.ContainerPane != null) { content.ContainerPane.RemoveContent(content); } DockablePane pane = new DockablePane(); pane.Items.Add(content); Anchor(pane, desideredAnchor); } } else { //add to main document pane MainDocumentPane.Items.Add(content); } } if (content.ContainerPane.GetManager() == null) { //disconnect the parent pane from previous panel //((Panel)content.ContainerPane.Parent).Children.Remove(content.ContainerPane); if (content.ContainerPane.Parent != null) { ((Panel)content.ContainerPane.Parent).Children.Remove(content.ContainerPane); } Anchor(content.ContainerPane as DockablePane, desideredAnchor); } if (desideredState == DockableContentState.DockableWindow || desideredState == DockableContentState.FloatingWindow) { var floatingWindow = new DockableFloatingWindow(this); floatingWindow.Content = content; var mainWindow = Window.GetWindow(this); if (mainWindow.IsVisible) floatingWindow.Owner = mainWindow; //floatingWindow.WindowStartupLocation = WindowStartupLocation.CenterOwner; //if (content.Content != null) //{ // floatingWindow.Width = Math.Min(((FrameworkElement)content.Content).ActualWidth, ResizingPanel.GetResizeWidth(content.ContainerPane)); // floatingWindow.Height = Math.Min(((FrameworkElement)content.Content).ActualHeight, ResizingPanel.GetResizeHeight(content.ContainerPane)); //} //else ////{ // floatingWindow.Width = 400; // floatingWindow.Height = 400; //} floatingWindow.Show(); } else if (desideredState == DockableContentState.AutoHide) { var paneContainer = content.ContainerPane as DockablePane; Debug.Assert(paneContainer != null); if (paneContainer != null) paneContainer.ToggleAutoHide(); content.Activate(); } else if (desideredState == DockableContentState.Document) { DocumentPane docPane = MainDocumentPane; if (docPane != null) { docPane.Items.Add(content.DetachFromContainerPane()); docPane.SelectedItem = content; content.SetStateToDocument(); } } else { content.ContainerPane.SelectedItem = content; content.Activate(); DockablePane dockParent = content.ContainerPane as DockablePane; if (content.ActualWidth == 0.0 && ( dockParent.Anchor == AnchorStyle.Left || dockParent.Anchor == AnchorStyle.Right)) { ResizingPanel.SetResizeWidth(dockParent, new GridLength(200)); ResizingPanel.SetEffectiveSize(dockParent, new Size(200, 0.0)); } else if (content.ActualWidth == 0.0 && ( dockParent.Anchor == AnchorStyle.Top || dockParent.Anchor == AnchorStyle.Bottom)) { ResizingPanel.SetResizeHeight(dockParent, new GridLength(200)); ResizingPanel.SetEffectiveSize(dockParent, new Size(200, 0.0)); } } } else if (content.State == DockableContentState.Document) { if (content.ContainerPane != null) content.ContainerPane.SelectedItem = this; content.Activate(); } else if (content.State == DockableContentState.Hidden || content.State == DockableContentState.DockableWindow || content.State == DockableContentState.FloatingWindow) { if (content.State == DockableContentState.Hidden) { //Debug.Assert(HiddenContents.Contains(content)); //HiddenContents.Remove(content); } else { FloatingWindow floatingWindow = null; floatingWindow = (content.ContainerPane as FloatingDockablePane).FloatingWindow; content.DetachFromContainerPane(); if (floatingWindow.HostedPane.Items.Count == 0) floatingWindow.Close(); } if (desideredState == DockableContentState.Docked || desideredState == DockableContentState.AutoHide) { if (content.SavedStateAndPosition != null && content.SavedStateAndPosition.ContainerPane != null && content.SavedStateAndPosition.ChildIndex >= 0 && content.SavedStateAndPosition.ContainerPane.GetManager() == this && desideredState == DockableContentState.Docked) { //ok previous container pane is here.. Pane prevPane = content.SavedStateAndPosition.ContainerPane; if (content.SavedStateAndPosition.ChildIndex < prevPane.Items.Count) { prevPane.Items.Insert(content.SavedStateAndPosition.ChildIndex, content); } else { prevPane.Items.Add(content); } if (prevPane.Items.Count == 1) { if (!double.IsNaN(content.SavedStateAndPosition.Width) || !double.IsInfinity(content.SavedStateAndPosition.Width)) { ResizingPanel.SetResizeWidth(content, new GridLength(content.SavedStateAndPosition.Width)); } } DockablePane prevDockablePane = prevPane as DockablePane; if (prevDockablePane != null && prevDockablePane.IsAutoHidden) { prevDockablePane.ToggleAutoHide(); } content.SetStateToDock(); content.Activate(); (prevPane.Parent as UIElement).InvalidateMeasure(); } else { if (desideredAnchor == AnchorStyle.None && content.SavedStateAndPosition != null && content.SavedStateAndPosition.Anchor != AnchorStyle.None) desideredAnchor = content.SavedStateAndPosition.Anchor; if (desideredAnchor == AnchorStyle.None) desideredAnchor = AnchorStyle.Right; DockablePane foundPane = null; if (desideredState == DockableContentState.Docked) { //first not empty panes ILinqToTree<DependencyObject> itemFound = new LogicalTreeAdapter(this).Descendants().FirstOrDefault(el => el.Item is DockablePane && (el.Item as DockablePane).Anchor == desideredAnchor && (el.Item as DockablePane).IsDocked); if (itemFound == null)//look for all panes even empty itemFound = new LogicalTreeAdapter(this).Descendants().FirstOrDefault(el => el.Item is DockablePane && (el.Item as DockablePane).Anchor == desideredAnchor && (el.Item as DockablePane).Items.Count == 0); foundPane = itemFound != null ? itemFound.Item as DockablePane : null; } if (foundPane != null) { content.SetStateToDock(); foundPane.Items.Add(content); if ((foundPane.IsAutoHidden && desideredState == DockableContentState.Docked) || (!foundPane.IsAutoHidden && desideredState == DockableContentState.AutoHide)) foundPane.ToggleAutoHide(); } else { DockablePane newHostpane = new DockablePane(); newHostpane.Items.Add(content); if (desideredAnchor == AnchorStyle.Left || desideredAnchor == AnchorStyle.Right) { double w = 200; if (content.SavedStateAndPosition != null && !double.IsInfinity(content.SavedStateAndPosition.Width) && !double.IsNaN(content.SavedStateAndPosition.Width)) w = content.SavedStateAndPosition.Width; ResizingPanel.SetResizeWidth(newHostpane, new GridLength(w)); ResizingPanel.SetEffectiveSize(newHostpane, new Size(w, 0.0)); } else { double h = 200; if (content.SavedStateAndPosition != null && !double.IsInfinity(content.SavedStateAndPosition.Height) && !double.IsNaN(content.SavedStateAndPosition.Height)) h = content.SavedStateAndPosition.Height; ResizingPanel.SetResizeHeight(newHostpane, new GridLength(h)); ResizingPanel.SetEffectiveSize(newHostpane, new Size(0.0, h)); } Anchor(newHostpane, desideredAnchor); if (desideredState == DockableContentState.AutoHide) { ToggleAutoHide(newHostpane); } } } ActiveContent = content; } else if (desideredState == DockableContentState.DockableWindow || desideredState == DockableContentState.FloatingWindow) { DockablePane newHostpane = null; FloatingDockablePane prevHostpane = null; if (content.SavedStateAndPosition != null && content.SavedStateAndPosition.ContainerPane != null && content.SavedStateAndPosition.ContainerPane is FloatingDockablePane) { prevHostpane = content.SavedStateAndPosition.ContainerPane as FloatingDockablePane; if (!prevHostpane.Items.Contains(content)) prevHostpane.Items.Add(content); } else { newHostpane = new DockablePane(); newHostpane.Items.Add(content); } if (desideredState == DockableContentState.DockableWindow) content.SetStateToDockableWindow(); else if (desideredState == DockableContentState.FloatingWindow) content.SetStateToFloatingWindow(); if (prevHostpane != null) { //check to see if floating window that host prevHostPane is already loaded (hosting other contents) var floatingWindow = prevHostpane.Parent as DockableFloatingWindow; if (floatingWindow != null && floatingWindow.IsLoaded) { floatingWindow.Activate(); } else { floatingWindow = new DockableFloatingWindow(this); floatingWindow.Content = content; floatingWindow.WindowStartupLocation = WindowStartupLocation.Manual; floatingWindow.Top = prevHostpane.FloatingWindow.Top; floatingWindow.Left = prevHostpane.FloatingWindow.Left; floatingWindow.Width = prevHostpane.FloatingWindow.Width; floatingWindow.Height = prevHostpane.FloatingWindow.Height; //floatingWindow.Owner = Window.GetWindow(this); var mainWindow = Window.GetWindow(this); if (mainWindow.IsVisible) floatingWindow.Owner = mainWindow; //now I've created a new pane to host the hidden content //if a an hidden content is shown that has prevHostpane as saved pane //I want that it is relocated in this new pane that I've created right now var hiddenContents = DockableContents.Where(c => c.State == DockableContentState.Hidden).ToArray(); foreach (var hiddenContent in hiddenContents) { if (hiddenContent.SavedStateAndPosition.ContainerPane == prevHostpane) { hiddenContent.SavedStateAndPosition = new DockableContentStateAndPosition( (floatingWindow.Content as Pane), hiddenContent.SavedStateAndPosition.ChildIndex, hiddenContent.SavedStateAndPosition.Width, hiddenContent.SavedStateAndPosition.Height, hiddenContent.SavedStateAndPosition.Anchor, hiddenContent.SavedStateAndPosition.State); } } floatingWindow.Show(); } } else if (newHostpane != null) { var floatingWindow = new DockableFloatingWindow(this); floatingWindow.Content = newHostpane; floatingWindow.WindowStartupLocation = WindowStartupLocation.CenterScreen; floatingWindow.Width = 200; floatingWindow.Height = 500; //floatingWindow.Owner = Window.GetWindow(this); var mainWindow = Window.GetWindow(this); if (mainWindow.IsVisible) floatingWindow.Owner = mainWindow; floatingWindow.Show(); } } else if (desideredState == DockableContentState.Document) { DocumentPane docPane = MainDocumentPane; if (docPane != null) { docPane.Items.Add(content); docPane.SelectedItem = content; content.SetStateToDocument(); } } } #endregion }
protected override void Redock() { if (_previousPane != null) { if (_previousPane.GetManager() == null) { DockablePane newContainerPane = new DockablePane(); newContainerPane.Items.Add(HostedPane.RemoveContent(0)); newContainerPane.SetValue(ResizingPanel.ResizeWidthProperty, _previousPane.GetValue(ResizingPanel.ResizeWidthProperty)); newContainerPane.SetValue(ResizingPanel.ResizeHeightProperty, _previousPane.GetValue(ResizingPanel.ResizeHeightProperty)); if (_previousPane.Style != null) newContainerPane.Style = _previousPane.Style; Manager.Anchor(newContainerPane, ((DockablePane)_previousPane).Anchor); } else { if (_arrayIndexPreviousPane > _previousPane.Items.Count) _arrayIndexPreviousPane = _previousPane.Items.Count; DockableContent currentContent = HostedPane.Items[0] as DockableContent; _previousPane.Items.Insert(_arrayIndexPreviousPane, HostedPane.RemoveContent(0)); _previousPane.SelectedIndex = _arrayIndexPreviousPane; currentContent.SetStateToDock(); } this.Close(); } base.Redock(); }
public DockableFloatingWindow(DockingManager manager, DockablePane dockablePane) : this(manager) { //create a new temporary pane FloatingDockablePane pane = new FloatingDockablePane(this); //setup window size ManagedContent selectedContent = dockablePane.SelectedItem as ManagedContent; if (selectedContent != null && selectedContent.FloatingWindowSize.IsEmpty) selectedContent.FloatingWindowSize = new Size(dockablePane.ActualWidth, dockablePane.ActualHeight); if (selectedContent != null) { Width = selectedContent.FloatingWindowSize.Width; Height = selectedContent.FloatingWindowSize.Height; this.ResizeMode = selectedContent.FloatingResizeMode; } else { Width = dockablePane.ActualWidth; Height = dockablePane.ActualHeight; } //transfer the style from the original dockablepane pane.Style = dockablePane.Style; //Width = dockablePane.ActualWidth; //Height = dockablePane.ActualHeight; ////save current content position in container pane //pane.SetValue(ResizingPanel.ResizeWidthProperty, dockablePane.GetValue(ResizingPanel.ResizeWidthProperty)); //pane.SetValue(ResizingPanel.ResizeHeightProperty, dockablePane.GetValue(ResizingPanel.ResizeHeightProperty)); int selectedIndex = dockablePane.SelectedIndex; //remove contents from container pane and insert in hosted pane while (dockablePane.Items.Count > 0) { ManagedContent content = dockablePane.RemoveContent(0); //add content to my temporary pane pane.Items.Add(content); } //let templates access this pane HostedPane = pane; HostedPane.SelectedIndex = selectedIndex; //Change state on contents IsDockableWindow = true; }
/// <summary> /// Shows a pad. If it hasn't been shown before, it shows it /// docked to the right side. Otherwise it restores it to the /// previous place that it was before hiding. Doesn't work /// correctly for floating panes (yet). /// </summary> /// <param name="pad"></param> public void ShowPad(IPad pad) { if (!m_padLookup.ContainsKey(pad)) { DockableContent content = new DockableContent(); setManagedContentProperties(pad, content); m_padLookup.Add(pad, content); DockablePane dp = new DockablePane(); dp.Items.Add(content); m_resizingPanel.Children.Add(dp); pad.PropertyChanged += new PropertyChangedEventHandler(pad_PropertyChanged); content.GotFocus += new RoutedEventHandler(pad.OnGotFocus); content.LostFocus += new RoutedEventHandler(pad.OnLostFocus); } m_padLookup[pad].Show(DockManager); }
private void CreateOrUnhideDockableContent(ContentTypes contentType, string title, string viewPropertyName, object parent) { if (!this.dockableContents.Keys.Contains(contentType)) { DockableContent dockableContent = new DockableContent(); ContentControl contentControl = new ContentControl(); dockableContent.IsCloseable = true; dockableContent.HideOnClose = false; dockableContent.Title = title; dockableContent.Content = contentControl; if (parent is ResizingPanel) { DockablePane dockablePane = new DockablePane(); dockablePane.Items.Add(dockableContent); ResizingPanel resizingPanel = parent as ResizingPanel; switch (contentType) { case ContentTypes.PropertyInspector: resizingPanel.Children.Add(dockablePane); ResizingPanel.SetResizeWidth(dockablePane, new GridLength(300)); break; case ContentTypes.Outline: resizingPanel.Children.Insert(1, dockablePane); ResizingPanel.SetResizeWidth(dockablePane, new GridLength(250)); break; case ContentTypes.Toolbox: resizingPanel.Children.Insert(0, dockablePane); ResizingPanel.SetResizeWidth(dockablePane, new GridLength(250)); break; } } else if (parent is DockablePane) { DockablePane dockablePane = parent as DockablePane; dockablePane.Items.Add(dockableContent); if (dockablePane.Parent == null) { this.verticalResizingPanel.Children.Add(dockablePane); } } Binding dataContextBinding = new Binding(viewPropertyName); dockableContent.SetBinding(DockableContent.DataContextProperty, dataContextBinding); Binding contentBinding = new Binding("."); contentControl.SetBinding(ContentControl.ContentProperty, contentBinding); this.dockableContents[contentType] = dockableContent; dockableContent.Closed += delegate(object sender, EventArgs args) { contentControl.Content = null; this.dockableContents[contentType].DataContext = null; this.dockableContents.Remove(contentType); }; } else { if (this.dockableContents[contentType].State == DockableContentState.Hidden) { this.dockableContents[contentType].Show(); } } }
public MainWindowViewModel(DockingManager dockingManager, ResizingPanel horizontalResizingPanel, ResizingPanel verticalResizingPanel, DockablePane tabsPane) { this.dockingManager = dockingManager; dockingManager.ActiveDocumentChanged += delegate(object sender, EventArgs args) { this.UpdateViews(); }; this.toolboxControl = new ToolboxControl(); this.InitialiseToolbox(); this.horizontalResizingPanel = horizontalResizingPanel; this.verticalResizingPanel = verticalResizingPanel; this.tabsPane = tabsPane; this.dockableContents = new Dictionary<ContentTypes, DockableContent>(); this.ViewToolbox(); string disableDebugViewOutputValue = ConfigurationManager.AppSettings["DisableDebugViewOutput"]; if (!string.IsNullOrEmpty(disableDebugViewOutputValue)) { this.disableDebugViewOutput = bool.Parse(disableDebugViewOutputValue); } }
/// <summary> /// Remove a pane from border tab groups /// </summary> /// <param name="pane">Pane to remove</param> /// <returns>True if pane was removed, false otherwise</returns> bool RemovePaneFromTabGroups(DockablePane paneToRemove) { foreach (Panel anchorTabPanel in _anchorTabPanels) { foreach (DockablePaneAnchorTabGroup group in anchorTabPanel.Children) { if (group.ReferencedPane == paneToRemove) { anchorTabPanel.Children.Remove(group); return true; } } } return false; }
/// <summary> /// Internal main restore layout method /// </summary> /// <param name="doc">Document Xml from which restore layout</param> void RestoreLayout(XmlDocument doc) { if (!_isControlLoaded) throw new InvalidOperationException("Unable to deserialize a docking layout while DockingManager control is unloaded"); if (doc.DocumentElement == null || doc.DocumentElement.Name != "DockingManager") { Debug.Assert(false, "Layout file hasn't a valid structure!"); throw new InvalidOperationException("Layout file had not a valid structure!"); } if (doc.DocumentElement.GetAttribute("version") != layoutFileVersion) throw new FileFormatException("Unsupported layout file version"); if (doc.DocumentElement.ChildNodes.Count != 3 || (doc.DocumentElement.ChildNodes[0].Name != "ResizingPanel" && doc.DocumentElement.ChildNodes[0].Name != "DocumentPane") || doc.DocumentElement.ChildNodes[1].Name != "Hidden" || doc.DocumentElement.ChildNodes[2].Name != "Windows") { Debug.Assert(false, "Layout file hasn't a valid structure!"); throw new InvalidOperationException("Layout file hasn't a valid structure!"); } //Hide temp windows HideFlyoutWindow(); HideNavigatorWindow(); //HideDocumentNavigatorWindow(); RestoringLayout = true; //show all auto hidden panes var panesAutoHidden = DockableContents.Where(c => c.State == DockableContentState.AutoHide).Select(c => c.ContainerPane).Distinct(); foreach (DockablePane pane in panesAutoHidden) pane.ToggleAutoHide(); DockableContent[] actualContents = DockableContents.ToArray(); DocumentContent[] actualDocuments = Documents.ToArray(); //first detach all my actual contents this.Content = null; this.ActiveContent = null; this.ActiveDocument = null; //restore main panel XmlElement rootElement = doc.DocumentElement.ChildNodes[0] as XmlElement; DocumentPane mainDocumentPane = null; this.Content = RestoreLayout(rootElement, actualContents, actualDocuments, ref mainDocumentPane); MainDocumentPane = mainDocumentPane; //restore hidden contents foreach (XmlElement hiddenContentElement in doc.DocumentElement.ChildNodes[1].ChildNodes) { var hiddenContentName = hiddenContentElement.GetAttribute("Name"); var hiddenContent = actualContents.FirstOrDefault(c => c.Name == hiddenContentName && c.State != DockableContentState.Hidden); if (hiddenContent != null) { Hide(hiddenContent); hiddenContent.RestoreLayout(hiddenContentElement); } } //restore floating windows foreach (XmlElement flWindowElement in doc.DocumentElement.ChildNodes[2].ChildNodes) { if (flWindowElement.ChildNodes.Count != 1) continue;//handles invalid layouts structures bool isDockableWindow = XmlConvert.ToBoolean(flWindowElement.GetAttribute("IsDockableWindow")); Point location = new Point(XmlConvert.ToDouble(flWindowElement.GetAttribute("Left")), XmlConvert.ToDouble(flWindowElement.GetAttribute("Top"))); Size size = new Size(XmlConvert.ToDouble(flWindowElement.GetAttribute("Width")), XmlConvert.ToDouble(flWindowElement.GetAttribute("Height"))); XmlElement paneElement = flWindowElement.ChildNodes[0] as XmlElement; DockablePane paneForFloatingWindow = new DockablePane(); if (paneElement.HasAttribute("ResizingWidth")) ResizingPanel.SetResizeWidth(paneForFloatingWindow, (GridLength)GLConverter.ConvertFromInvariantString(paneElement.GetAttribute("ResizeWidth"))); if (paneElement.HasAttribute("ResizingHeight")) ResizingPanel.SetResizeHeight(paneForFloatingWindow, (GridLength)GLConverter.ConvertFromInvariantString(paneElement.GetAttribute("ResizeHeight"))); paneForFloatingWindow.Anchor = (AnchorStyle)Enum.Parse(typeof(AnchorStyle), paneElement.GetAttribute("Anchor")); DockableContent contentToTransfer = null; foreach (XmlElement contentElement in paneElement.ChildNodes) { #region Find the content to transfer string contentToFindName = contentElement.GetAttribute("Name"); contentToTransfer = actualContents.FirstOrDefault(c => c.Name == contentToFindName); if (contentToTransfer == null && DeserializationCallback != null) { DeserializationCallbackEventArgs e = new DeserializationCallbackEventArgs(contentToFindName); DeserializationCallback(this, e); contentToTransfer = e.Content as DockableContent; } #endregion if (contentToTransfer != null) { DetachContentFromDockingManager(contentToTransfer); paneForFloatingWindow.Items.Add(contentToTransfer); contentToTransfer.RestoreLayout(contentElement); } } if (paneForFloatingWindow.Items.Count > 0) { var flWindow = new DockableFloatingWindow(this); flWindow.Content = paneForFloatingWindow; flWindow.Left = location.X; flWindow.Top = location.Y; flWindow.Width = size.Width; flWindow.Height = size.Height; flWindow.Owner = Window.GetWindow(this); flWindow.IsDockableWindow = isDockableWindow; flWindow.ShowActivated = false; flWindow.ApplyTemplate(); flWindow.Show(); } } ClearEmptyPanels(Content as ResizingPanel); //get documents that are not present in last layout and must be included //in the new one var documentsNotTransferred = actualDocuments.Where(d => d.ContainerPane == null || d.ContainerPane.GetManager() != this).ToArray(); Debug.Assert(MainDocumentPane != null && MainDocumentPane.GetManager() == this); if (MainDocumentPane != null && documentsNotTransferred.Count() > 0) { documentsNotTransferred.ForEach(d => MainDocumentPane.Items.Add(d.DetachFromContainerPane())); } //get contents that are not present in the new layout and hide them var contentsNotTransferred = actualContents.Where(c => c.ContainerPane == null || c.ContainerPane.GetManager() != this).ToArray(); contentsNotTransferred.ForEach(c => { Hide(c); }); RestoringLayout = false; ClearEmptyPanes(); RefreshContents(); if (ActiveDocument != null && (ActiveDocument.ContainerPane == null || ActiveDocument.ContainerPane.GetManager() != this)) { if (Documents.Count > 0) ActiveDocument = Documents[0]; else ActiveDocument = null; } ActiveContent = ActiveDocument; }
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 1: #line 6 "..\..\..\MainWindow.xaml" ((CAGA.MainWindow)(target)).Loaded += new System.Windows.RoutedEventHandler(this.Window_Loaded); #line default #line hidden #line 6 "..\..\..\MainWindow.xaml" ((CAGA.MainWindow)(target)).Closing += new System.ComponentModel.CancelEventHandler(this.RibbonWindow_Closing); #line default #line hidden return; case 2: this.mainGrid = ((System.Windows.Controls.Grid)(target)); return; case 3: this.ribbon = ((Microsoft.Windows.Controls.Ribbon.Ribbon)(target)); return; case 4: this.RibbonMapGrp = ((Microsoft.Windows.Controls.Ribbon.RibbonGroup)(target)); return; case 5: this.OpenMapBtn = ((Microsoft.Windows.Controls.Ribbon.RibbonButton)(target)); #line 24 "..\..\..\MainWindow.xaml" this.OpenMapBtn.Click += new System.Windows.RoutedEventHandler(this.OpenMapBtn_Click); #line default #line hidden return; case 6: this.SaveMapBtn = ((Microsoft.Windows.Controls.Ribbon.RibbonButton)(target)); #line 25 "..\..\..\MainWindow.xaml" this.SaveMapBtn.Click += new System.Windows.RoutedEventHandler(this.SaveMapBtn_Click); #line default #line hidden return; case 7: this.RibbonLayersGrp = ((Microsoft.Windows.Controls.Ribbon.RibbonGroup)(target)); return; case 8: this.AddLayerBtn = ((Microsoft.Windows.Controls.Ribbon.RibbonButton)(target)); #line 29 "..\..\..\MainWindow.xaml" this.AddLayerBtn.Click += new System.Windows.RoutedEventHandler(this.AddLayerBtn_Click); #line default #line hidden return; case 9: this.RemoveLayerBtn = ((Microsoft.Windows.Controls.Ribbon.RibbonButton)(target)); #line 30 "..\..\..\MainWindow.xaml" this.RemoveLayerBtn.Click += new System.Windows.RoutedEventHandler(this.RemoveLayerBtn_Click); #line default #line hidden return; case 10: this.RibbonNavGrp = ((Microsoft.Windows.Controls.Ribbon.RibbonGroup)(target)); return; case 11: this.PanMapBtn = ((Microsoft.Windows.Controls.Ribbon.RibbonToggleButton)(target)); #line 33 "..\..\..\MainWindow.xaml" this.PanMapBtn.Checked += new System.Windows.RoutedEventHandler(this.PanMapBtn_Checked); #line default #line hidden #line 33 "..\..\..\MainWindow.xaml" this.PanMapBtn.Unchecked += new System.Windows.RoutedEventHandler(this.PanMapBtn_Unchecked); #line default #line hidden return; case 12: this.ZoomInBtn = ((Microsoft.Windows.Controls.Ribbon.RibbonToggleButton)(target)); #line 34 "..\..\..\MainWindow.xaml" this.ZoomInBtn.Checked += new System.Windows.RoutedEventHandler(this.ZoomInBtn_Checked); #line default #line hidden #line 34 "..\..\..\MainWindow.xaml" this.ZoomInBtn.Unchecked += new System.Windows.RoutedEventHandler(this.ZoomInBtn_Unchecked); #line default #line hidden return; case 13: this.ZoomOutBtn = ((Microsoft.Windows.Controls.Ribbon.RibbonToggleButton)(target)); #line 35 "..\..\..\MainWindow.xaml" this.ZoomOutBtn.Checked += new System.Windows.RoutedEventHandler(this.ZoomOutBtn_Checked); #line default #line hidden #line 35 "..\..\..\MainWindow.xaml" this.ZoomOutBtn.Unchecked += new System.Windows.RoutedEventHandler(this.ZoomOutBtn_Unchecked); #line default #line hidden return; case 14: this.ZoomToExtentBtn = ((Microsoft.Windows.Controls.Ribbon.RibbonButton)(target)); #line 36 "..\..\..\MainWindow.xaml" this.ZoomToExtentBtn.Click += new System.Windows.RoutedEventHandler(this.ZoomToExtentBtn_Click); #line default #line hidden return; case 15: this.ZoomToPrevBtn = ((Microsoft.Windows.Controls.Ribbon.RibbonButton)(target)); #line 37 "..\..\..\MainWindow.xaml" this.ZoomToPrevBtn.Click += new System.Windows.RoutedEventHandler(this.ZoomToPrevBtn_Click); #line default #line hidden return; case 16: this.ZoomToNextBtn = ((Microsoft.Windows.Controls.Ribbon.RibbonButton)(target)); #line 38 "..\..\..\MainWindow.xaml" this.ZoomToNextBtn.Click += new System.Windows.RoutedEventHandler(this.ZoomToNextBtn_Click); #line default #line hidden return; case 17: this.ZoomToLayerBtn = ((Microsoft.Windows.Controls.Ribbon.RibbonButton)(target)); #line 39 "..\..\..\MainWindow.xaml" this.ZoomToLayerBtn.Click += new System.Windows.RoutedEventHandler(this.ZoomToLayerBtn_Click); #line default #line hidden return; case 18: this.RibbonSelectionGrp = ((Microsoft.Windows.Controls.Ribbon.RibbonGroup)(target)); return; case 19: this.SelectFeatureBtn = ((Microsoft.Windows.Controls.Ribbon.RibbonSplitButton)(target)); #line 42 "..\..\..\MainWindow.xaml" this.SelectFeatureBtn.Click += new System.Windows.RoutedEventHandler(this.SelectFeatureBtn_Click); #line default #line hidden return; case 20: this.SelectFeatureGallery = ((Microsoft.Windows.Controls.Ribbon.RibbonGallery)(target)); return; case 21: this.SelByRectItem = ((Microsoft.Windows.Controls.Ribbon.RibbonGalleryItem)(target)); #line 45 "..\..\..\MainWindow.xaml" this.SelByRectItem.Selected += new System.Windows.RoutedEventHandler(this.SelectFeatureItem_Selected); #line default #line hidden return; case 22: this.SelByPolyItem = ((Microsoft.Windows.Controls.Ribbon.RibbonGalleryItem)(target)); #line 46 "..\..\..\MainWindow.xaml" this.SelByPolyItem.Selected += new System.Windows.RoutedEventHandler(this.SelectFeatureItem_Selected); #line default #line hidden return; case 23: this.SelByCircleItem = ((Microsoft.Windows.Controls.Ribbon.RibbonGalleryItem)(target)); #line 47 "..\..\..\MainWindow.xaml" this.SelByCircleItem.Selected += new System.Windows.RoutedEventHandler(this.SelectFeatureItem_Selected); #line default #line hidden return; case 24: this.SelByLineItem = ((Microsoft.Windows.Controls.Ribbon.RibbonGalleryItem)(target)); #line 48 "..\..\..\MainWindow.xaml" this.SelByLineItem.Selected += new System.Windows.RoutedEventHandler(this.SelectFeatureItem_Selected); #line default #line hidden return; case 25: this.SelectByGraphicsBtn = ((Microsoft.Windows.Controls.Ribbon.RibbonButton)(target)); #line 52 "..\..\..\MainWindow.xaml" this.SelectByGraphicsBtn.Click += new System.Windows.RoutedEventHandler(this.SelectByGraphicsBtn_Click); #line default #line hidden return; case 26: this.UnselectFeatureBtn = ((Microsoft.Windows.Controls.Ribbon.RibbonButton)(target)); #line 53 "..\..\..\MainWindow.xaml" this.UnselectFeatureBtn.Click += new System.Windows.RoutedEventHandler(this.UnselectFeatureBtn_Click); #line default #line hidden return; case 27: this.RibbonToolsGrp = ((Microsoft.Windows.Controls.Ribbon.RibbonGroup)(target)); return; case 28: this.IdentifyFeatureBtn = ((Microsoft.Windows.Controls.Ribbon.RibbonToggleButton)(target)); #line 56 "..\..\..\MainWindow.xaml" this.IdentifyFeatureBtn.Checked += new System.Windows.RoutedEventHandler(this.IdentifyFeatureBtn_Checked); #line default #line hidden #line 56 "..\..\..\MainWindow.xaml" this.IdentifyFeatureBtn.Unchecked += new System.Windows.RoutedEventHandler(this.IdentifyFeatureBtn_Unchecked); #line default #line hidden return; case 29: this.AttrTableBtn = ((Microsoft.Windows.Controls.Ribbon.RibbonButton)(target)); #line 57 "..\..\..\MainWindow.xaml" this.AttrTableBtn.Click += new System.Windows.RoutedEventHandler(this.AttrTableBtn_Click); #line default #line hidden return; case 30: this.RibbonDrawingGrp = ((Microsoft.Windows.Controls.Ribbon.RibbonGroup)(target)); return; case 31: this.DrawPolygonBtn = ((Microsoft.Windows.Controls.Ribbon.RibbonToggleButton)(target)); #line 60 "..\..\..\MainWindow.xaml" this.DrawPolygonBtn.Checked += new System.Windows.RoutedEventHandler(this.DrawPolygonBtn_Checked); #line default #line hidden #line 60 "..\..\..\MainWindow.xaml" this.DrawPolygonBtn.Unchecked += new System.Windows.RoutedEventHandler(this.DrawPolygonBtn_Unchecked); #line default #line hidden return; case 32: this.RibbonDlgMgrGrp = ((Microsoft.Windows.Controls.Ribbon.RibbonGroup)(target)); return; case 33: this.ToggleDlgBtn = ((Microsoft.Windows.Controls.Ribbon.RibbonButton)(target)); #line 66 "..\..\..\MainWindow.xaml" this.ToggleDlgBtn.Click += new System.Windows.RoutedEventHandler(this.ToggleDlgBtn_Click); #line default #line hidden return; case 34: this.RibbonSpeechRecGrp = ((Microsoft.Windows.Controls.Ribbon.RibbonGroup)(target)); return; case 35: this.ToggleSpeechBtn = ((Microsoft.Windows.Controls.Ribbon.RibbonButton)(target)); #line 69 "..\..\..\MainWindow.xaml" this.ToggleSpeechBtn.Click += new System.Windows.RoutedEventHandler(this.ToggleSpeechBtn_Click); #line default #line hidden return; case 36: this.SimSpeechBtn = ((Microsoft.Windows.Controls.Ribbon.RibbonButton)(target)); #line 70 "..\..\..\MainWindow.xaml" this.SimSpeechBtn.Click += new System.Windows.RoutedEventHandler(this.SimSpeechBtn_Click); #line default #line hidden return; case 37: this.dockManager = ((AvalonDock.DockingManager)(target)); return; case 38: this.LayersPanel = ((AvalonDock.DockableContent)(target)); return; case 39: this.tocGrid = ((System.Windows.Controls.Grid)(target)); return; case 40: #line 84 "..\..\..\MainWindow.xaml" ((AvalonDock.DocumentPane)(target)).SelectionChanged += new System.Windows.Controls.SelectionChangedEventHandler(this.DocumentPane_SelectionChanged); #line default #line hidden return; case 41: this.MapPanel = ((AvalonDock.DocumentContent)(target)); return; case 42: this.mapGrid = ((System.Windows.Controls.Grid)(target)); return; case 43: this.LayoutPanel = ((AvalonDock.DocumentContent)(target)); return; case 44: this.layoutGrid = ((System.Windows.Controls.Grid)(target)); return; case 45: this.KinectCtrlPanel = ((AvalonDock.DockablePane)(target)); return; case 46: this.ColorDisplayPanel = ((AvalonDock.DockableContent)(target)); return; case 47: this.colorDisplay = ((System.Windows.Controls.Image)(target)); return; case 48: this.skeletonCanvas = ((System.Windows.Controls.Canvas)(target)); return; case 49: this.DepthDisplayPanel = ((AvalonDock.DockableContent)(target)); return; case 50: this.depthDisplay = ((System.Windows.Controls.Image)(target)); return; case 51: this.DevCtrlPanel = ((AvalonDock.DockablePane)(target)); return; case 52: this.statusTB = ((System.Windows.Controls.TextBlock)(target)); return; } this._contentLoaded = true; }
/// <summary> /// Anchor a dockable pane to a border /// </summary> /// <param name="paneToAnchor"></param> /// <param name="anchor"></param> public void Anchor(DockablePane paneToAnchor, AnchorStyle anchor) { //ensure that content property is not empty EnsureContentNotEmpty(); if (Content == null) return; //remove the pane from its original children collection FrameworkElement parentElement = paneToAnchor.Parent as FrameworkElement; if (anchor == AnchorStyle.None) anchor = AnchorStyle.Right; //Change anchor border according to FlowDirection if (FlowDirection == FlowDirection.RightToLeft) { if (anchor == AnchorStyle.Right) anchor = AnchorStyle.Left; else if (anchor == AnchorStyle.Left) anchor = AnchorStyle.Right; } //parentElement should be a DockingManager or a ResizingPanel if (parentElement is ContentControl) { ((ContentControl)parentElement).Content = null; } //and insert in the top level panel if exist ResizingPanel toplevelPanel = Content as ResizingPanel; if (toplevelPanel != null && toplevelPanel.Children.Count == 0) { Content = null; toplevelPanel = null; } Orientation requestedOrientation = (anchor == AnchorStyle.Bottom || anchor == AnchorStyle.Top) ? Orientation.Vertical : Orientation.Horizontal; //if toplevel panel contains only one child then just override the orientation //as requested if (toplevelPanel != null && toplevelPanel.Children.Count == 1) toplevelPanel.Orientation = requestedOrientation; if (toplevelPanel == null || toplevelPanel.Orientation != requestedOrientation) { //if toplevel panel doesn't exist or it has not the correct orientation //we have to create a new one and set it as content of docking manager toplevelPanel = new ResizingPanel(); toplevelPanel.Orientation = requestedOrientation; FrameworkElement contentElement = Content as FrameworkElement; _allowRefreshContents = false; Content = null; if (anchor == AnchorStyle.Left || anchor == AnchorStyle.Top) { toplevelPanel.Children.Add(paneToAnchor); toplevelPanel.InsertChildRelativeTo(contentElement, paneToAnchor, true); } else { toplevelPanel.Children.Add(paneToAnchor); toplevelPanel.InsertChildRelativeTo(contentElement, paneToAnchor, false); } _allowRefreshContents = true; Content = toplevelPanel; } else { //here we have a docking manager content with the right orientation //so we have only to insert new child at correct position if (anchor == AnchorStyle.Left || anchor == AnchorStyle.Top) { //add new child before first one (prepend) toplevelPanel.InsertChildRelativeTo(paneToAnchor, toplevelPanel.Children[0] as FrameworkElement, false); } else { //add new child after last one (append) toplevelPanel.InsertChildRelativeTo(paneToAnchor, toplevelPanel.Children[toplevelPanel.Children.Count - 1] as FrameworkElement, true); } } //Refresh anchor style DockablePane paneToAnchorAsDockablePane = paneToAnchor as DockablePane; if (paneToAnchorAsDockablePane != null) { paneToAnchorAsDockablePane.Anchor = anchor; } if (anchor == AnchorStyle.Left || anchor == AnchorStyle.Right) { double w = Math.Min( ActualWidth / 2.0, ResizingPanel.GetEffectiveSize(paneToAnchor).Width); ResizingPanel.SetResizeWidth(paneToAnchor, new GridLength(w, GridUnitType.Pixel)); ResizingPanel.SetResizeHeight(paneToAnchor, new GridLength(1.0, GridUnitType.Star)); } else { double h = Math.Min( ActualHeight / 2.0, ResizingPanel.GetEffectiveSize(paneToAnchor).Height); ResizingPanel.SetResizeWidth(paneToAnchor, new GridLength(1.0, GridUnitType.Star)); ResizingPanel.SetResizeHeight(paneToAnchor, new GridLength(h, GridUnitType.Pixel)); } //refresh contents state paneToAnchor.Items.OfType<DockableContent>().ForEach(dc => { dc.SetStateToDock(); }); //paneToAnchor.Focus(); toplevelPanel.InvalidateMeasure(); }
internal void DropInto(DockablePane paneDragged, DockablePane paneToDropInto) { //transfer tha contents of dragged pane (conatined in a FloatingWindow) //to the pane which user select, taking care of setting contents state //to Dock (using Dock() method of class DockablePane). while (paneDragged.Items.Count > 0) { ManagedContent contentToTransfer = paneDragged.RemoveContent(0); paneToDropInto.Items.Add(contentToTransfer); DockableContent dockContentToTransfer = contentToTransfer as DockableContent; if (dockContentToTransfer != null) dockContentToTransfer.SetStateToDock(); } paneToDropInto.SelectedIndex = paneToDropInto.Items.Count - 1; //paneToDropInto.Focus(); }
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 1: #line 22 "..\..\MainWindow.xaml" ((Novartis.Msi.MSImageView.MainWindow)(target)).Closing += new System.ComponentModel.CancelEventHandler(this.WindowClosing); #line default #line hidden #line 22 "..\..\MainWindow.xaml" ((Novartis.Msi.MSImageView.MainWindow)(target)).Closed += new System.EventHandler(this.WindowClosed); #line default #line hidden #line 22 "..\..\MainWindow.xaml" ((Novartis.Msi.MSImageView.MainWindow)(target)).Loaded += new System.Windows.RoutedEventHandler(this.WindowLoaded); #line default #line hidden #line 22 "..\..\MainWindow.xaml" ((Novartis.Msi.MSImageView.MainWindow)(target)).Initialized += new System.EventHandler(this.WindowInitialized); #line default #line hidden return; case 2: #line 26 "..\..\MainWindow.xaml" ((System.Windows.Input.CommandBinding)(target)).Executed += new System.Windows.Input.ExecutedRoutedEventHandler(this.OnCmdOpen); #line default #line hidden return; case 3: #line 27 "..\..\MainWindow.xaml" ((System.Windows.Input.CommandBinding)(target)).Executed += new System.Windows.Input.ExecutedRoutedEventHandler(this.OnCmdSaveAs); #line default #line hidden #line 27 "..\..\MainWindow.xaml" ((System.Windows.Input.CommandBinding)(target)).CanExecute += new System.Windows.Input.CanExecuteRoutedEventHandler(this.CanExecuteCmdSaveAs); #line default #line hidden return; case 4: #line 28 "..\..\MainWindow.xaml" ((System.Windows.Input.CommandBinding)(target)).Executed += new System.Windows.Input.ExecutedRoutedEventHandler(this.OnCmdExit); #line default #line hidden return; case 5: #line 29 "..\..\MainWindow.xaml" ((System.Windows.Input.CommandBinding)(target)).Executed += new System.Windows.Input.ExecutedRoutedEventHandler(this.OnCmdAbout); #line default #line hidden return; case 6: #line 30 "..\..\MainWindow.xaml" ((System.Windows.Input.CommandBinding)(target)).Executed += new System.Windows.Input.ExecutedRoutedEventHandler(this.OnCmdToggleToolTips); #line default #line hidden return; case 7: #line 31 "..\..\MainWindow.xaml" ((System.Windows.Input.CommandBinding)(target)).Executed += new System.Windows.Input.ExecutedRoutedEventHandler(this.OnCmdUseApproximation); #line default #line hidden return; case 8: #line 32 "..\..\MainWindow.xaml" ((System.Windows.Input.CommandBinding)(target)).Executed += new System.Windows.Input.ExecutedRoutedEventHandler(this.OnCmdNewRoi); #line default #line hidden return; case 9: #line 33 "..\..\MainWindow.xaml" ((System.Windows.Input.CommandBinding)(target)).Executed += new System.Windows.Input.ExecutedRoutedEventHandler(this.OnCmdOpenRoi); #line default #line hidden return; case 10: #line 34 "..\..\MainWindow.xaml" ((System.Windows.Input.CommandBinding)(target)).Executed += new System.Windows.Input.ExecutedRoutedEventHandler(this.OnCmdSaveRoi); #line default #line hidden return; case 11: #line 35 "..\..\MainWindow.xaml" ((System.Windows.Input.CommandBinding)(target)).Executed += new System.Windows.Input.ExecutedRoutedEventHandler(this.OnCmdSaveRoiAs); #line default #line hidden return; case 12: #line 36 "..\..\MainWindow.xaml" ((System.Windows.Input.CommandBinding)(target)).Executed += new System.Windows.Input.ExecutedRoutedEventHandler(this.OnCmdCloseRoi); #line default #line hidden return; case 13: this.LayoutRoot = ((System.Windows.Controls.Grid)(target)); return; case 14: this.FileMenu = ((System.Windows.Controls.MenuItem)(target)); return; case 15: this.FileOpen = ((System.Windows.Controls.MenuItem)(target)); return; case 16: this.FileSaveAs = ((System.Windows.Controls.MenuItem)(target)); return; case 17: this.FileExit = ((System.Windows.Controls.MenuItem)(target)); return; case 18: this.ROIMenu = ((System.Windows.Controls.MenuItem)(target)); return; case 19: this.RoiNew = ((System.Windows.Controls.MenuItem)(target)); return; case 20: this.RoiOpen = ((System.Windows.Controls.MenuItem)(target)); return; case 21: this.RoiSave = ((System.Windows.Controls.MenuItem)(target)); return; case 22: this.RoiSaveAs = ((System.Windows.Controls.MenuItem)(target)); return; case 23: this.RoiClose = ((System.Windows.Controls.MenuItem)(target)); return; case 24: this.ViewMenu = ((System.Windows.Controls.MenuItem)(target)); return; case 25: this.ShowToolTips = ((System.Windows.Controls.MenuItem)(target)); return; case 26: this.ShowStatusBar = ((System.Windows.Controls.MenuItem)(target)); #line 77 "..\..\MainWindow.xaml" this.ShowStatusBar.Click += new System.Windows.RoutedEventHandler(this.ShowStatusBarClick); #line default #line hidden return; case 27: this.ViewIntensityGraph = ((System.Windows.Controls.MenuItem)(target)); #line 78 "..\..\MainWindow.xaml" this.ViewIntensityGraph.Click += new System.Windows.RoutedEventHandler(this.ViewIntensityGraphClick); #line default #line hidden return; case 28: this.SettingsMenu = ((System.Windows.Controls.MenuItem)(target)); return; case 29: this.UseApproximation = ((System.Windows.Controls.MenuItem)(target)); return; case 30: this.HelpMenu = ((System.Windows.Controls.MenuItem)(target)); return; case 31: this.HelpAbout = ((System.Windows.Controls.MenuItem)(target)); return; case 32: this.toolBarTray = ((System.Windows.Controls.ToolBarTray)(target)); return; case 33: this.tbFile = ((System.Windows.Controls.ToolBar)(target)); return; case 34: this.tbbOpen = ((System.Windows.Controls.Button)(target)); #line 92 "..\..\MainWindow.xaml" this.tbbOpen.Click += new System.Windows.RoutedEventHandler(this.OnCmdOpen); #line default #line hidden return; case 35: this.tbbSaveAs = ((System.Windows.Controls.Button)(target)); #line 95 "..\..\MainWindow.xaml" this.tbbSaveAs.Click += new System.Windows.RoutedEventHandler(this.OnCmdSaveAs); #line default #line hidden return; case 36: this.dockingManager = ((AvalonDock.DockingManager)(target)); #line 102 "..\..\MainWindow.xaml" this.dockingManager.ActiveContentChanged += new System.EventHandler(this.DockingManagerActiveContentChanged); #line default #line hidden #line 102 "..\..\MainWindow.xaml" this.dockingManager.ActiveDocumentChanged += new System.EventHandler(this.DockingManagerActiveDocumentChanged); #line default #line hidden #line 102 "..\..\MainWindow.xaml" this.dockingManager.DocumentClosed += new System.EventHandler(this.DockingManagerDocumentClosed); #line default #line hidden #line 102 "..\..\MainWindow.xaml" this.dockingManager.DocumentClosing += new System.EventHandler <System.ComponentModel.CancelEventArgs>(this.DockingManagerDocumentClosing); #line default #line hidden return; case 37: this.resizingPane = ((AvalonDock.ResizingPanel)(target)); return; case 38: this.documentPane = ((AvalonDock.DocumentPane)(target)); return; case 39: this.dockablePane = ((AvalonDock.DockablePane)(target)); return; case 40: this.imagePropsContent = ((Novartis.Msi.MSImageView.ImagePropsContent)(target)); return; case 41: this.roiProjectWindow = ((Novartis.Msi.MSImageView.RoiProjectWindow)(target)); return; case 42: this.metaContent = ((Novartis.Msi.MSImageView.MetaContent)(target)); return; case 43: this.statusBar = ((System.Windows.Controls.Primitives.StatusBar)(target)); return; case 44: this.coordinatesLabel = ((System.Windows.Controls.TextBlock)(target)); return; case 45: this.coordinates = ((System.Windows.Controls.TextBlock)(target)); return; case 46: this.intensityLabel = ((System.Windows.Controls.TextBlock)(target)); return; case 47: this.intensity = ((System.Windows.Controls.TextBlock)(target)); return; case 48: this.infoText = ((System.Windows.Controls.TextBlock)(target)); return; case 49: this.progressOperation = ((System.Windows.Controls.TextBlock)(target)); return; case 50: this.progressBar = ((System.Windows.Controls.ProgressBar)(target)); return; } this._contentLoaded = true; }
/// <summary> /// Autohides/redock a dockable pane /// </summary> /// <param name="pane">Pane to auto hide/redock</param> internal void ToggleAutoHide(DockablePane pane) { if (!_OnApplyTemplateFlag) { Debug.WriteLine("Layout has been restored before creating DockingManager object: force WPF to apply the template..."); ApplyTemplate(); } //if pane is in auto hide state then is found //referenced by a DockablePaneAnchorTabGroup //if so redock it in its original position if (RemovePaneFromTabGroups(pane)) { #region Pane is present in tab anchor panels DockableContent selectedContent = _flyoutWindow != null && _flyoutWindow.ReferencedPane != null && _flyoutWindow.ReferencedPane.Items.Count > 0 ? _flyoutWindow.ReferencedPane.Items[0] as DockableContent : pane.Items[0] as DockableContent; HideFlyoutWindow(); ResizingPanel parentPanel = pane.Parent as ResizingPanel; if (parentPanel != null && parentPanel.Children.Count >= 3) { parentPanel.AdjustPanelSizes(); } //reset content state to docked foreach (DockableContent content in pane.Items) { content.SetStateToDock(); } pane.Focus(); pane.SelectedItem = selectedContent; ActiveContent = selectedContent; #endregion } else { #region Pane is not auto hidden //Create e new group DockablePaneAnchorTabGroup group = new DockablePaneAnchorTabGroup(); //associate it to the pane group.ReferencedPane = pane; DockableContent selectedContent = pane.SelectedItem as DockableContent; //add contents to it foreach (DockableContent content in pane.Items) { DockablePaneAnchorTab tab = new DockablePaneAnchorTab(); tab.ReferencedContent = content; //tab.Anchor = pane.Anchor; //tab.Icon = content.Icon; group.Children.Add(tab); content.SetStateToAutoHide(); } //place group under correct anchor tabpanel switch (pane.Anchor) { case AnchorStyle.Left: if (_leftAnchorTabPanel != null) _leftAnchorTabPanel.Children.Add(group); break; case AnchorStyle.Top: if (_topAnchorTabPanel != null) _topAnchorTabPanel.Children.Add(group); break; case AnchorStyle.Right: if (_rightAnchorTabPanel != null) _rightAnchorTabPanel.Children.Add(group); break; case AnchorStyle.Bottom: if (_bottomAnchorTabPanel != null) _bottomAnchorTabPanel.Children.Add(group); break; } #endregion } //refresh arrangements traversing bottom-up visual tree FrameworkElement parentElement = pane.Parent as FrameworkElement; while (parentElement != null) { parentElement.InvalidateMeasure(); parentElement = parentElement.Parent as FrameworkElement; } }
//protected override void OnClosed(EventArgs e) //{ // base.OnClosed(e); // DockableContent[] cntsToClose = new DockableContent[HostedPane.Items.Count]; // HostedPane.Items.CopyTo(cntsToClose, 0); // foreach (DockableContent cntToClose in cntsToClose) // { // //HostedPane.CloseOrHide(HostedPane.Items[0] as DockableContent, ForcedClosing); // cntToClose.CloseOrHide(ForcedClosing); // } // Manager.UnregisterFloatingWindow(this); //} public override Pane ClonePane() { DockablePane paneToAnchor = new DockablePane(); ResizingPanel.SetEffectiveSize(paneToAnchor, new Size(Width, Height)); //if (HostedPane.Style != null) // paneToAnchor.Style = HostedPane.Style; int selectedIndex = HostedPane.SelectedIndex; //transfer contents from hosted pane in the floating window and //the new created dockable pane while (HostedPane.Items.Count > 0) { paneToAnchor.Items.Add( HostedPane.RemoveContent(0)); } paneToAnchor.SelectedIndex = selectedIndex; return paneToAnchor; }
DockablePane RestoreDockablePaneLayout(XmlElement mainElement, DockableContent[] actualContents, DocumentContent[] actualDocuments) { DockablePane pane = new DockablePane(); if (mainElement.HasAttribute("Anchor")) pane.Anchor = (AnchorStyle)Enum.Parse(typeof(AnchorStyle), mainElement.GetAttribute("Anchor")); if (mainElement.HasAttribute("ResizeWidth")) ResizingPanel.SetResizeWidth(pane, (GridLength)GLConverter.ConvertFromInvariantString(mainElement.GetAttribute("ResizeWidth"))); if (mainElement.HasAttribute("ResizeHeight")) ResizingPanel.SetResizeHeight(pane, (GridLength)GLConverter.ConvertFromInvariantString(mainElement.GetAttribute("ResizeHeight"))); if (mainElement.HasAttribute("EffectiveSize")) ResizingPanel.SetEffectiveSize(pane, (Size)(new SizeConverter()).ConvertFromInvariantString(mainElement.GetAttribute("EffectiveSize"))); if (mainElement.HasAttribute("ID")) pane.ID = new Guid(mainElement.GetAttribute("ID")); bool toggleAutoHide = false; if (mainElement.HasAttribute("IsAutoHidden")) toggleAutoHide = XmlConvert.ToBoolean(mainElement.GetAttribute("IsAutoHidden")); foreach (XmlElement contentElement in mainElement.ChildNodes) { if (contentElement.HasAttribute("Name")) { DockableContent foundContent = null; string contentName = contentElement.GetAttribute("Name"); foundContent = actualContents.FirstOrDefault(c => c.Name == contentName); if (foundContent == null && DeserializationCallback != null) { DeserializationCallbackEventArgs e = new DeserializationCallbackEventArgs(contentName); DeserializationCallback(this, e); foundContent = e.Content as DockableContent; } if (foundContent != null) { DetachContentFromDockingManager(foundContent); pane.Items.Add(foundContent); foundContent.SetStateToDock(); //call custom layout persistence method foundContent.RestoreLayout(contentElement); } } } if (toggleAutoHide && pane.Items.Count > 0) ToggleAutoHide(pane); if (mainElement.HasAttribute("SelectedIndex")) pane.SelectedIndex = XmlConvert.ToInt32(mainElement.GetAttribute("SelectedIndex")); return pane; }
public bool activatePlugin( string PluginFile, ref List<IPlugin> Plugins ) { Assembly asm = null; try { // FIXME: check only for valid .net assemblies with manifest asm = Assembly.LoadFile( PluginFile ); if ( asm == null ) return false; } catch ( Exception e ) { } Type PluginClass = null; int i = 0; // iterate through all types in assembly // !! FIXME: for debug only //foreach ( Type type in asm.GetTypes() ) //{ //PluginClass = type; // !! FIXME: for debug only //if ( PluginClass is IRenderEngine ) // if a rendering able plugin was found //{ try { // create an instance of rendering plugin //IRenderEngine tplugin = Activator.CreateInstance( PluginClass ) as IRenderEngine; IRenderEngine tplugin = (IRenderEngine) new RayCaster( dsm, anim_man ); ModelOrientationControl orientationControl = new ModelOrientationControl(tplugin,wm); var dockPane = new DockablePane(); dockPane.Items.Add( new DockableContent() { Name = "orientationContent", Title = "Orientation", Content = orientationControl } ); var resHorizontalPanel = new ResizingPanel() { Orientation = Orientation.Horizontal }; resHorizontalPanel.Children.Add( dockPane ); //resHorizontalPanel.Children.Add( logDockPane); this.wm.DockingManager.Content = resHorizontalPanel; var ccc = this.wm.DockingManager.Content; if ( tplugin != null ) Plugins.Add( tplugin ); // setup a new RenderWindow RenderWindow renderWindow = new RenderWindow(); renderWindow.RenderEngine = tplugin; //var renderingDataset = dsm.getRenderingDatasetRef(); //renderWindow.SetRenderingDataset( ref renderingDataset ); OpenGLWindow glWindow = new OpenGLWindow(); glWindow.SetRenderingMethod( tplugin ); renderWindow.GlWindows.Add( glWindow ); this.rwm.RenderWindows.Add( renderWindow ); // setup marching cubes opengl window IRenderEngine marchingCubesPlugin = (IRenderEngine) new MarchingCubes( dsm ); if ( marchingCubesPlugin != null ) Plugins.Add( marchingCubesPlugin ); // setup a new RenderWindow RenderWindow renderWindow2 = new RenderWindow(); renderWindow2.RenderEngine = marchingCubesPlugin; OpenGLWindow glWindow2 = new OpenGLWindow(); glWindow2.SetRenderingMethod( marchingCubesPlugin ); renderWindow2.GlWindows.Add( glWindow2 ); //this.rwm.RenderWindows.Add(renderWindow2); wm.Register( this.rwm ); } //} catch ( Exception e ) { MessageBox.Show( "Shit happened during plugin registration: " + PluginFile + e.Message ); } return true; }
void SaveLayout(XmlWriter xmlWriter, DockablePane pane) { bool needToSavePane = pane.Items.Count > 0; //if a pane is reference by a content than save it if (DockableContents.FirstOrDefault(d => d.SavedStateAndPosition != null && d.SavedStateAndPosition.ContainerPane == pane) != null) needToSavePane = true; if (needToSavePane) { xmlWriter.WriteStartElement("DockablePane"); xmlWriter.WriteAttributeString("ResizeWidth", ResizingPanel.GetResizeWidth(pane).ToString()); xmlWriter.WriteAttributeString("ResizeHeight", ResizingPanel.GetResizeHeight(pane).ToString()); xmlWriter.WriteAttributeString("EffectiveSize", new SizeConverter().ConvertToInvariantString(ResizingPanel.GetEffectiveSize(pane))); xmlWriter.WriteAttributeString("ID", pane.ID.ToString()); xmlWriter.WriteAttributeString("Anchor", pane.Anchor.ToString()); if (pane.Items.Count > 1) xmlWriter.WriteAttributeString("SelectedIndex", XmlConvert.ToString(pane.SelectedIndex)); xmlWriter.WriteAttributeString("IsAutoHidden", XmlConvert.ToString(pane.IsAutoHidden)); foreach (DockableContent content in pane.Items) { SaveLayout(xmlWriter, content); } xmlWriter.WriteEndElement(); } }
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 1: #line 8 "..\..\..\MainWindow.xaml" ((WeListenPlayer.MainWindow)(target)).Closing += new System.ComponentModel.CancelEventHandler(this.Window_Closed); #line default #line hidden return; case 2: #line 21 "..\..\..\MainWindow.xaml" ((System.Windows.Controls.Border)(target)).MouseDown += new System.Windows.Input.MouseButtonEventHandler(this.BorderMouseDown); #line default #line hidden return; case 3: this.btnSkipBck = ((System.Windows.Controls.Button)(target)); #line 39 "..\..\..\MainWindow.xaml" this.btnSkipBck.Click += new System.Windows.RoutedEventHandler(this.StopButton_Click); #line default #line hidden return; case 4: this.PlayButton = ((System.Windows.Controls.Button)(target)); #line 55 "..\..\..\MainWindow.xaml" this.PlayButton.Click += new System.Windows.RoutedEventHandler(this.PlayButton_Click); #line default #line hidden return; case 5: this.PauseButton = ((System.Windows.Controls.Button)(target)); #line 63 "..\..\..\MainWindow.xaml" this.PauseButton.Click += new System.Windows.RoutedEventHandler(this.PauseButton_Click); #line default #line hidden return; case 6: this.StopButton = ((System.Windows.Controls.Button)(target)); #line 71 "..\..\..\MainWindow.xaml" this.StopButton.Click += new System.Windows.RoutedEventHandler(this.StopButton_Click); #line default #line hidden return; case 7: this.btnSkipFwd = ((System.Windows.Controls.Button)(target)); #line 81 "..\..\..\MainWindow.xaml" this.btnSkipFwd.Click += new System.Windows.RoutedEventHandler(this.OnForwardClick); #line default #line hidden return; case 8: this.MainMenu = ((System.Windows.Controls.Menu)(target)); return; case 9: this.OpenFileMenuItem = ((System.Windows.Controls.MenuItem)(target)); #line 91 "..\..\..\MainWindow.xaml" this.OpenFileMenuItem.Click += new System.Windows.RoutedEventHandler(this.OpenFileMenuItem_Click); #line default #line hidden return; case 10: this.CloseMenuItem = ((System.Windows.Controls.MenuItem)(target)); #line 95 "..\..\..\MainWindow.xaml" this.CloseMenuItem.Click += new System.Windows.RoutedEventHandler(this.CloseMenuItem_Click); #line default #line hidden return; case 11: this.DefaultThemeMenuItem = ((System.Windows.Controls.MenuItem)(target)); #line 101 "..\..\..\MainWindow.xaml" this.DefaultThemeMenuItem.Checked += new System.Windows.RoutedEventHandler(this.DefaultThemeMenuItem_Checked); #line default #line hidden return; case 12: this.ExpressionDarkMenuItem = ((System.Windows.Controls.MenuItem)(target)); #line 105 "..\..\..\MainWindow.xaml" this.ExpressionDarkMenuItem.Checked += new System.Windows.RoutedEventHandler(this.ExpressionDarkMenuItem_Checked); #line default #line hidden return; case 13: this.ExpressionLightMenuItem = ((System.Windows.Controls.MenuItem)(target)); #line 109 "..\..\..\MainWindow.xaml" this.ExpressionLightMenuItem.Checked += new System.Windows.RoutedEventHandler(this.ExpressionLightMenuItem_Checked); #line default #line hidden return; case 14: this.SoundSelect = ((System.Windows.Controls.MenuItem)(target)); return; case 15: this.dockManager = ((AvalonDock.DockingManager)(target)); return; case 16: this.content_playlist = ((AvalonDock.DockableContent)(target)); return; case 17: this.btnStartReceiving = ((System.Windows.Controls.Button)(target)); #line 142 "..\..\..\MainWindow.xaml" this.btnStartReceiving.Click += new System.Windows.RoutedEventHandler(this.OnRecieveRequestClick); #line default #line hidden return; case 18: this.dgvPlayList = ((System.Windows.Controls.DataGrid)(target)); #line 160 "..\..\..\MainWindow.xaml" this.dgvPlayList.Drop += new System.Windows.DragEventHandler(this.dgvPlayList_Drop); #line default #line hidden #line 161 "..\..\..\MainWindow.xaml" this.dgvPlayList.DragOver += new System.Windows.DragEventHandler(this.dgvPlayList_DragOver); #line default #line hidden #line 162 "..\..\..\MainWindow.xaml" this.dgvPlayList.DragLeave += new System.Windows.DragEventHandler(this.dgvPlayList_DragLeave); #line default #line hidden return; case 19: this.colTitle = ((System.Windows.Controls.DataGridTextColumn)(target)); return; case 20: this.colArtist = ((System.Windows.Controls.DataGridTextColumn)(target)); return; case 21: this.btnAddSongs = ((System.Windows.Controls.Button)(target)); #line 222 "..\..\..\MainWindow.xaml" this.btnAddSongs.Click += new System.Windows.RoutedEventHandler(this.fileSelector); #line default #line hidden return; case 22: this.btnImport = ((System.Windows.Controls.Button)(target)); #line 223 "..\..\..\MainWindow.xaml" this.btnImport.Click += new System.Windows.RoutedEventHandler(this.dirSelector); #line default #line hidden return; case 23: this.btnMoveUp = ((System.Windows.Controls.Button)(target)); #line 225 "..\..\..\MainWindow.xaml" this.btnMoveUp.Click += new System.Windows.RoutedEventHandler(this.OnMoveUpClick); #line default #line hidden return; case 24: this.btnRemoveSong = ((System.Windows.Controls.Button)(target)); #line 236 "..\..\..\MainWindow.xaml" this.btnRemoveSong.Click += new System.Windows.RoutedEventHandler(this.OnRemoveSongClick); #line default #line hidden return; case 25: this.btnMoveDown = ((System.Windows.Controls.Button)(target)); #line 238 "..\..\..\MainWindow.xaml" this.btnMoveDown.Click += new System.Windows.RoutedEventHandler(this.OnMoveDownClick); #line default #line hidden return; case 26: this.content_db = ((AvalonDock.DockableContent)(target)); return; case 27: this.btnUploadFolderToDB = ((System.Windows.Controls.Button)(target)); #line 257 "..\..\..\MainWindow.xaml" this.btnUploadFolderToDB.Click += new System.Windows.RoutedEventHandler(this.OnUploadFolderToDbClick); #line default #line hidden return; case 28: this.lblProgress = ((System.Windows.Controls.Label)(target)); return; case 29: this.lblProgressCount = ((System.Windows.Controls.Label)(target)); return; case 30: this.lblAdded = ((System.Windows.Controls.Label)(target)); return; case 31: this.lblAddedCount = ((System.Windows.Controls.Label)(target)); return; case 32: this.lblRejected = ((System.Windows.Controls.Label)(target)); return; case 33: this.lblRejectedCount = ((System.Windows.Controls.Label)(target)); return; case 34: this.content_PurchasedMusic = ((AvalonDock.DockableContent)(target)); return; case 35: this.dgvPurchasedSong = ((System.Windows.Controls.DataGrid)(target)); return; case 36: this.colPurchaseTitle = ((System.Windows.Controls.DataGridTextColumn)(target)); return; case 37: this.colDownload = ((System.Windows.Controls.DataGridTemplateColumn)(target)); return; case 39: this.colLinkURL = ((System.Windows.Controls.DataGridTextColumn)(target)); return; case 40: this.pane_main = ((AvalonDock.DockablePane)(target)); return; case 41: this.albumArtPanel = ((VisualizationLib.AlbumArtDisplay)(target)); return; case 42: this.spectrumAnalyzer = ((VisualizationLib.SpectrumAnalyzer)(target)); return; case 43: this.sldrVolume = ((System.Windows.Controls.Slider)(target)); #line 392 "..\..\..\MainWindow.xaml" this.sldrVolume.ValueChanged += new System.Windows.RoutedPropertyChangedEventHandler<double>(this.OnSldrVolumeChanged); #line default #line hidden return; case 44: this.clockDisplay = ((VisualizationLib.DigitalClock)(target)); return; case 45: this.txtUserName = ((System.Windows.Controls.TextBlock)(target)); return; case 46: this.tbUserName = ((System.Windows.Controls.TextBox)(target)); return; case 47: this.txtPassword = ((System.Windows.Controls.TextBlock)(target)); return; case 48: this.pwbPassword = ((System.Windows.Controls.PasswordBox)(target)); return; case 49: this.btnSubmit = ((System.Windows.Controls.Button)(target)); #line 424 "..\..\..\MainWindow.xaml" this.btnSubmit.Click += new System.Windows.RoutedEventHandler(this.btnSubmit_Click); #line default #line hidden return; case 50: this.btnRegisterLink = ((System.Windows.Controls.Button)(target)); #line 425 "..\..\..\MainWindow.xaml" this.btnRegisterLink.Click += new System.Windows.RoutedEventHandler(this.btnRegisterLink_Click); #line default #line hidden return; case 51: this.subMain_songInfo = ((AvalonDock.DockablePane)(target)); return; case 52: this.tbTitle_Copy1 = ((System.Windows.Controls.TextBlock)(target)); return; case 53: this.tbArtist_Copy1 = ((System.Windows.Controls.TextBlock)(target)); return; case 54: this.tbAlbum_Copy1 = ((System.Windows.Controls.TextBlock)(target)); return; case 55: this.tbYear_Copy1 = ((System.Windows.Controls.TextBlock)(target)); return; case 56: this.tbGenre_Copy1 = ((System.Windows.Controls.TextBlock)(target)); return; case 57: this.tbPath_Copy1 = ((System.Windows.Controls.TextBlock)(target)); return; case 58: this.tbAmazonTitleInfo = ((System.Windows.Controls.TextBlock)(target)); return; case 59: this.tbAmazonArtistInfo = ((System.Windows.Controls.TextBlock)(target)); return; case 60: this.tbAmazonAlbumInfo = ((System.Windows.Controls.TextBlock)(target)); return; case 61: this.tbAmazonYearInfo = ((System.Windows.Controls.TextBlock)(target)); return; case 62: this.tbAmazonAsinInfo = ((System.Windows.Controls.TextBlock)(target)); return; case 63: this.tbAmazonPriceInfo = ((System.Windows.Controls.TextBlock)(target)); return; case 64: this.subMain_waveform = ((AvalonDock.DockablePane)(target)); return; case 65: this.waveformTimeline = ((VisualizationLib.WaveformTimeline)(target)); return; case 66: this.pane_module = ((AvalonDock.DockablePane)(target)); return; } this._contentLoaded = true; }
/// <summary> /// Anchor a dockable pane (<see cref="DockablePane"/>) to a border of an other dockable pane /// </summary> /// <param name="paneToAnchor">Pane to anchor</param> /// <param name="relativePane">Pane relative</param> /// <param name="anchor"></param> public void Anchor(DockablePane paneToAnchor, DockablePane relativePane, AnchorStyle anchor) { //ensure that content property is not empty EnsureContentNotEmpty(); if (anchor == AnchorStyle.None) anchor = AnchorStyle.Right; //get a refernce to the resizingpanel container of relativePane ResizingPanel relativePaneContainer = LogicalTreeHelper.GetParent(relativePane) as ResizingPanel; Orientation requestedOrientation = (anchor == AnchorStyle.Bottom || anchor == AnchorStyle.Top) ? Orientation.Vertical : Orientation.Horizontal; if (relativePaneContainer == null) { Debug.Assert(relativePane.Parent == this); relativePaneContainer = new ResizingPanel(); relativePaneContainer.Orientation = requestedOrientation; this.Content = relativePaneContainer; relativePaneContainer.Children.Add(relativePane); } Debug.Assert(relativePaneContainer != null, "By now we can't have a pane without a resizing panel containing it"); #region Create and setup container panel if (relativePaneContainer != null) { //check if orientation is right if (relativePaneContainer.Orientation != requestedOrientation) { //if the existing panel is not oriented as we want //create a new one ResizingPanel newPanel = new ResizingPanel(); newPanel.Orientation = requestedOrientation; if (newPanel.Orientation == Orientation.Horizontal) ResizingPanel.SetResizeHeight(newPanel, ResizingPanel.GetResizeHeight(relativePane)); else ResizingPanel.SetResizeWidth(newPanel, ResizingPanel.GetResizeWidth(relativePane)); //replace relative pane in its' container panel //with this new panel int indexofRelativePane = relativePaneContainer.Children.IndexOf(relativePane); relativePaneContainer.Children.Remove(relativePane); relativePaneContainer.Children.Insert(indexofRelativePane, newPanel); //now we have a panel correctly placed in the tree newPanel.Children.Add(relativePane); newPanel.InsertChildRelativeTo( paneToAnchor, relativePane, anchor == AnchorStyle.Right || anchor == AnchorStyle.Bottom); relativePaneContainer = newPanel; } else { if (anchor == AnchorStyle.Left || anchor == AnchorStyle.Top) { //add new child before first (prepend) relativePaneContainer.InsertChildRelativeTo(paneToAnchor, relativePane, false); } else { //add new child after last (append) relativePaneContainer.InsertChildRelativeTo(paneToAnchor, relativePane, true); } } relativePaneContainer.InvalidateMeasure(); } #endregion //than set the new anchor style for the pane paneToAnchor.Anchor = relativePane.Anchor; if (anchor == AnchorStyle.Left || anchor == AnchorStyle.Right) { double w = Math.Min( ResizingPanel.GetEffectiveSize(relativePane).Width / 2.0, ResizingPanel.GetEffectiveSize(paneToAnchor).Width); ResizingPanel.SetResizeWidth(paneToAnchor, new GridLength(w, GridUnitType.Pixel)); ResizingPanel.SetResizeHeight(paneToAnchor, new GridLength(1.0, GridUnitType.Star)); } else { double h = Math.Min( ResizingPanel.GetEffectiveSize(relativePane).Height / 2.0, ResizingPanel.GetEffectiveSize(paneToAnchor).Height); ResizingPanel.SetResizeWidth(paneToAnchor, new GridLength(1.0, GridUnitType.Star)); ResizingPanel.SetResizeHeight(paneToAnchor, new GridLength(h, GridUnitType.Pixel)); } //refresh contents state foreach (DockableContent draggedContent in paneToAnchor.Items) { draggedContent.SetStateToDock(); } if (relativePaneContainer != null) relativePaneContainer.AdjustPanelSizes(); //paneToAnchor.Focus(); }
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 1: this.GuestBookerStartWindow = ((Guest_Booker_Studio.MainWindow)(target)); return; case 2: this.Pgrid = ((System.Windows.Controls.Grid)(target)); return; case 3: this.Part_Title = ((System.Windows.Controls.Grid)(target)); #line 19 "..\..\..\MainWindow.xaml" this.Part_Title.MouseLeftButtonDown += new System.Windows.Input.MouseButtonEventHandler(this.Part_Title_DoubleClick); #line default #line hidden return; case 4: this.minimizeButton = ((System.Windows.Controls.Button)(target)); #line 39 "..\..\..\MainWindow.xaml" this.minimizeButton.Click += new System.Windows.RoutedEventHandler(this.minimizeButton_Click); #line default #line hidden return; case 5: this.restoreMaximizeButton = ((System.Windows.Controls.Button)(target)); #line 42 "..\..\..\MainWindow.xaml" this.restoreMaximizeButton.Click += new System.Windows.RoutedEventHandler(this.restoreMaximizeButton_Click); #line default #line hidden return; case 6: this.closeButton = ((System.Windows.Controls.Button)(target)); #line 45 "..\..\..\MainWindow.xaml" this.closeButton.Click += new System.Windows.RoutedEventHandler(this.closeButton_Click); #line default #line hidden return; case 7: this.dockManager = ((AvalonDock.DockingManager)(target)); return; case 8: this.vPanel = ((AvalonDock.ResizingPanel)(target)); return; case 9: this.hPanel = ((AvalonDock.ResizingPanel)(target)); return; case 10: this.WorkAreaWindow = ((Guest_Booker_Studio.Pages.Generic.InnerWindow)(target)); return; case 11: this.ApplicationExplorerPane = ((AvalonDock.DockablePane)(target)); return; case 12: this.ApplicationExplorer = ((Guest_Booker_Studio.Presentation.Controls.CustomerExplorerControl)(target)); return; case 13: this.mainWindowStatusBarMessage = ((System.Windows.Controls.TextBlock)(target)); return; } this._contentLoaded = true; }