예제 #1
0
        void BuildDockingLayout()
        {
            dockManager.Content = null;

            //TreeView dockable content
            var trv = new TreeView();
            trv.Items.Add(new TreeViewItem() { Header = "Item1" });
            trv.Items.Add(new TreeViewItem() { Header = "Item2" });
            trv.Items.Add(new TreeViewItem() { Header = "Item3" });
            trv.Items.Add(new TreeViewItem() { Header = "Item4" });
            ((TreeViewItem)trv.Items[0]).Items.Add(new TreeViewItem() { Header = "SubItem1" });
            ((TreeViewItem)trv.Items[0]).Items.Add(new TreeViewItem() { Header = "SubItem2" });
            ((TreeViewItem)trv.Items[1]).Items.Add(new TreeViewItem() { Header = "SubItem3" });
            ((TreeViewItem)trv.Items[2]).Items.Add(new TreeViewItem() { Header = "SubItem4" });
            var treeviewContent = new DockableContent() { Title = "Explorer", Content = trv };

            treeviewContent.Show(dockManager, AnchorStyle.Bottom);

            //TextBox invo dockable content
            var treeviewInfoContent = new DockableContent() { Title = "Explorer Info", Content = new TextBox() { Text = "Explorer Info Text", IsReadOnly = true } };
            treeviewContent.ContainerPane.Items.Add(treeviewInfoContent);

            //ListView dockable content
            var gridView = new GridView();
            gridView.Columns.Add(new GridViewColumn() { Header = "Date" });
            gridView.Columns.Add(new GridViewColumn() { Header = "Day Of Weeek", DisplayMemberBinding = new Binding("DayOfWeek") });
            gridView.Columns.Add(new GridViewColumn() { Header = "Year", DisplayMemberBinding = new Binding("Year") });
            gridView.Columns.Add(new GridViewColumn() { Header = "Month", DisplayMemberBinding = new Binding("Month") });
            gridView.Columns.Add(new GridViewColumn() { Header = "Second", DisplayMemberBinding = new Binding("Second") });
            var listView = new ListView() { View = gridView };
            listView.Items.Add(DateTime.Now);
            listView.Items.Add(DateTime.Now.AddYears(-1));
            listView.Items.Add(DateTime.Now.AddMonths(15));
            listView.Items.Add(DateTime.Now.AddHours(354));

            var listViewContent = new DockableContent() { Title = "Date & Times", Content = listView };
            listViewContent.ShowAsFloatingWindow(dockManager, true);

            //TextBox dockable content
            var textboxSampleContent = new DockableContent() { Title = "Date & Times Info", Content = new TextBox() { Text = "Date & Times Info Text", IsReadOnly = true } };
            listViewContent.ContainerPane.Items.Add(textboxSampleContent);

            //DataGrid document
            //var dataGrid = new DataGrid();
            //var rnd = new Random();
            //var data = new List<Tuple<double, double, double, double>>();
            //for (int i = 0; i < 100; i++)
            //{
            //    data.Add(Tuple.Create(rnd.NextDouble(), rnd.NextDouble() * 10.0, rnd.NextDouble() * 100.0, rnd.NextDouble() * 1000.0));
            //}

            //dataGrid.ItemsSource = data;

            //var dataGridDocument = new DocumentContent() { Title = "Data", IsLocked = true, Content = dataGrid };
            //dataGridDocument.Show(dockManager);

            ////DataGrid Info Text sample
            //var dataGridInfoContent = new DockableContent() { Title = "Data Info", Content = new TextBox() { Text = "Data Info Text" } };
            //dataGridInfoContent.ShowAsDocument(dockManager);
        }
예제 #2
0
        void _pluginManager_RequestShowContent(IBioLinkPlugin plugin, string name)
        {
            String contentName = plugin.Name + "_" + name;

            AvalonDock.DockableContent content = dockManager.DockableContents.FirstOrDefault((candidate) => {
                return(candidate.Name.Equals(contentName));
            });

            if (content != null)
            {
                content.Show();
            }
        }
