Пример #1
0
        private void Show_LineChart(object sender, EventArgs e)
        {
            // 后续需要有一个界面元素管理类;
            LayoutAnchorable sub     = new LayoutAnchorable();
            LinechartContent content = new LinechartContent();

            // 当前的问题:这个Title显示不出来;
            sub.Title          = "折线图";
            sub.FloatingHeight = 400;
            sub.FloatingWidth  = 800;
            sub.Content        = content;
            sub.FloatingLeft   = 200;
            sub.FloatingTop    = 200;
            sub.CanClose       = true;
            sub.CanAutoHide    = false;

            this.Pane.Children.Add(sub);
            sub.Float();

            // 当窗口发生变化时;
            sub.PropertyChanged += content.WindowProperty_Changed;
            sub.Closed          += content.Sub_Closed;

            /* 后续使用真实数据;
             * //Add by Mayi
             * //实现鼠标的拖拽,这里通过一个简单的TreeView 做个演示
             * TreeView myTree = new TreeView();
             *
             * var originStyle = myTree.Style;
             * var newStyle = new Style();
             * newStyle.BasedOn = originStyle;
             *
             * //为鼠标移动添加事件
             * newStyle.Setters.Add(new EventSetter(MouseMoveEvent, new MouseEventHandler(TreeViewItem_MouseMove)));
             * myTree.ItemContainerStyle = newStyle;
             *
             * //构造一个简单的TreeView
             * TreeViewItem RootItem1 = new TreeViewItem();
             * RootItem1.Header = "RootItem1";
             * myTree.Items.Add(RootItem1);
             *
             * TreeViewItem SubItem1 = new TreeViewItem();
             * SubItem1.Header = "SubItem1";
             * RootItem1.Items.Add(SubItem1);
             *
             * TreeViewItem SubSubItem1 = new TreeViewItem();
             * SubSubItem1.Header = "SubSubItem";
             * SubItem1.Items.Add(SubSubItem1);
             *
             * TreeViewItem RootItem2 = new TreeViewItem();
             * RootItem2.Header = "RootItem2";
             * myTree.Items.Add(RootItem2);
             *
             * //显示到主界面
             * this.FavLeaf_Lists.Children.Add(myTree);
             */
        }
Пример #2
0
        private void shownewpanel(object sender, RoutedEventArgs e)
        {
            LayoutAnchorable sub = new LayoutAnchorable();

            this.pane1.Children.Add(sub);
            sub.Title     = "aa";
            sub.IsVisible = true;
            sub.Float();
        }
Пример #3
0
        private void newFLoatingGraph_Click(object sender, RoutedEventArgs e)
        {
            LayoutAnchorable la = new LayoutAnchorable {
                Title = "Graph Editor: Floating", FloatingHeight = 400, FloatingWidth = 500, Content = new GraphEditor(), CanClose = true
            };

            la.AddToLayout(dockingManager, AnchorStrat);
            la.Float();
        }
Пример #4
0
        private void ShowFlowChart(object sender, EventArgs e)
        {
            LayoutAnchorable sub     = new LayoutAnchorable();
            FlowChart        content = new FlowChart();

            sub.Content        = content;
            sub.FloatingHeight = 300;
            sub.FloatingWidth  = 800;

            this.Pane.Children.Add(sub);
            sub.Float();
        }
Пример #5
0
        public void ShowContentFloating_withSize(object obj, double DialogWindowWidth, double DialogWindowHeight)
        {
            LayoutAnchorable a = _ShowContent(obj);


            a.FloatingTop  = this.Top + (this.Height / 2) - (Math.Min(this.Height, DialogWindowHeight) / 2);
            a.FloatingLeft = this.Left + (this.Width / 2) - (Math.Min(this.Width, DialogWindowWidth) / 2);

            a.FloatingWidth  = DialogWindowWidth;
            a.FloatingHeight = DialogWindowHeight;

            a.Float();
        }
        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();
        }
        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();
            }
        }
Пример #8
0
 public void Show()
 {
     if (_model.IsFloat || _model.IsDock)
     {
         return;
     }
     //if (!_model.IsActive)
     // {
     called_Show = true;
     _model.Root.Manager.ShowAutoHideWindow(this);
     _model.IsActive = true;
     if (LayoutSetting.GetDefaultIsFloatAnchorable(_model.Title))
     {
         _model.Float();
     }
     // }
 }
 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()}");
     }
 }
Пример #10
0
            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();
                        }
                    }
                }
            }
