コード例 #1
0
        private void AddOrShowView(ISubView view, bool show)
        {
            subviewmap[view.ContentID] = view;
            string           viewname = view.ContentID;
            LayoutContent    targetContent;
            LayoutAnchorable targetView;

            viewList.TryGetValue(viewname, out targetContent);
            targetView = targetContent as LayoutAnchorable;
            if (targetView == null)
            {
                targetView = new LayoutAnchorable();
                viewList.Add(viewname, targetView);
                targetView.AddToLayout(DockMan, AnchorableShowStrategy.Most);
                targetView.DockAsDocument();
                targetView.CanClose = false;
                targetView.Hide();
            }
            if (targetView.Content == null)
            {
                targetView.Content     = view.View;
                targetView.ContentId   = viewname;
                targetView.Title       = view.GetTitle(ResourceService.CurrentCulture);
                targetView.CanAutoHide = true;
            }
            if (show)
            {
                targetView.IsVisible = true;
            }
        }
コード例 #2
0
 protected override void InitalizePlugins()
 {
     foreach (IDockablePlugin plugin in Plugins)
     {
         LayoutAnchorable layoutAnchorable = new LayoutAnchorable();
         layoutAnchorable.Hiding += (s, e) =>
         {
             RaisePropertyChanged();
         };
         var container = CreatePluginRegion(plugin);
         layoutAnchorable.Content = container;
         MapPluginAnchor[plugin]  = layoutAnchorable;
         layoutAnchorable.AddToLayout(Manager, plugin.Side);
         //(layoutAnchorable.Parent as LayoutAnchorablePane).DockMinWidth = plugin.InitialWidth;
         //(layoutAnchorable.Parent as LayoutAnchorablePane).DockMinHeight = plugin.InitialHeight;
         plugin.InitalizePlugin(this);
         Binding binding = new Binding("Title")
         {
             Source = plugin.ViewModel, Mode = BindingMode.OneWay
         };
         BindingOperations.SetBinding(container, ViewRegionControl.TitleProperty, binding);
     }
     foreach (IPlugin plugin in Plugins)
     {
         if (!(plugin is IDockablePlugin))
         {
             plugin.InitalizePlugin(this);
         }
     }
 }
コード例 #3
0
        private void newAnchoredGraph_Click(object sender, RoutedEventArgs e)
        {
            LayoutAnchorable la = new LayoutAnchorable {
                Title = "Graph Editor: Anchored", FloatingHeight = 400, FloatingWidth = 500, Content = new GraphEditor(), CanClose = true
            };

            la.AddToLayout(dockingManager, AnchorStrat);
        }
コード例 #4
0
ファイル: Test.xaml.cs プロジェクト: wboxx1/85-EIS-PUMA-WPF
        public void CreateView()
        {
            LayoutAnchorable newPanel = new LayoutAnchorable()
            {
                Title = "New Panel"
            };

            newPanel.AddToLayout(DockManager, AnchorableShowStrategy.Left);
        }
コード例 #5
0
        /// <summary>
        /// Add pane to JSharp window
        /// </summary>
        private void AddPane(Pane pane)
        {
            if (pane == null)
            {
                return;
            }

            var lA = new LayoutAnchorable
            {
                Title   = pane._title,
                Content = pane._content
            };

            pane._parentPaneHolder = lA;

            if (!dictionaryOfPanes.ContainsKey(pane._title))
            {
                dictionaryOfPanes.Add(pane._title, pane);
            }
            else

            {
                dictionaryOfPanes[pane._title]._parentPaneHolder = pane._parentPaneHolder;
                pane._paneLocation = dictionaryOfPanes[pane._title]._paneLocation;
                pane._isAutoHide   = dictionaryOfPanes[pane._title]._isAutoHide;
                pane._width        = dictionaryOfPanes[pane._title]._width;
                pane._height       = dictionaryOfPanes[pane._title]._height;
            }

            ((UserControl)pane._content).HorizontalAlignment = HorizontalAlignment.Stretch;
            ((UserControl)pane._content).VerticalAlignment   = VerticalAlignment.Stretch;

            //panes[pane.paneLocation].Children.Add(lA);
            lA.CanDockAsTabbedDocument = false;
            lA.AddToLayout(DockManager, (AnchorableShowStrategy)pane._paneLocation);


            if (lA.Parent is LayoutAnchorablePane p)
            {
                p.DockWidth  = new GridLength(pane._width);
                p.DockHeight = new GridLength(pane._height);
            }
            else if (lA.Parent is LayoutAnchorablePaneGroup pG)
            {
                pG.DockWidth  = new GridLength(pane._width);
                pG.DockHeight = new GridLength(pane._height);
            }

            lA.AutoHideHeight = pane._height;
            lA.AutoHideWidth  = pane._width;

            if (pane._isAutoHide)
            {
                lA.ToggleAutoHide();
            }
        }