예제 #3
0
        private void onProcessClickMainDocking(object sender, RoutedEventArgs e)
        {
            //DockableContent activeContent = GetManager().ActiveContent as DockableContent;
            //DockingManager _docManager = (DockingManager)((MenuItem)e.OriginalSource).CommandParameter; ;
            DockingManager  _docManager   = (DockingManager)((MenuItem)e.Source).CommandParameter;;
            DockableContent activeContent = (DockableContent)((MenuItem)e.Source).DataContext;;

            activeContent.NVSSubDocking = null;
            activeContent.Manager       = _docManager;

            activeContent.Hide();
            activeContent.Show();
        }
예제 #4
0
        void BuildDockingLayout()
        {
            dockManager.Content = null;

            trv = new System.Windows.Controls.TreeView();
            TreeViewItem tvitem = GetTreeView("recorded_vid", "Recorded Video", @"C:\Users\UA\Documents\Project\Displayer\P001DS004Tvs2012\Icon\Video Call-50.png");
            trv.Items.Add(tvitem);
            foreach(var video in dbController.list_video()){
                ((TreeViewItem)trv.Items[0]).Items.Add(new TreeViewItem() { Header = video });
            }
            trv.MouseDoubleClick += trv_NodeMouseDoubleClick;

            var treeviewContent_right = new DockableContent() { Title = "Video Lists", Content = trv };
            treeviewContent_right.Show(dockManager, AnchorStyle.Right);

            var treeviewContent_left = new DockableContent() { Title = "Device Lists", Content = new System.Windows.Controls.TextBox() { Text = "Device Lists", IsReadOnly = true } };
            treeviewContent_left.Show(dockManager, AnchorStyle.Left);
            treeviewContent_left.ToggleAutoHide();

            videoPanel.ShowAsDocument(dockManager);
        }
예제 #5
0
 public static void ShowDockable(DockableContent doc)
 {
     doc.Show(DockingManager);
     doc.Activate();
 }
