public void OpenBrushSettings() { BaseLayerBrush layerBrush = LayerPropertyGroup.LayerBrush; LayerBrushConfigurationDialog configurationViewModel = (LayerBrushConfigurationDialog)layerBrush.ConfigurationDialog; if (configurationViewModel == null) { return; } try { // Limit to one constructor, there's no need to have more and it complicates things anyway ConstructorInfo[] constructors = configurationViewModel.Type.GetConstructors(); if (constructors.Length != 1) { throw new ArtemisUIException("Brush configuration dialogs must have exactly one constructor"); } // Find the BaseLayerBrush parameter, it is required by the base constructor so its there for sure ParameterInfo brushParameter = constructors.First().GetParameters().First(p => typeof(BaseLayerBrush).IsAssignableFrom(p.ParameterType)); ConstructorArgument argument = new(brushParameter.Name, layerBrush); BrushConfigurationViewModel viewModel = (BrushConfigurationViewModel)layerBrush.Descriptor.Provider.Plugin.Kernel.Get(configurationViewModel.Type, argument); _windowManager.ShowDialog(new LayerBrushSettingsWindowViewModel(viewModel)); } catch (Exception e) { _dialogService.ShowExceptionDialog("An exception occured while trying to show the brush's settings window", e); } }
public CapturePropertiesViewModel(BaseLayerBrush layerBrush, IModelValidator <CapturePropertiesViewModel> validator) : base(layerBrush, validator) { Properties = ((AmbilightLayerBrush)layerBrush).Properties.Capture; }
public LayerBrushPresetViewModel(BaseLayerBrush layerBrush) { _layerBrush = layerBrush; Presets = new BindableCollection <ILayerBrushPreset>(); Presets.AddRange(layerBrush.Presets); }
/// <summary> /// Creates a new instance of the <see cref="BrushConfigurationViewModel" /> class with a validator /// </summary> /// <param name="layerBrush"></param> /// <param name="validator"></param> protected BrushConfigurationViewModel(BaseLayerBrush layerBrush, IModelValidator validator) : base(validator) { LayerBrush = layerBrush; }
/// <summary> /// Creates a new instance of the <see cref="BrushConfigurationViewModel" /> class /// </summary> /// <param name="layerBrush"></param> protected BrushConfigurationViewModel(BaseLayerBrush layerBrush) { LayerBrush = layerBrush; }