コード例 #6
0
        public static void OpenOutputWindow()
        {
            var anchorable = new LayoutAnchorable
            {
                Title   = "输出",
                Content = new Components.Output.Output()
            };

            anchorable.AddToLayout(MainWindow.instance.DockManager, AnchorableShowStrategy.Bottom);
            anchorable.AutoHideHeight    = 140;
            anchorable.AutoHideMinHeight = 100;
        }
コード例 #7
0
        public void ShowInFloatingWindow(UserControl control, ViewModelBase viewModel, string title)
        {
            control.DataContext = viewModel;

            var layout = new LayoutAnchorable();

            layout.Title   = title;
            layout.Content = control;
            layout.AddToLayout(AvalonDockingManager.Instance.DockingManager, AnchorableShowStrategy.Most);
            layout.FloatingWidth  = 300;
            layout.FloatingHeight = 300;
            layout.Float();
        }
コード例 #8
0
ファイル: MainWindow.xaml.cs プロジェクト: noasway/ALight
        public static void OpenOutputWindow()
        {
            var anchorable = new LayoutAnchorable
            {
                AutoHideMinHeight = 200,
                FloatingHeight    = 100,
                AutoHideHeight    = 20,
                Title             = "资源",
                Content           = new Resource()
            };

            anchorable.AddToLayout(MainWindow.main.DockManager, AnchorableShowStrategy.Bottom);
        }
コード例 #9
0
        private void HandleMessage(NotificationMessage obj)
        {
            if (obj.Notification == "OpenChat")
            {
                var window = new LayoutAnchorable()
                {
                    Content        = new ChatViewModel(),
                    FloatingHeight = 500,
                    FloatingWidth  = 200,
                };

                window.AddToLayout(dockMgr, AnchorableShowStrategy.Top);
                window.Float();
            }
        }
コード例 #10
0
 public void Show()
 {
     if (_dockingManager != null)
     {
         var layout = new LayoutAnchorable();
         layout.Closing += LayoutOnClosing;
         layout.AddToLayout(_dockingManager, AnchorableShowStrategy.Most);
         layout.Title = _title;
         if (_userControl != null)
         {
             _userControl.DataContext = _dataContext;
             layout.Content           = _userControl;
         }
         layout.FloatingHeight = 250;
         layout.FloatingWidth  = 345;
         layout.Float();
         layout.Closing += LayoutOnClosing;
         _logger.Info($"Launching LayoutAnchorable Window - Type : {_userControl?.GetType()}, Title : {_title}, DataContext : {_dataContext?.GetType()}");
     }
 }
        public bool BeforeInsertAnchorable(LayoutRoot layout, LayoutAnchorable anchorableToShow, ILayoutContainer destinationContainer)
        {
            bool result = false;

            if (layout != null &&
                anchorableToShow != null)
            {
                var destPane = destinationContainer as LayoutAnchorablePane;
                if (anchorableToShow.Root == null)
                {
                    anchorableToShow.AddToLayout(layout.Manager, GetContentAnchorableStrategy(anchorableToShow));
                    bool isHidden = GetContentAnchorableIsHidden(anchorableToShow);
                    if (isHidden)
                    {
                        anchorableToShow.CanHide = true;
                        anchorableToShow.Hide();
                    }
                    result = true;
                }
                else if (destPane != null && anchorableToShow.IsHidden)
                {
                    // Show a hidden Anchorable.
                    if (anchorableToShow.PreviousContainerIndex < 0)
                    {
                        destPane.Children.Add(anchorableToShow);
                    }
                    else
                    {
                        int insertIndex = anchorableToShow.PreviousContainerIndex;
                        if (insertIndex > destPane.ChildrenCount)
                        {
                            insertIndex = destPane.ChildrenCount;
                        }
                        destPane.Children.Insert(insertIndex, anchorableToShow);
                    }
                    result = true;
                }
            }
            return(result || m_WrappedStrategy.BeforeInsertAnchorable(layout, anchorableToShow, destinationContainer));
        }