예제 #6
0
 /// <summary>
 /// Adds a new side menu window
 /// </summary>
 /// <param name="title">The title of the side menu.</param>
 /// <param name="control">The control that will be inserted into the side menu.</param>
 public void AddDockablePane(string title, UserControl control)
 {
     var dockable = new DockableContent()
     {
         Title = title,
         Content = control,
         IsCloseable = false,
         DockableStyle = DockableStyle.AutoHide,
     };
     dockable.Show(this.dockManger);
 }
        /// <summary>
        /// Shows a docking window for a given view.  
        /// If is has been shown before, restore it position. Otherwise dock it to the right side.
        /// </summary>
        /// <param name="view">View to dock.</param>
        /// <param name="dockingStyle">Docking style.</param>
        /// <param name="dockingAnchorStyle">Docking anchor style. Only usefull for DockingPaneStyle.Docked.</param>
        public void ShowWindow(IDockableViewModel view, DockingPaneStyle dockingStyle, DockingPaneAnchorStyle dockingAnchorStyle)
        {
            // init resource dictionaries for plugin hosters
            if (view is IPluginHosterViewModel)
            {
                IPluginHosterViewModel pHost = (IPluginHosterViewModel)view;
                if (pHost.IsVMPlugin)
                {
                    if (!pHost.VMPluginDictionaryInitialized)
                        try
                        {
                            if (pHost.VMPlugin.GetViewModelRessourceDictionary() != null)
                                if (System.Windows.Application.Current != null)
                                {
                                    System.Windows.Application.Current.Resources.BeginInit();
                                    System.Windows.Application.Current.Resources.MergedDictionaries.Add(pHost.VMPlugin.GetViewModelRessourceDictionary());
                                    System.Windows.Application.Current.Resources.EndInit();
                                }
                            pHost.VMPluginDictionaryInitialized = true;
                        }
                        catch
                        {
                            pHost.VMPluginDictionaryInitialized = false;
                        }
                }
            }
            if (!this.isRestoringLayout)
            {
                if (!view.IsInitialized)
                    view.InitializeVM();

                if (view is IRibbonDockableViewModel && this.Ribbon != null)
                    if (!((IRibbonDockableViewModel)view).IsRibbonMenuInitialized)
                    {
                        ((IRibbonDockableViewModel)view).CreateRibbonMenu(this.Ribbon);
                    }
            }

            if (!viewLookup.ContainsKey(view.DockingPaneName))
            {
                DockableContent content = new DockableContent();
                content.Name = view.DockingPaneName;
                content.Title = view.DockingPaneTitle;
                content.Content = view;
                content.StateChanged += new System.Windows.RoutedEventHandler(content_StateChanged);
                if (view.ActivationMode == ActivationMode.Normal)
                    content.IsActiveContentChanged += new EventHandler(content_IsActiveContentChanged);
                content.ContextChangeKind = ConvertToContextChangeKind(view.DockingContextChangeKind);

                viewLookup.Add(view.DockingPaneName, new ViewLookUp(view, content));
                
                if (this.isRestoringLayout)
                {
                    this.MainDockingManager.AddPaneForLayoutRestore(content);
                }
                else
                {
                    if (dockingStyle == DockingPaneStyle.Floating)
                    {
                        content.FloatingWindowSize = new Size(view.FloatingWindowDesiredWidth, view.FloatingWindowDesiredHeight);
                        content.ShowAsFloatingWindow(this.MainDockingManager, true);
                    }
                    else if (dockingStyle == DockingPaneStyle.DockedInDocumentPane)
                        content.ShowAsDocument(this.MainDockingManager);
                    else
                    {
                        if (view.DockedWindowDesiredWidth > 0)
                            content.DesiredWidth = view.DockedWindowDesiredWidth;
                        if (view.DockedWindowDesiredHeight > 0)
                            content.DesiredHeight = view.DockedWindowDesiredHeight;

                        AnchorStyle style = ConvertToAnchorStyle(dockingAnchorStyle);
                        if (style != AnchorStyle.None)
                        {
                            content.Show(this.MainDockingManager, style);
                        }
                        else
                            content.Show(this.MainDockingManager);
                    }
                }
            }

            // show docking window
            if (!this.isRestoringLayout)
            if (!viewLookup[view.DockingPaneName].Pane.IsVisible)
            {
                if (dockingStyle == DockingPaneStyle.Floating)
                {
                    viewLookup[view.DockingPaneName].Pane.FloatingWindowSize = new Size(view.FloatingWindowDesiredWidth, view.FloatingWindowDesiredHeight);
                    viewLookup[view.DockingPaneName].Pane.ShowAsFloatingWindow(this.MainDockingManager, true);
                }
                else if (dockingStyle == DockingPaneStyle.DockedInDocumentPane)
                    viewLookup[view.DockingPaneName].Pane.ShowAsDocument(this.MainDockingManager);
                else
                    viewLookup[view.DockingPaneName].Pane.Show(this.MainDockingManager);

                view.IsDockingPaneVisible = true;
            }
        }
