コード例 #1
0
        public KeyboardPropertiesViewModel(IDataModel dataModel, LayerPropertiesModel properties)
            : base(dataModel)
        {
            var keyboardProperties = (KeyboardPropertiesModel)properties;

            ProposedProperties = GeneralHelpers.Clone(keyboardProperties);
            Brush = ProposedProperties.Brush.CloneCurrentValue();

            DataModelProps = new BindableCollection <GeneralHelpers.PropertyCollection>();
            DataModelProps.AddRange(GeneralHelpers.GenerateTypeMap(dataModel));

            HeightProperties  = new LayerDynamicPropertiesViewModel("Height", DataModelProps, keyboardProperties);
            WidthProperties   = new LayerDynamicPropertiesViewModel("Width", DataModelProps, keyboardProperties);
            OpacityProperties = new LayerDynamicPropertiesViewModel("Opacity", DataModelProps, keyboardProperties);
        }
コード例 #2
0
        public LayerEditorViewModel(IDataModel dataModel, LayerModel layer)
        {
            _dataModel = dataModel;

            Layer         = layer;
            ProposedLayer = GeneralHelpers.Clone(layer);

            if (Layer.Properties == null)
            {
                Layer.SetupProperties();
            }

            DataModelProps = new BindableCollection <GeneralHelpers.PropertyCollection>();
            DataModelProps.AddRange(GeneralHelpers.GenerateTypeMap(dataModel));
            LayerConditionVms = new BindableCollection <LayerConditionViewModel>(layer.Properties.Conditions
                                                                                 .Select(c => new LayerConditionViewModel(this, c, DataModelProps)));

            PropertyChanged += PropertiesViewModelHandler;

            PreSelect();
        }
コード例 #3
0
        public LayerEditorViewModel(LayerModel layer, ModuleDataModel dataModel, IEnumerable <ILayerType> types,
                                    IEnumerable <ILayerAnimation> layerAnimations)
        {
            Layer         = layer;
            ProposedLayer = GeneralHelpers.Clone(layer);
            ProposedLayer.Children.Clear();
            DataModel       = DataModel;
            LayerTypes      = new BindableCollection <ILayerType>(types.OrderBy(t => t.Name));
            LayerAnimations = layerAnimations.OrderBy(l => l.Name).ToList();

            DataModelProps = new BindableCollection <GeneralHelpers.PropertyCollection>(GeneralHelpers.GenerateTypeMap(dataModel));

            if (Layer.Properties == null)
            {
                Layer.SetupProperties();
            }

            // Setup existing conditions
            var conditions = ProposedLayer.Properties.Conditions.Select(c => new LayerConditionViewModel(this, c));
            var keyBinds   = ProposedLayer.Properties.LayerKeybindModels.Select(c => new LayerKeybindViewModel(this, c));

            LayerConditionVms = new BindableCollection <LayerConditionViewModel>(conditions);
            LayerKeybindVms   = new BindableCollection <LayerKeybindViewModel>(keyBinds);

            PropertyChanged += PropertiesViewModelHandler;

            // Setup existiing properties
            PreSelect();
        }