private void _document_AnObjectSelected(DOM.UIObjectVM sender, DOM.UIObjectVM selected) { if (AnObjectSelected != null) { AnObjectSelected(sender, selected); } }
private void _document_AnObjectPropertyChanged(DOM.ContainerVM container, DOM.UIObjectVM obj, string propertyName) { if (AnObjectPropertyChanged != null) { AnObjectPropertyChanged(container, obj, propertyName); } }
private void obj_NameChanged(ContainerVM container, UIObjectVM obj, string propertyName) { if (CheckChildExist(propertyName, obj)) { obj.CancelNameChange = true; } }
private void con_AnObjectPropertyChanged(ContainerVM container, UIObjectVM obj, string propertyName) { if (AnObjectPropertyChanged != null) { AnObjectPropertyChanged(container, obj, propertyName); } }
public void AddChild(UIObjectVM obj) { obj.Parent = this; fixObjNaming(obj); obj.Selected += obj_Selected; obj.PropertyChanged += obj_PropertyChanged; obj.NameChanged += obj_NameChanged; obj.Deleted += obj_Deleted; var con = obj as ContainerVM; if (con != null) { con.SelectedAnyChildChanged += con_SelectedAnyChildChanged; con.AnObjectPropertyChanged += con_AnObjectPropertyChanged; } Children.Add(obj); SelectedChild = obj; if (AnObjectPropertyChanged != null) { AnObjectPropertyChanged(this, obj, "added"); } }
private void SelectedChild_SelectedChildChanged(UIObjectVM sender, UIObjectVM selected) { if (AnObjectSelected != null) { AnObjectSelected(sender, selected); } this.SelectedAnyChild = selected; }
private void DocumentVM_SelectedChildChanged(UIObjectVM sender, UIObjectVM selected) { this.SelectedAnyChild = selected; if (AnObjectPropertyChanged != null) { AnObjectPropertyChanged(this, selected, "ObjectSelected"); } }
public void UpdateChildName(UIObjectVM obj, string name) { if (!Children.Contains(obj)) { return; } obj.Name = name; fixObjNaming(obj); }
private void DocumentVM_AnObjectPropertyChanged(ContainerVM container, UIObjectVM obj, string propertyName) { if (AnObjectPropertyChanged != null) { if (container == null) { container = this; } AnObjectPropertyChanged(container, obj, propertyName); } }
private void fixObjNaming(UIObjectVM obj) { int n = 0; while (DocumentVM.Instance.CheckChildExist(obj.Name)) { if (!obj.Name.Contains('_')) { obj.Name += '_' + (n++).ToString(); } else { obj.Name = (obj.Name.Split("_".ToCharArray())[0]) + "_" + (n++).ToString(); } } }
public bool CheckChildExist(string name, UIObjectVM except) { bool retVal = _children.Count(c => c.Name == name && c != except) > 0; if (!retVal) { foreach (ContainerVM container in ChildContainers) { bool inRetVal = container.CheckChildExist(name, except); if (inRetVal) { return(inRetVal); } } } return(retVal); }
public void RemoveChild(UIObjectVM obj) { obj.Selected -= obj_Selected; obj.PropertyChanged -= obj_PropertyChanged; obj.NameChanged -= obj_NameChanged; obj.Deleted -= obj_Deleted; var con = obj as ContainerVM; if (con != null) { con.SelectedAnyChildChanged -= con_SelectedAnyChildChanged; con.AnObjectPropertyChanged -= con_AnObjectPropertyChanged; } if (SelectedChild == obj) { SelectedChild = null; } Children.Remove(obj); }
private void con_SelectedAnyChildChanged(UIObjectVM sender, UIObjectVM selected) { SelectedAnyChild = selected; }
private void obj_Selected(UIObjectVM obj) { SelectedChild = obj; SelectedAnyChild = obj; }
public bool CheckChildExist(UIObjectVM obj) { return(_children.Contains(obj)); }