public TestTreeViewItem[] GetMainTestGroups() { var list = new List <TreeViewItemBase>(); list.AddRange(TreeViewItems.Where(x => x.GetType() == typeof(TestTreeViewItem))); return(list.Cast <TestTreeViewItem>().ToArray()); }
public TestFunctionTreeViewItem[] GetOverallTestFunctions() { var list = new List <TreeViewItemBase>(); list.AddRange(TreeViewItems.Where(x => x.GetType() == typeof(TestFunctionTreeViewItem))); //recursive call for childs TreeViewItems.ToList().ForEach(q => list.AddRange(q.GetOverallTestFunctions())); return(list.Cast <TestFunctionTreeViewItem>().ToArray()); }
private IEnumerable <IGeometryPermutation> GetSelectedPermutations(IGeometryModel model) { foreach (var parent in TreeViewItems.Where(i => i.IsChecked != false)) { var region = model.Regions.ElementAtOrDefault((parent.Tag as RenderModel3D.Region)?.SourceIndex ?? -1); if (region == null) { continue; } foreach (var child in parent.Items.Where(i => i.IsChecked == true)) { var permutation = region.Permutations.ElementAtOrDefault((child.Tag as RenderModel3D.Permutation)?.SourceIndex ?? -1); if (permutation != null) { yield return(permutation); } } } }
protected void OnAddTool(object parameter) { if (CurrentItem != null) { if (CurrentItem.GetType() == typeof(TreeViewItem)) { TreeViewItem tvItem = (TreeViewItem)CurrentItem; Tool tool; Project tempProject = null; if (tvItem.DataContext.GetType() == typeof(Project)) { tempProject = (Project)tvItem.DataContext; tool = new Tool(tempProject); tempProject.Tools.Add(tool); } else { tool = new Tool(null); } NewToolDialog ntd = new NewToolDialog(tool); ntd.ShowDialog(); UpdateCurrentItem(); OnPropertyChanged("CurrentItem"); TreeViewItem tvi = new TreeViewItem(); tvi.Header = tool.Name; tvi.DataContext = tool; TreeViewItem tvi_ = null; if (tempProject != null) { tvi_ = TreeViewItems.Where(x => x.Header.ToString() == tempProject.Name).FirstOrDefault(); } if (tvi_ != null) { tvi_.Items.Add(tvi); } else { TreeViewItems.Add(tvi); } Tools.Add(tool); CurrentItem = tvi; } } else { Tool tool = new Tool(); //object tool = new object(); NewToolDialog ntd = new NewToolDialog(tool); ntd.ShowDialog(); UpdateCurrentItem(); OnPropertyChanged("CurrentItem"); TreeViewItem tvi = new TreeViewItem(); tvi.Header = tool.Name; tvi.DataContext = tool; //Items.Add(tool); TreeViewItems.Add(tvi); Tools.Add(tool); CurrentItem = tvi; } }
private IEnumerable <IGeometryPermutation> GetSelectedPermutations() { return(TreeViewItems.Where(i => i.IsChecked != false) .SelectMany(i => i.Items.Where(ii => ii.IsChecked == true)) .Select(i => (i.Tag as MeshTag).Permutation)); }