コード例 #1
0
        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);
            }
        }
コード例 #2
0
 public CapturePropertiesViewModel(BaseLayerBrush layerBrush, IModelValidator <CapturePropertiesViewModel> validator) : base(layerBrush, validator)
 {
     Properties = ((AmbilightLayerBrush)layerBrush).Properties.Capture;
 }
コード例 #3
0
 public LayerBrushPresetViewModel(BaseLayerBrush layerBrush)
 {
     _layerBrush = layerBrush;
     Presets     = new BindableCollection <ILayerBrushPreset>();
     Presets.AddRange(layerBrush.Presets);
 }
コード例 #4
0
 /// <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;
 }
コード例 #5
0
 /// <summary>
 ///     Creates a new instance of the <see cref="BrushConfigurationViewModel" /> class
 /// </summary>
 /// <param name="layerBrush"></param>
 protected BrushConfigurationViewModel(BaseLayerBrush layerBrush)
 {
     LayerBrush = layerBrush;
 }