Пример #11
0
        public void AddDockAbleContent(FrmState thisState, object thisControl, string name)
        {
            string name2 = null;
            int    count = ViewDictionary.Count(d => d.Name == name);

            if (count != 0)
            {
                name2 = name + count;
            }
            else
            {
                name2 = name;
            }
            var viewitem            = new ViewItem(thisControl, name, thisState);
            LayoutAnchorable layout = null;

            ViewDictionary.Add(viewitem);
            try
            {
                switch (thisState)
                {
                case FrmState.Large:
                    layout = Factory(name, thisControl);
                    documentMain.Children.Add(layout);

                    layout.IsActive = true;
                    break;

                case FrmState.Buttom:
                    layout = Factory(name, thisControl);

                    var view = thisControl as DebugManagerUI;
                    if (view != null)
                    {
                        RichTextBoxAppender.SetRichTextBox(view.richtextBox, DebugText);
                    }

                    documentButtom.Children.Add(layout);

                    layout.IsActive = true;
                    break;

                case FrmState.Middle:
                    layout             = Factory(name, thisControl);
                    viewitem.Container = layout;
                    dockablePane1.Children.Add(layout);

                    layout.IsActive = true;
                    break;

                case FrmState.Mini:
                    layout             = Factory(name, thisControl);
                    viewitem.Container = layout;
                    dockablePane2.Children.Add(layout);

                    layout.IsActive = true;
                    break;

                case FrmState.Custom:
                    var window = new Window {
                        Title = name
                    };
                    window.Content = thisControl;
                    window.ShowDialog();
                    break;

                case FrmState.Float:

                    layout = Factory(name, thisControl);

                    dockablePane2.Children.Add(layout);

                    layout.Float();

                    break;
                }
                viewitem.Container = layout;
            }
            catch (Exception ex)
            {
                XLogSys.Print.ErrorFormat("{0}{1},{2}", Core.Properties.Resources.ControlLoad, Core.Properties.Resources.Error, ex.Message);
            }
        }
Пример #12
0
        public void AddDockAbleContent(FrmState thisState, object thisControl, string name)
        {
            string name2 = null;
            var    count = ViewDictionary.Count(d => d.Name == name);

            if (count != 0)
            {
                name2 = name + count;
            }
            else
            {
                name2 = name;
            }
            var viewitem            = new ViewItem(thisControl, name, thisState);
            LayoutAnchorable layout = null;

            ViewDictionary.Add(viewitem);
            try
            {
                switch (thisState)
                {
                case FrmState.Large:
                    layout = Factory(name, thisControl);
                    documentMain.Children.Add(layout);

                    layout.IsActive = true;
                    break;

                case FrmState.Buttom:
                    layout = Factory(name, thisControl);

                    var view = thisControl as DebugManagerUI;
                    if (view != null)
                    {
                        RichTextBoxAppender.SetRichTextBox(view.richtextBox, DebugText, notifier);
                    }

                    documentButtom.Children.Add(layout);
                    documentButtom.Children.RemoveElementsNoReturn(d => d.Content == null);
                    layout.IsActive = true;
                    layout.CanClose = false;
                    break;

                case FrmState.Middle:
                    layout             = Factory(name, thisControl);
                    viewitem.Container = layout;
                    dockablePane1.Children.Add(layout);
                    dockablePane1.Children.RemoveElementsNoReturn(d => d.Content == null);
                    layout.IsActive = true;
                    layout.CanClose = false;
                    break;

                case FrmState.Mini:
                    layout             = Factory(name, thisControl);
                    viewitem.Container = layout;
                    dockablePane2.Children.Add(layout);
                    dockablePane2.Children.RemoveElementsNoReturn(d => d.Content == null);
                    layout.IsActive = true;
                    break;

                case FrmState.Mini2:
                    layout             = Factory(name, thisControl);
                    viewitem.Container = layout;
                    dockablePane3.Children.Add(layout);
                    dockablePane3.Children.RemoveElementsNoReturn(d => d.Content == null);
                    layout.IsActive = true;
                    layout.CanClose = false;
                    break;

                case FrmState.Custom:
                    var window = new Window {
                        Title = name
                    };
                    window.Content = thisControl;
                    window.ShowDialog();
                    break;

                case FrmState.Float:

                    layout = Factory(name, thisControl);

                    dockablePane1.Children.Add(layout);

                    layout.Float();

                    break;
                }
                var canNotClose = new[]
                { GlobalHelper.Get("ModuleMgmt"), GlobalHelper.Get("SysState"), GlobalHelper.Get("DebugView") };
                if (canNotClose.Contains(name))
                {
                    if (layout != null)
                    {
                        layout.CanClose = false;
                    }
                }
                viewitem.Container = layout;
            }
            catch (Exception ex)
            {
                XLogSys.Print.ErrorFormat("{0}{1},{2}", GlobalHelper.Get("ControlLoad"), GlobalHelper.Get("Error"),
                                          ex.Message);
            }
        }