public virtual bool TryResetChild(IExecutableStep child, string rootId = null) { if (child.Root != null) { return(false); } if (!string.IsNullOrEmpty(rootId)) { if (rootId == Id) { return(ResetChild(child)); } var rootStep = FindExecutableStepById(rootId); if (rootStep != null) { return(rootStep.TryResetChild(child, rootId)); } return(false); } var root = FindExecutableStepById(child.Id)?.Root; if (root != null) { return(root.TryResetChild(child, root.Id)); } return(false); }
public bool TryAddChild(IExecutableStep child, string rootId = null) { if (child == null) { return(false); } if (child.Root != null) { return(false); } if (string.IsNullOrEmpty(rootId)) { return(AddChild(child)); } if (rootId == Id) { return(AddChild(child)); } var root = FindExecutableStepById(rootId); if (root != null) { return(root.TryAddChild(child)); } return(false); }
private UserControl ShowStepUserControl(IExecutableStep step) { if (step == null) { return(null); } var type = step.GetType().FullName; return(stepControls[type]); }
private bool AddChild(IExecutableStep child) { if (CheckAllChildsIsNotRecource(child)) { _childs.Add(child); child.Root = this; //OnPropertyChanged(nameof(Childs)); return(true); } return(false); }
private bool ResetChild(IExecutableStep child) { if (CheckAllChildsIsNotRecource(child)) { for (var i = 0; i < _childs.Count; i++) { if (child.Id == _childs[i].Id) { _childs[i] = child; child.Root = this; return(true); } } } return(false); }
public bool TryRemoveChild(IExecutableStep child) { if (child?.Root == null) { return(false); } if (_childs.Contains(child)) { _childs.Remove(child); //OnPropertyChanged(nameof(Childs)); return(true); } var step = FindExecutableStepById(child.Root.Id); return(step.TryRemoveChild(child)); }
public virtual IExecutableStep TryGetStepById(string id) { IExecutableStep step = null; if (id == Id) { step = this; } else { foreach (var child in Childs) { step = child.TryGetStepById(id); if (step != null) { break; } } } return(step); }
private bool CheckAllChildsIsNotRecource(IExecutableStep child) { return(child.FindExecutableStepById(Id) == null); }