public void Initialize(IServiceLocator serviceFactory) { this.serviceFactory = serviceFactory; launch = new MenuExtension() { Command = new RelayCommand((obj) => { var workBench = serviceFactory.Resolve <IWorkbenchService>(); var tabItem = new WorkbenchTab("Test Addin Title"); tabItem.Content = new TestUserControl(serviceFactory); workBench.Add(tabItem); }), Name = "Test Addin" }; }
public MainWindow() { InitializeComponent(); DataContext = this.Resources["mainViewModel"] as MainViewModel; internalWorkBench = ((App)App.Current).WorkBench; internalWorkBench.CollectionChanged += WorkBench_CollectionChanged; var intro = new WorkbenchTab("Introduction"); intro.Content = new IntroductionTab(); internalWorkBench.Add(intro); EventManager.RegisterClassHandler(typeof(MainWindow), WorkbenchTab.CloseEvent, new RoutedEventHandler(CloseTabHandler), true); this.Closing += MainWindow_Closing; }