Exemple #1
0
        public DefaultLayoutFactory()
        {
            _documents = new ObservableCollection <IView>();

            _documentDock = new DocumentDock
            {
                Id            = "DocumentsPane",
                Proportion    = double.NaN,
                Title         = "DocumentsPane",
                CurrentView   = null,
                IsCollapsable = false,
                Views         = _documents
            };

            _centerPane = new LayoutDock
            {
                Id          = $"CenterPane",
                Proportion  = double.NaN,
                Orientation = Orientation.Vertical,
                Title       = $"CenterPane",
                CurrentView = null,
                Views       = CreateList <IView>
                              (
                    _documentDock
                              )
            };
        }
        public AvalonStudioPerspective(IView root, ILayoutDock centerPane, IDocumentDock documentDock)
        {
            DocumentDock = documentDock;
            CenterPane   = centerPane;
            Root         = root;
            _tools       = new List <IToolViewModel>();
            _tabTools    = new Dictionary <IToolViewModel, IView>();

            CenterPane.WhenAnyValue(l => l.FocusedView).Subscribe(focused =>
            {
                if (focused?.Context is IToolViewModel tool)
                {
                    SelectedTool = tool;
                }
                else
                {
                    SelectedTool = null;
                }
            });
        }
Exemple #3
0
        internal bool ValidateLayout(ILayoutDock sourceLayout, IView targetView, DragAction action, DockOperation operation, bool bExecute)
        {
            switch (targetView)
            {
            case IRootDock targetRoot:
            {
                return(false);
            }

            case IToolTab sourceToolTab:
            {
                return(false);
            }

            case IDocumentTab sourceDocumentTab:
            {
                return(false);
            }

            case ILayoutDock targetLayout:
            {
                return(false);
            }

            case ITabDock targetTab:
            {
                return(false);
            }

            default:
            {
#if DEBUG
                Console.WriteLine($"Not supported type {targetView.GetType()}: {sourceLayout} -> {targetView}");
#endif
                return(false);
            }
            }
        }