public LayerEditorViewModel(LayerModel layer, IDataModel dataModel, IEnumerable <ILayerType> types, List <ILayerAnimation> layerAnimations) { Layer = layer; ProposedLayer = Clone(layer); ProposedLayer.Children.Clear(); DataModel = DataModel; LayerTypes = new BindableCollection <ILayerType>(types); LayerAnimations = layerAnimations; DataModelProps = new BindableCollection <PropertyCollection>(GenerateTypeMap(dataModel)); if (Layer.Properties == null) { Layer.SetupProperties(); } // Setup existing conditions var conditions = layer.Properties.Conditions.Select(c => new LayerConditionViewModel(this, c)); LayerConditionVms = new BindableCollection <LayerConditionViewModel>(conditions); PropertyChanged += PropertiesViewModelHandler; // Setup existiing properties PreSelect(); }
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(); }
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(); }
public LayerEditorViewModel(LayerModel layer, IDataModel dataModel, IEnumerable<ILayerType> types, List<ILayerAnimation> layerAnimations) { Layer = layer; ProposedLayer = Clone(layer); ProposedLayer.Children.Clear(); DataModel = DataModel; LayerTypes = new BindableCollection<ILayerType>(types); LayerAnimations = layerAnimations; DataModelProps = new BindableCollection<PropertyCollection>(GenerateTypeMap(dataModel)); if (Layer.Properties == null) Layer.SetupProperties(); // Setup existing conditions var conditions = layer.Properties.Conditions.Select(c => new LayerConditionViewModel(this, c)); LayerConditionVms = new BindableCollection<LayerConditionViewModel>(conditions); PropertyChanged += PropertiesViewModelHandler; // Setup existiing properties PreSelect(); }