Beispiel #1
0
 private void _document_AnObjectSelected(DOM.UIObjectVM sender, DOM.UIObjectVM selected)
 {
     if (AnObjectSelected != null)
     {
         AnObjectSelected(sender, selected);
     }
 }
Beispiel #2
0
 private void _document_AnObjectPropertyChanged(DOM.ContainerVM container, DOM.UIObjectVM obj, string propertyName)
 {
     if (AnObjectPropertyChanged != null)
     {
         AnObjectPropertyChanged(container, obj, propertyName);
     }
 }
Beispiel #3
0
 private void obj_NameChanged(ContainerVM container, UIObjectVM obj, string propertyName)
 {
     if (CheckChildExist(propertyName, obj))
     {
         obj.CancelNameChange = true;
     }
 }
Beispiel #4
0
 private void con_AnObjectPropertyChanged(ContainerVM container, UIObjectVM obj, string propertyName)
 {
     if (AnObjectPropertyChanged != null)
     {
         AnObjectPropertyChanged(container, obj, propertyName);
     }
 }
Beispiel #5
0
        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");
            }
        }
Beispiel #6
0
        private void SelectedChild_SelectedChildChanged(UIObjectVM sender, UIObjectVM selected)
        {
            if (AnObjectSelected != null)
            {
                AnObjectSelected(sender, selected);
            }

            this.SelectedAnyChild = selected;
        }
Beispiel #7
0
        private void DocumentVM_SelectedChildChanged(UIObjectVM sender, UIObjectVM selected)
        {
            this.SelectedAnyChild = selected;

            if (AnObjectPropertyChanged != null)
            {
                AnObjectPropertyChanged(this, selected, "ObjectSelected");
            }
        }
Beispiel #8
0
        public void UpdateChildName(UIObjectVM obj, string name)
        {
            if (!Children.Contains(obj))
            {
                return;
            }

            obj.Name = name;
            fixObjNaming(obj);
        }
Beispiel #9
0
        private void DocumentVM_AnObjectPropertyChanged(ContainerVM container, UIObjectVM obj, string propertyName)
        {
            if (AnObjectPropertyChanged != null)
            {
                if (container == null)
                {
                    container = this;
                }

                AnObjectPropertyChanged(container, obj, propertyName);
            }
        }
Beispiel #10
0
        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();
                }
            }
        }
Beispiel #11
0
        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);
        }
Beispiel #12
0
        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);
        }
Beispiel #13
0
 private void con_SelectedAnyChildChanged(UIObjectVM sender, UIObjectVM selected)
 {
     SelectedAnyChild = selected;
 }
Beispiel #14
0
 private void obj_Selected(UIObjectVM obj)
 {
     SelectedChild    = obj;
     SelectedAnyChild = obj;
 }
Beispiel #15
0
 public bool CheckChildExist(UIObjectVM obj)
 {
     return(_children.Contains(obj));
 }