示例#1
0
        public Boolean BeforeInsertAnchorable(LayoutRoot layout, LayoutAnchorable anchorableToShow, ILayoutContainer destinationContainer)
        {
            if (anchorableToShow.Content is ITool tool)
            {
                PaneLocation         preferredLocation = tool.PreferredLocation;
                String               paneName          = GetPaneName(preferredLocation);
                LayoutAnchorablePane toolsPane         = layout.Descendents().OfType <LayoutAnchorablePane>().FirstOrDefault(d => d.Name == paneName);
                if (toolsPane == null)
                {
                    switch (preferredLocation)
                    {
                    case PaneLocation.Left:
                        toolsPane = CreateAnchorablePane(layout, Orientation.Horizontal, paneName, InsertPosition.Start);
                        break;

                    case PaneLocation.Right:
                        toolsPane = CreateAnchorablePane(layout, Orientation.Horizontal, paneName, InsertPosition.End);
                        break;

                    case PaneLocation.Bottom:
                        toolsPane = CreateAnchorablePane(layout, Orientation.Vertical, paneName, InsertPosition.End);
                        break;

                    default:
                        throw new ArgumentOutOfRangeException();
                    }
                }
                toolsPane.Children.Add(anchorableToShow);
                return(true);
            }

            return(false);
        }
示例#2
0
        public static InitialPaneLocation ToInitialPaneLocation(this PaneLocation location)
        {
            InitialPaneLocation initialPaneLocation;

            switch (location)
            {
            case PaneLocation.DockedLeft:
            case PaneLocation.DockedRight:
            case PaneLocation.DockedTop:
            case PaneLocation.DockedBottom:
            case PaneLocation.FloatingOnly:

                initialPaneLocation = (InitialPaneLocation)Enum.Parse(typeof(InitialPaneLocation), location.ToString());

                break;

            case PaneLocation.Floating:     //DockableFloating
                initialPaneLocation = (InitialPaneLocation)Enum.Parse(typeof(InitialPaneLocation), "DockableFloating");
                break;

            case PaneLocation.Unpinned:    //Not
            case PaneLocation.Document:    //Not
            case PaneLocation.Unknown:     //Not
                throw new InvalidOperationException("Can not convert PaneLocation to InitialPaneLocation");

            default:
                throw new ArgumentOutOfRangeException("location");
            }

            return(initialPaneLocation);
        }
示例#3
0
 private static string GetPaneName(PaneLocation location)
 {
     switch (location)
     {
         case PaneLocation.Left:
             return "LeftPane";
         case PaneLocation.Right:
             return "RightPane";
         case PaneLocation.Bottom:
             return "BottomPane";
         default:
             throw new ArgumentOutOfRangeException("location");
     }
 }
示例#4
0
        private static string GetPaneName(PaneLocation location)
        {
            switch (location)
            {
            case PaneLocation.Left:
                return("LeftPane");

            case PaneLocation.Right:
                return("RightPane");

            case PaneLocation.Bottom:
                return("BottomPane");

            default:
                throw new ArgumentOutOfRangeException("location");
            }
        }
示例#5
0
        private static LayoutAnchorGroup FindAnchorableGroup(LayoutRoot layout,
                                                             PaneLocation location)
        {
            try
            {
                LayoutAnchorSide panelGroupParent = null;

                switch (location)
                {
                case PaneLocation.Left:
                    panelGroupParent = layout.LeftSide;
                    break;

                case PaneLocation.Right:
                    panelGroupParent = layout.RightSide;
                    break;

                case PaneLocation.Bottom:
                    panelGroupParent = layout.BottomSide;
                    break;

                default:
                    throw new ArgumentOutOfRangeException("location:" + location);
                }

                if (panelGroupParent.Children.Count == 0)
                {
                    var layoutAnchorGroup = new LayoutAnchorGroup();

                    panelGroupParent.Children.Add(layoutAnchorGroup);

                    return(layoutAnchorGroup);
                }
                else
                {
                    return(panelGroupParent.Children[0]);
                }
            }
            catch (Exception exp)
            {
                logger.Error(exp);
            }

            return(null);
        }
 public DummyTool(PaneLocation preferredLocation)
 {
     _preferredLocation = preferredLocation;
     IsVisible          = false;
 }
 private static string GetPaneName(PaneLocation location) => location switch
 {
示例#8
0
            static SplitPane FindSplitPaneWithLocationOrCreate(XamDockManager dockManager, PaneLocation location)
            {
                SplitPane pane = FindSplitPaneWithLocation(dockManager, location);

                if (pane != null)
                {
                    return(pane);
                }

                pane = new SplitPane();
                XamDockManager.SetInitialLocation(pane, location.ToInitialPaneLocation());

                return(pane);
            }
示例#9
0
 static SplitPane FindSplitPaneWithLocation(XamDockManager dockManager, PaneLocation location)
 {
     return(dockManager.Panes.FirstOrDefault(p => GetSplitPaneLocation(p) == location));
 }
            static SplitPane FindSplitPaneWithLocationOrCreate(XamDockManager dockManager, PaneLocation location)
            {
                SplitPane pane = FindSplitPaneWithLocation(dockManager, location);

                if(pane != null)
                    return pane;

                pane = new SplitPane();
                XamDockManager.SetInitialLocation(pane, location.ToInitialPaneLocation());

                return pane;
            }
 static SplitPane FindSplitPaneWithLocation(XamDockManager dockManager, PaneLocation location)
 {
     return dockManager.Panes.FirstOrDefault(p => GetSplitPaneLocation(p) == location);
 }