コード例 #12
0
ファイル: UiMainDockable.cs プロジェクト: pinguallyj/Pulse
            public void Execute(object parameter)
            {
                UiMainDockableControl window = (UiMainDockableControl)parameter;

                window.HorizontalAlignment = System.Windows.HorizontalAlignment.Stretch;
                window.VerticalAlignment   = System.Windows.VerticalAlignment.Stretch;
                lock (window._lock)
                {
                    LayoutAnchorable layout = window.LayoutAnchorable ?? (window.LayoutAnchorable = window.DockingManager.Layout.Descendents().OfType <LayoutAnchorable>().FirstOrDefault(l => l.Title == window.Header));
                    if (layout == null)
                    {
                        layout = new LayoutAnchorable
                        {
                            ContentId      = window.Header,
                            Title          = window.Header,
                            FloatingWidth  = window.Width,
                            FloatingHeight = window.Height,
                            FloatingLeft   = 200,
                            FloatingTop    = 200,
                            Content        = window
                        };

                        window.LayoutAnchorable = layout;
                        layout.AddToLayout(window.DockingManager, AnchorableShowStrategy.Most);
                        layout.Float();
                    }
                    else
                    {
                        if (layout.IsHidden)
                        {
                            layout.Show();
                        }
                        else
                        {
                            layout.Hide();
                        }
                    }
                }
            }
コード例 #13
0
        private void MenuItem_OnClick(object sender, RoutedEventArgs e)
        {
            LayoutAnchorable la = new LayoutAnchorable();

            la.Content = new TestToolViewModel()
            {
                ButtonText = "Testbutton!",
                Title      = "Tool"
            };
            la.AddToLayout(_docking, AnchorableShowStrategy.Left);

            _documents.Add(new MapViewModel()
            {
                Title           = "Reinfeld",
                ViewPosition    = new MapPointLatLon(53.8367624, 10.4702885),
                CanMove         = true,
                CanZoom         = true,
                DrawCross       = true,
                Zoom            = 12,
                DrawTileBorders = false,
                ZoomMode        = ZoomingType.Center
            });
        }
コード例 #14
0
        public MainWindow()
        {
            InitializeComponent();

            SaveCommandBinding.Command = SaveCommand;
            SaveMenuItem.Command       = SaveCommand;

            SaveLayoutCommandBinding.Command = SaveLayoutCommand;
            SaveLayoutMenuItem.Command       = SaveLayoutCommand;

            ReloadLayoutCommandBinding.Command = ReloadLayoutCommand;
            ReloadLayoutMenuItem.Command       = ReloadLayoutCommand;

            _layoutService = new LayoutService();

            CheckMenuItems();

            var anchorable = new LayoutAnchorable
            {
                Content     = new ConnectionOverview(DisplayConnection),
                Title       = Properties.Resources.Connections,
                ContentId   = "ConnectionsId",
                IsActive    = true,
                IsSelected  = true,
                CanFloat    = true,
                CanAutoHide = true,
                CanClose    = false,
                CanHide     = false
            };

            anchorable.AddToLayout(DockingManager, AnchorableShowStrategy.Left);

            anchorable.DockAsDocument();


            OpenConnectionWithAutoOpen();
        }