private void OpenTestProject(TestProjectInfo testProjectInfo) { if (testProjectInfo != null) { LayoutDocumentPane firstDocumentPane = dockManager.Layout.Descendents().OfType <LayoutDocumentPane>().FirstOrDefault(); LayoutDocument doc = new LayoutDocument(); doc.Title = testProjectInfo.Name; doc.ToolTip = testProjectInfo.Location; LayoutContent temp = firstDocumentPane.Children.FirstOrDefault(o => o.Title == doc.Title && o.ToolTip.ToString() == doc.ToolTip.ToString()); if (temp != null && temp is LayoutDocument) { doc = temp as LayoutDocument; } else { TestMethodListView listView = new TestMethodListView(); //listView.ComboBoxRespository.Visibility = Visibility.Collapsed; (listView.DataContext as TestMethodListViewModel).CurrentTestProject = testProjectInfo; doc.Content = listView; firstDocumentPane.Children.Add(doc); } doc.IsActive = true; doc.Closing += this.Doc_Closing; } }
private void Doc_Closing(object sender, System.ComponentModel.CancelEventArgs e) { LayoutContent doc = sender as LayoutContent; TestMethodListView listView = doc.Content as TestMethodListView; TestProjectInfo projectInfo = (listView.DataContext as TestMethodListViewModel).CurrentTestProject; TestProjectsViewModel testProjectsView = this.testProjectView.DataContext as TestProjectsViewModel; testProjectsView.CloseTestProjectCommand.Execute(projectInfo); }