Exemplo n.º 1
0
        public void AddTab(string tabCaption, TabViewModel tabViewModel = null)
        {
            if (tabViewModel != null)
            {
                TabViewModel = tabViewModel;
            }

            var view = new TabView
            {
                DataContext = TabViewModel
            };

            if (tabViewModel != null)
            {
                tabCaption = tabViewModel.Analyzer.State.GuiString;
                //tabCaption = tabViewModel.TextBoxProperty;
            }

            var documentGroup = _mainView.DockLayoutManager.GetItems()
                                .OfType <DocumentGroup>()
                                .First(dg => dg.Name == "DocumentRegionGroup");

            var layoutPanel = _mainView.DockLayoutManager.DockController.AddDocumentPanel(documentGroup);

            _mainView.DockLayoutManager.DockItemActivated += DockLayoutManagerOnDockItemActivated;

            layoutPanel.Content = view;
            layoutPanel.Caption = tabCaption;

            _mainView.DockLayoutManager.DockController.Activate(layoutPanel);
        }
Exemplo n.º 2
0
 public MainViewModel(Main main)
 {
     _mainView    = main;
     TabViewModel = new TabViewModel(this, null);
     if (AppToSpy.Instance.Application == null)
     {
         EditBaseStateClick();
     }
     OnTabAddClick();
 }
Exemplo n.º 3
0
        private void DockLayoutManagerOnDockItemActivated(object sender, DockItemActivatedEventArgs ea)
        {
            var documentLayoutManager = sender as DockLayoutManager;
            var documentPanel         = documentLayoutManager?.ActiveDockItem as DocumentPanel;
            var tabView = documentPanel?.Content as TabView;

            if (tabView == null)
            {
                return;
            }

            this.TabViewModel = tabView.DataContext as TabViewModel;
        }