private static List <ModelSystemStructureDisplayModel> BuildChainTo(ModelSystemStructureDisplayModel selected, ModelSystemStructureDisplayModel current) { if (selected == current) { return(new List <ModelSystemStructureDisplayModel>() { current }); } var children = current.Children; if (children != null) { foreach (var child in children) { var ret = BuildChainTo(selected, child); if (ret != null) { ret.Insert(0, current); return(ret); } } } return(null); }
public ParameterDisplayModel(ModelSystemStructureDisplayModel realParameter, bool multipleSelected = false) { //RealParameter = realParameter.BaseModel.; _MultipleSelected = multipleSelected; realParameter.PropertyChanged += RealParameter_PropertyChanged; FontColour = RealParameter.IsHidden ? Brushes.DarkGray : Brushes.White; }
private ModelSystemStructureDisplayModel MapModuleWithPath(ModelSystemStructureDisplayModel root, List <int> path) { var current = root; for (int i = 0; i < path.Count; i++) { current = current.Children[path[i]]; } return(current); }
public ModelSystemStructureDisplayModel(ModelSystemStructureModel baseModel, ModelSystemStructureDisplayModel parent, int index) { //BaseChildren. Parent = parent; Index = index; BaseModel = baseModel; _BaseChildren = baseModel.Children; UpdateChildren(baseModel); BaseModel.PropertyChanged += BaseModel_PropertyChanged; if (_BaseChildren != null) { _BaseChildren.CollectionChanged += BaseChildren_CollectionChanged; } }
public ValidationErrorDisplayModel(ModelSystemStructureDisplayModel root, string error, IReadOnlyList <int> path) { ErrorString = error; if (path == null) { DisplayModule = null; } else if (path.Count == 0) { DisplayModule = root; } else { // make a copy of the path in case something else is also going to use it DisplayModule = MapModuleWithPath(root, path.ToList()); } }
private static List<ModelSystemStructureDisplayModel> BuildChainTo(ModelSystemStructureDisplayModel selected, ModelSystemStructureDisplayModel current) { if(selected == current) { return new List<ModelSystemStructureDisplayModel>() { current }; } var children = current.Children; if(children != null) { foreach(var child in children) { var ret = BuildChainTo(selected, child); if(ret != null) { ret.Insert(0, current); return ret; } } } return null; }
internal List<ModelSystemStructureDisplayModel> BuildChainTo(ModelSystemStructureDisplayModel selected) { return BuildChainTo(selected, this); }
internal List <ModelSystemStructureDisplayModel> BuildChainTo(ModelSystemStructureDisplayModel selected) { return(BuildChainTo(selected, this)); }
private UIElement GetCurrentlySelectedControl(ModelSystemStructureDisplayModel current, ModelSystemStructureDisplayModel lookingFor, TreeViewItem previous = null) { var children = current.Children; var container = (previous == null ? ModuleDisplay.ItemContainerGenerator.ContainerFromItem(current) : previous.ItemContainerGenerator.ContainerFromItem(current)) as TreeViewItem; if(current == lookingFor && container != null) { return container; } if(children != null) { foreach(var child in children) { var childResult = GetCurrentlySelectedControl(child, lookingFor, container); if(childResult != null) { return childResult; } } } return null; }
private ObservableCollection<ModelSystemStructureDisplayModel> CreateDisplayModel(ModelSystemStructureModel root) { var ret = new ObservableCollection<ModelSystemStructureDisplayModel>() { (DisplayRoot = new ModelSystemStructureDisplayModel(root)) }; return ret; }
private bool CheckFilterRec(ModelSystemStructureDisplayModel module, string filterText, TreeViewItem previous = null) { var children = module.Children; var show = false; var contianer = (previous == null ? ModuleDisplay.ItemContainerGenerator.ContainerFromItem(module) : previous.ItemContainerGenerator.ContainerFromItem(module)) as TreeViewItem; if(children != null) { foreach(var child in children) { if(CheckFilterRec(child, filterText, contianer)) { show = true; } } } if(!show) { show = module.Name.IndexOf(filterText, StringComparison.CurrentCultureIgnoreCase) >= 0; } if(contianer != null) { contianer.Visibility = show ? Visibility.Visible : Visibility.Collapsed; } return show; }