Esempio n. 1
0
        public ParallaxBackgroundViewModel(
            ChildCOViewModel parentVm,
            MainViewModel mainVm,
            ParallaxBackgroundPropertiesViewModel pbpvm)
        {
            _parentCompoundObjectVm = parentVm;
            _mainVm             = mainVm;
            _parentBackgroundVm = pbpvm;

            _shapes = new CompositeCollection()
            {
                new CollectionContainer {
                    Collection = new ObservableCollection <LfSpriteBoxViewModel>()
                },
                new CollectionContainer {
                    Collection = new ObservableCollection <LfSpritePolygonViewModel>()
                },
            };

            foreach (Object o in parentVm.ShapeCollection.Shapes)
            {
                if (o is LfSpriteBoxViewModel)
                {
                    LfSpriteBoxViewModel svm = o as LfSpriteBoxViewModel;
                    _shapes.Add(svm);
                }
                else if (o is LfSpritePolygonViewModel)
                {
                    LfSpritePolygonViewModel svm = o as LfSpritePolygonViewModel;
                    _shapes.Add(svm);
                }
            }
        }
Esempio 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;
            }
        }
Esempio n. 3
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);
                }
            }
        }
        public virtual Point GetCoPointFromScenePoint(Point scenePoint)
        {
            if (this is ChildCOViewModel)
            {
                ChildCOViewModel vm = this as ChildCOViewModel;

                Point parentPoint = vm.CoPointFromParent(scenePoint);
                return(GetCoPointFromScenePoint(parentPoint));
            }
            else
            {
                return(scenePoint);
            }
        }
Esempio n. 5
0
        public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            if (value is ChildCOViewModel)
            {
                ChildCOViewModel     vm   = value as ChildCOViewModel;
                ChildObjectViewModel chvm = vm.TreeParent as ChildObjectViewModel;

                string s = chvm.Name + " State Properties";

                return(s);
            }

            if (value is string)
            {
                string s = (string)value + " State Properties";

                return(s);
            }

            return(null);
        }