private void TreeView_Selected(object sender, RoutedEventArgs e) { TreeView tree = sender as TreeView; if (tree != null) { TreeViewItem ti = e.OriginalSource as TreeViewItem; if (ti != null) { ti.IsExpanded = !ti.IsExpanded; } M_SolutionClass s = tree.SelectedItem as M_SolutionClass; if (s != null) { GetSolutionParents(s); SetTextBoxBindings(); } else { M_ProjectClass p = tree.SelectedItem as M_ProjectClass; if (p != null) { GetProjectParents(p); SetTextBoxBindings(); //this.currentProjectItem = ti; } else { M_ProjectVersionClass v = tree.SelectedItem as M_ProjectVersionClass; if (v != null) { GetProjectVersionParents(v); SetTextBoxBindings(); } } } } }
/// <summary> /// 获取解决方案的递归父级对象 /// </summary> /// <param name="solution"></param> private void GetSolutionParents(M_SolutionClass solution) { if (this.currentSolutionCollection != null && this.currentSolutionCollection.SolutionsCollection != null && this.currentSolutionCollection.SolutionsCollection.Count > 0) { foreach (M_SolutionClass s in this.currentSolutionCollection.SolutionsCollection) { if (s.Equals(solution)) { this.currentSolution = s; this.currentProject = (this.currentSolution == null)? null : s.CurrentProject; this.currentVersion = (this.currentProject == null) ? null : this.currentProject.CurrentProjectVersion; return; } } } }
private void GetValuesHandler(object sender, PassValuesEventArgs args) { //获取新建的解决方案 NewSolutionWindow nsw = sender as NewSolutionWindow; if (nsw != null && args != null) { bool flag = args.Flag; if (flag == true) { M_SolutionClass m = args.Result as M_SolutionClass; if (m != null) { this.currentSolutionCollection.SolutionsCollection.Add(m); } } this.otherLb.Content = args.Description; } else { NewProjectWindow npw = sender as NewProjectWindow; if (nsw != null && args != null) { bool flag = args.Flag; if (flag == true) { M_ProjectClass m = args.Result as M_ProjectClass; if (m != null) { this.currentSolution.SolutionProjectsCollection.Add(m); } } this.otherLb.Content = args.Description; } else { ArchiveProjectWindow apw = sender as ArchiveProjectWindow; if (apw != null && args != null) { //bool flag = args.Flag; //if (flag == true) //{ // M_SolutionClass m = args.Result as M_SolutionClass; // if (m != null) // { // this.currentSolutionCollection.SolutionsCollection.Add(m); // } //} this.otherLb.Content = args.Description; //更新解决方案显示 //this.currentProjectItem.Header = this.currentProject.CurrentProjectVersion.Name; } else { this.otherLb.Content = "Incorrect Sender or Invalid args"; } } } }