public EffectsViewModel(LayerPropertiesViewModel layerPropertiesViewModel, IPluginManagementService pluginManagementService, IProfileEditorService profileEditorService) { _pluginManagementService = pluginManagementService; _profileEditorService = profileEditorService; LayerPropertiesViewModel = layerPropertiesViewModel; PropertyChanged += HandleSelectedLayerEffectChanged; }
public void Apply() { LayerPropertiesViewModel?.ApplyProperties(); Layer.Properties.DynamicProperties.Clear(); JsonConvert.PopulateObject(JsonConvert.SerializeObject(ProposedLayer), Layer); Layer.Properties.Conditions.Clear(); foreach (var conditionViewModel in LayerConditionVms) { Layer.Properties.Conditions.Add(conditionViewModel.LayerConditionModel); } // TODO: EventPropVM must have layer too if (EventPropertiesViewModel != null) { Layer.EventProperties = EventPropertiesViewModel.GetAppliedProperties(); } Layer.SetupCondition(); // Don't bother checking for a GIF path unless the type is GIF if (!(Layer.LayerType is KeyboardGifType)) { return; } if (!File.Exists(((KeyboardPropertiesModel)Layer.Properties).GifFile)) { DialogService.ShowErrorMessageBox("Couldn't find or access the provided GIF file."); } }
public ProfileEditorViewModel(ProfileModule module, ProfileViewModel profileViewModel, ProfileTreeViewModel profileTreeViewModel, DisplayConditionsViewModel dataModelConditionsViewModel, LayerPropertiesViewModel layerPropertiesViewModel, IProfileEditorService profileEditorService, IProfileService profileService, IDialogService dialogService, ISettingsService settingsService, IModuleService moduleService, ISnackbarMessageQueue snackbarMessageQueue) { _profileEditorService = profileEditorService; _profileService = profileService; _settingsService = settingsService; _moduleService = moduleService; _snackbarMessageQueue = snackbarMessageQueue; DisplayName = "PROFILE EDITOR"; Module = module; DialogService = dialogService; Profiles = new BindableCollection <ProfileDescriptor>(); // Populate the panels ProfileViewModel = profileViewModel; ProfileTreeViewModel = profileTreeViewModel; DisplayConditionsViewModel = dataModelConditionsViewModel; LayerPropertiesViewModel = layerPropertiesViewModel; Items.Add(ProfileViewModel); Items.Add(ProfileTreeViewModel); Items.Add(dataModelConditionsViewModel); Items.Add(LayerPropertiesViewModel); }
public ProfileEditorViewModel(ProfileModule module, ProfileViewModel profileViewModel, ProfileTreeViewModel profileTreeViewModel, DisplayConditionsViewModel dataModelConditionsViewModel, LayerPropertiesViewModel layerPropertiesViewModel, IProfileEditorService profileEditorService, IProfileService profileService, IDialogService dialogService, ISettingsService settingsService, IModuleService moduleService, IMessageService messageService) { _profileEditorService = profileEditorService; _profileService = profileService; _settingsService = settingsService; _moduleService = moduleService; _messageService = messageService; DisplayName = "PROFILE EDITOR"; Module = module; DialogService = dialogService; Profiles = new BindableCollection <ProfileDescriptor>(); // Populate the panels ProfileViewModel = profileViewModel; ProfileViewModel.ConductWith(this); ProfileTreeViewModel = profileTreeViewModel; ProfileTreeViewModel.ConductWith(this); DisplayConditionsViewModel = dataModelConditionsViewModel; DisplayConditionsViewModel.ConductWith(this); LayerPropertiesViewModel = layerPropertiesViewModel; LayerPropertiesViewModel.ConductWith(this); }
public TreeViewModel(LayerPropertiesViewModel layerPropertiesViewModel, IObservableCollection <LayerPropertyGroupViewModel> layerPropertyGroups) { LayerPropertiesViewModel = layerPropertiesViewModel; // Not using the Items collection because the list should persist even after this VM gets closed LayerPropertyGroups = layerPropertyGroups; }
public TimelineViewModel(LayerPropertiesViewModel layerPropertiesViewModel, IObservableCollection <LayerPropertyGroupViewModel> layerPropertyGroups, IProfileEditorService profileEditorService) { _profileEditorService = profileEditorService; LayerPropertiesViewModel = layerPropertiesViewModel; LayerPropertyGroups = layerPropertyGroups; SelectionRectangle = new RectangleGeometry(); }
public override async void CanClose(Action <bool> callback) { // Create a fake layer and apply the properties to it LayerPropertiesViewModel?.ApplyProperties(); // TODO: EventPropVM must have layer too if (EventPropertiesViewModel != null) { ProposedLayer.EventProperties = EventPropertiesViewModel.GetAppliedProperties(); } ProposedLayer.Properties.Conditions.Clear(); foreach (var conditionViewModel in LayerConditionVms) { ProposedLayer.Properties.Conditions.Add(conditionViewModel.ConditionModel); } ProposedLayer.Properties.LayerKeybindModels.Clear(); foreach (var layerKeybindViewModel in LayerKeybindVms) { ProposedLayer.Properties.LayerKeybindModels.Add(layerKeybindViewModel.LayerKeybindModel); } // Ignore this property as it isn't user input ProposedLayer.RenderAllowed = Layer.RenderAllowed; // If not a keyboard, ignore size and position if ((ProposedLayer.LayerType.DrawType != DrawType.Keyboard) || !ProposedLayer.LayerType.ShowInEdtor) { ProposedLayer.Properties.Width = Layer.Properties.Width; ProposedLayer.Properties.Height = Layer.Properties.Height; ProposedLayer.Properties.X = Layer.Properties.X; ProposedLayer.Properties.Y = Layer.Properties.Y; ProposedLayer.Properties.Contain = Layer.Properties.Contain; } // Ignore the children, can't just temporarily add them to the proposed layer because // that would upset the child layers' relations (sounds like Dr. Phil amirite?) var currentObj = GeneralHelpers.Clone(Layer); currentObj.Children.Clear(); // Apply the IsEvent boolean currentObj.SetupCondition(); ProposedLayer.SetupCondition(); var current = JsonConvert.SerializeObject(currentObj, Formatting.Indented); var proposed = JsonConvert.SerializeObject(ProposedLayer, Formatting.Indented); if (current.Equals(proposed)) { callback(true); return; } var close = await DialogService.ShowQuestionMessageBox("Unsaved changes", "Do you want to discard your changes?"); callback(close.Value); }
public LayerPropertiesViewModel SetupViewModel(LayerEditorViewModel layerEditorViewModel, LayerPropertiesViewModel layerPropertiesViewModel) { if (layerPropertiesViewModel is GenericPropertiesViewModel) { return(layerPropertiesViewModel); } return(new GenericPropertiesViewModel(layerEditorViewModel)); }
public LayerPropertiesViewModel SetupViewModel(LayerEditorViewModel layerEditorViewModel, LayerPropertiesViewModel layerPropertiesViewModel) { if (layerPropertiesViewModel is AudioPropertiesViewModel) { return(layerPropertiesViewModel); } return(new AudioPropertiesViewModel(layerEditorViewModel)); }
public LayerPropertiesViewModel SetupViewModel(LayerEditorViewModel layerEditorViewModel, LayerPropertiesViewModel layerPropertiesViewModel) { if (layerPropertiesViewModel is AmbientLightPropertiesViewModel) { return(layerPropertiesViewModel); } return(new AmbientLightPropertiesViewModel(layerEditorViewModel)); }
public LayerPropertiesViewModel SetupViewModel(LayerEditorViewModel layerEditorViewModel, LayerPropertiesViewModel layerPropertiesViewModel) { if (layerPropertiesViewModel is KeyPressPropertiesViewModel) { return(layerPropertiesViewModel); } return(new KeyPressPropertiesViewModel(layerEditorViewModel)); }
public void PreSelect() { LayerType = ProposedLayer.LayerType; if (LayerType == LayerType.Folder && !(LayerPropertiesViewModel is FolderPropertiesViewModel)) { LayerPropertiesViewModel = new FolderPropertiesViewModel(_dataModel, ProposedLayer.Properties); } }
public LayerPropertiesViewModel SetupViewModel(LayerEditorViewModel layerEditorViewModel, LayerPropertiesViewModel layerPropertiesViewModel) { if (layerPropertiesViewModel is HeadsetPropertiesViewModel) { return(layerPropertiesViewModel); } return(new HeadsetPropertiesViewModel(layerEditorViewModel)); }
public PropertyTreeViewModel(LayerPropertiesViewModel layerPropertiesViewModel, IProfileEditorService profileEditorService) { _profileEditorService = profileEditorService; LayerPropertiesViewModel = layerPropertiesViewModel; PropertyTreeItemViewModels = new BindableCollection <PropertyTreeItemViewModel>(); _profileEditorService.CurrentTimeChanged += (sender, args) => Update(false); _profileEditorService.SelectedProfileElementUpdated += (sender, args) => Update(true); }
private void PropertiesViewModelHandler(object sender, PropertyChangedEventArgs e) { if (e.PropertyName != "LayerType") { return; } // Store the brush in case the user wants to reuse it var oldBrush = LayerPropertiesViewModel?.GetAppliedProperties().Brush; // Update the model if (ProposedLayer.LayerType != LayerType) { ProposedLayer.LayerType = LayerType; ProposedLayer.SetupProperties(); } if (oldBrush != null) { ProposedLayer.Properties.Brush = oldBrush; } // Update the KeyboardPropertiesViewModel if it's being used var model = LayerPropertiesViewModel as KeyboardPropertiesViewModel; if (model != null) { model.IsGif = LayerType == LayerType.KeyboardGif; } // Apply the proper PropertiesViewModel if ((LayerType == LayerType.Keyboard || LayerType == LayerType.KeyboardGif) && !(LayerPropertiesViewModel is KeyboardPropertiesViewModel)) { LayerPropertiesViewModel = new KeyboardPropertiesViewModel(_dataModel, ProposedLayer.Properties) { IsGif = LayerType == LayerType.KeyboardGif }; } else if (LayerType == LayerType.Mouse && !(LayerPropertiesViewModel is MousePropertiesViewModel)) { LayerPropertiesViewModel = new MousePropertiesViewModel(_dataModel, ProposedLayer.Properties); } else if (LayerType == LayerType.Headset && !(LayerPropertiesViewModel is HeadsetPropertiesViewModel)) { LayerPropertiesViewModel = new HeadsetPropertiesViewModel(_dataModel, ProposedLayer.Properties); } else if (LayerType == LayerType.Folder && !(LayerPropertiesViewModel is FolderPropertiesViewModel)) { LayerPropertiesViewModel = new FolderPropertiesViewModel(_dataModel, ProposedLayer.Properties); } NotifyOfPropertyChange(() => LayerPropertiesViewModel); }
public PropertyTimelineViewModel(LayerPropertiesViewModel layerPropertiesViewModel, IProfileEditorService profileEditorService, IPropertyTrackViewModelFactory propertyTrackViewModelFactory) { _profileEditorService = profileEditorService; _propertyTrackViewModelFactory = propertyTrackViewModelFactory; LayerPropertiesViewModel = layerPropertiesViewModel; PropertyTrackViewModels = new BindableCollection <PropertyTrackViewModel>(); _profileEditorService.SelectedProfileElementUpdated += (sender, args) => Update(); LayerPropertiesViewModel.PixelsPerSecondChanged += (sender, args) => UpdateKeyframePositions(); }
public TimelineViewModel(LayerPropertiesViewModel layerPropertiesViewModel, BindableCollection <LayerPropertyGroupViewModel> layerPropertyGroups, IProfileEditorService profileEditorService) { _profileEditorService = profileEditorService; LayerPropertiesViewModel = layerPropertiesViewModel; LayerPropertyGroups = layerPropertyGroups; SelectionRectangle = new RectangleGeometry(); _profileEditorService.PixelsPerSecondChanged += ProfileEditorServiceOnPixelsPerSecondChanged; _profileEditorService.ProfileElementSelected += ProfileEditorServiceOnProfileElementSelected; if (_profileEditorService.SelectedProfileElement != null) { _profileEditorService.SelectedProfileElement.PropertyChanged += SelectedProfileElementOnPropertyChanged; } Update(); }
public LayerPropertiesViewModel SetupViewModel(LayerEditorViewModel layerEditorViewModel, LayerPropertiesViewModel layerPropertiesViewModel) { var model = layerPropertiesViewModel as KeyboardPropertiesViewModel; if (model == null) { return new KeyboardPropertiesViewModel(layerEditorViewModel) { IsGif = false } } ; model.IsGif = false; return(layerPropertiesViewModel); } }
public LayerPropertiesViewModel SetupViewModel(LayerEditorViewModel layerEditorViewModel, LayerPropertiesViewModel layerPropertiesViewModel) { return((layerPropertiesViewModel as ConicalBrushPropertiesViewModel) ?? new ConicalBrushPropertiesViewModel(layerEditorViewModel)); }