예제 #8
0
        /// <summary>
        /// Initialise the proprety dock (dockManager of AvalonDock)
        /// </summary>
        void BuildDockingLayout()
        {
            dockManager.Content = null;

            // The name properties are needed to save and restore the layout
            dockManager.Name = "dockManagerName";

            BitmapImage propertiesIcon = new BitmapImage();
            propertiesIcon.BeginInit();
            propertiesIcon.UriSource = new Uri(@"/images/Properties_Icon.png", UriKind.RelativeOrAbsolute);
            propertiesIcon.EndInit();

            BitmapImage eventsIcon = new BitmapImage();
            eventsIcon.BeginInit();
            eventsIcon.UriSource = new Uri(@"/images/event.png", UriKind.RelativeOrAbsolute);
            eventsIcon.EndInit();

            dockableComponentProperties = new DockableContent() {
                Title = Properties.Resources.DockProperties,
                Content = null,
                Name = "dockComponentName",
                Icon = propertiesIcon
            };

            propertyDockScrollViewer = new ScrollViewer();
            propertyDockScrollViewer.HorizontalScrollBarVisibility = ScrollBarVisibility.Auto;
            propertyDockScrollViewer.VerticalScrollBarVisibility = ScrollBarVisibility.Auto;

            StackPanel sp = new StackPanel();
            dockableComponentProperties.Content = sp;
            sp.Children.Add(propertyDockScrollViewer);
            dockableComponentProperties.Show(dockManager, AnchorStyle.Right);
            dockableComponentProperties.IsCloseable = false;

            scrollCanvars = new DocumentContent() {
                Title = Properties.Resources.DockMainWindow,
                Content = scrollViewer,
                Name = "dockDeploymentWindowName"
            };
            scrollCanvars.IsCloseable = false;
            scrollCanvars.Show(dockManager);

            // creating the tab for the gui designer
            InitGUITab();

            //TreeView dockable content
            dockableInportsList = new TreeView();
            BrushConverter bc = new BrushConverter();
            dockableInportsList.Background = (Brush)bc.ConvertFrom("#FFFFFFFF");
            dockableInportsList.IsTabStop = true;
            //dockableInportsList.Background = (Brush)bc.ConvertFrom("#FFE9ECFA");
            dockableOutportsList = new TreeView();
            dockableOutportsList.Background = (Brush)bc.ConvertFrom("#FFFFFFFF");
            //dockableOutportsList.Background = (Brush)bc.ConvertFrom("#FFE9ECFA");

            dockableInportsTab = new DockableContent() {
                Title = Properties.Resources.DockInPorts,
                Content = dockableInportsList,
                Visibility = Visibility.Collapsed,
                Name = "inputPortsName",
                Icon = propertiesIcon,
                IsCloseable = false
            };
            dockableOutportsTab = new DockableContent() {
                Title = Properties.Resources.DockOutPorts,
                Content = dockableOutportsList,
                Visibility = Visibility.Collapsed,
                Name = "outputPortsName",
                Icon = propertiesIcon,
                IsCloseable = false
            };

            // EventListenerGrid
            eventListenerDockScrollViewer = new ScrollViewer();
            eventListenerDockScrollViewer.HorizontalScrollBarVisibility = ScrollBarVisibility.Auto;
            eventListenerDockScrollViewer.VerticalScrollBarVisibility = ScrollBarVisibility.Auto;
            dockableEventListenerTab = new DockableContent() {
                Title = Properties.Resources.PropertyDockEventListenerTab,
                Content = eventListenerDockScrollViewer,
                Visibility = Visibility.Collapsed,
                Name = "eventListenerName",
                Icon = eventsIcon,
                IsCloseable = false
            };
            eventListenerDockScrollViewer.SizeChanged += dockableEventListenerTriggerTab_SizeChanged;

            // EventTriggerGrid
            eventTriggerDockScrollViewer = new ScrollViewer();
            eventTriggerDockScrollViewer.HorizontalScrollBarVisibility = ScrollBarVisibility.Auto;
            eventTriggerDockScrollViewer.VerticalScrollBarVisibility = ScrollBarVisibility.Auto;
            dockableEventTriggerTab = new DockableContent() {
                Title = Properties.Resources.PropertyDockEventTriggerTab,
                Content = eventTriggerDockScrollViewer,
                Visibility = Visibility.Collapsed,
                Name = "eventTriggerName",
                Icon = eventsIcon,
                IsCloseable = false
            };
            eventTriggerDockScrollViewer.SizeChanged += dockableEventListenerTriggerTab_SizeChanged;

            // EventGrid
            dockEventGrid = new Grid();
            dockEventGrid.MinWidth = 200;
            dockEventGrid.Background = new SolidColorBrush(Colors.White);
            //dockEventGrid.Height = 100;

            ColumnDefinition labelColDef = new ColumnDefinition();
            ColumnDefinition comboColDef = new ColumnDefinition();
            dockEventGrid.ColumnDefinitions.Add(labelColDef);
            dockEventGrid.ColumnDefinitions.Add(comboColDef);
            dockEventGrid.HorizontalAlignment = HorizontalAlignment.Left;
            dockEventGrid.VerticalAlignment = VerticalAlignment.Top;
            dockEventGrid.Margin = new Thickness(4, 4, 4, 4);
            ScrollViewer eventDockScrollViewer = new ScrollViewer();
            eventDockScrollViewer.HorizontalScrollBarVisibility = ScrollBarVisibility.Auto;
            eventDockScrollViewer.VerticalScrollBarVisibility = ScrollBarVisibility.Auto;
            eventDockScrollViewer.Content = dockEventGrid;

            dockableEventsTab = new DockableContent() {
                Title = Properties.Resources.DockEvents,
                Content = eventDockScrollViewer,
                Visibility = Visibility.Collapsed,
                Name = "events",
                Icon = eventsIcon,
                IsCloseable = false
            };
            eventDockScrollViewer.SizeChanged += dockableEventListenerTriggerTab_SizeChanged;

            dockableComponentProperties.ContainerPane.Items.Add(dockableInportsTab);
            dockableComponentProperties.ContainerPane.Items.Add(dockableOutportsTab);
            dockableComponentProperties.ContainerPane.Items.Add(dockableEventsTab);
            dockableComponentProperties.ContainerPane.Items.Add(dockableEventListenerTab);
            dockableComponentProperties.ContainerPane.Items.Add(dockableEventTriggerTab);

            sp.SizeChanged += StackPanel_SizeChanged;

            // Component "Toolbox" on left side
            // under development, do NOT delete
            //DockableContent dockableComponentToolbox = new DockableContent() {
            //    Title = "Components", Content = null, Name = "dockComponentToolbox"
            //};
            //dockableComponentToolbox.Show(dockManager, AnchorStyle.Left);
            //TreeView dockableComponentList = new TreeView();

            //dockableComponentList.Items.Add(new TreeViewItem() {
            //    Header = "Sensors", Background = new SolidColorBrush(Colors.Beige)//, ItemContainerStyle
            //});
            //dockableComponentList.Items.Add(new TreeViewItem() {
            //    Header = "Processors"
            //});
            //dockableComponentList.Items.Add(new TreeViewItem() {
            //    Header = "Actuators"
            //});
            //dockableComponentList.Items.Add(new TreeViewItem() {
            //    Header = "Special"
            //});
            //dockableComponentToolbox.Content = dockableComponentList;

            //foreach (Asterics.ACS2.componentTypesComponentType component in componentList.Values) {
            //    switch (component.type) {
            //        case Asterics.ACS2.componentType.actuator:
            //            ((TreeViewItem)dockableComponentList.Items[2]).Items.Add(new TreeViewItem {
            //                Header = component.id, Margin = new Thickness(-20, 0, 0, 0)
            //            });
            //            break;
            //        case Asterics.ACS2.componentType.processor:
            //            ((TreeViewItem)dockableComponentList.Items[1]).Items.Add(new TreeViewItem {
            //                Header = component.id, Margin = new Thickness(-20, 0, 0, 0)
            //            });
            //            break;
            //        case Asterics.ACS2.componentType.sensor:
            //            ((TreeViewItem)dockableComponentList.Items[0]).Items.Add(new TreeViewItem {
            //                Header = component.id, Margin = new Thickness(-20, 0, 0, 0)
            //            });
            //            break;
            //        case Asterics.ACS2.componentType.special:
            //            ((TreeViewItem)dockableComponentList.Items[3]).Items.Add(new TreeViewItem {
            //                Header = component.id, Margin = new Thickness(-20, 0, 0, 0)
            //            });
            //            break;
            //    }
            //}
            // End toolbox
        }
예제 #9
0
 private void SetVisibilityOfMenuItems(DockableContent dc)
 {
     if (dc.Visibility == Visibility.Visible) // the value is set in ConvertBack of AvalonDockVisibilityConverter!!!
     {
         dc.Show();
     }
     else
     {
         dc.Hide();
     }
 }