Ejemplo n.º 1
0
        public ChildObjectViewModel(
            TreeViewViewModel treeParent,
            CompoundObjectViewModel parentVm,
            MainViewModel mainVm,
            ChildObject modelObject,
            bool enabled = true) :
            base(treeParent, parentVm, mainVm, enabled)
        {
            ModelObject = modelObject;

            foreach (TStateProperties <ChildObjectStateProperties> cosp in ModelObject.StateProperties)
            {
                ChildCOViewModel cospvm = new ChildCOViewModel(this, parentVm, mainVm, cosp, enabled);
                StateProperties.Add(cospvm);

                // Since this COVM is the child of another COVM we need to check if the COVM
                // is a reference to a file or not. If it is, the children of the COVM shall
                // not be selectable, i.e. they shall be disabled. If it it is not a file ref
                // it shall be selectable.
                if (cospvm.IsFileReferenceChild)
                {
                    cospvm.BuildViewModel(false);
                }
                else
                {
                    cospvm.BuildViewModel(true);
                }
            }
        }
Ejemplo n.º 2
0
        public ChildObjectViewModel(
            TreeViewViewModel treeParent,
            CompoundObjectViewModel parentVm,
            MainViewModel mainVm,
            ChildObject modelObject,
            bool enabled = true) :
            base(treeParent, parentVm, mainVm, enabled)
        {
            ModelObject = modelObject;

            if (_modelObject.CompObj != null)
            {
                CompObj = new ChildCOViewModel(this, parentVm, mainVm, _modelObject.CompObj, enabled);
                _co.Clear();
                _co.Add(CompObj);

                if (IsFileReferenceChild)
                {
                    CompObj.BuildViewModel(false);
                }
                else
                {
                    CompObj.BuildViewModel(true);
                }
            }
            else
            {
                CompObj = null;
            }
        }