Exemplo n.º 1
0
 /// <summary>Initializes a new instance of the ImageContentVmParameters class.</summary>
 /// <param name="settings">The settings for the image editor.</param>
 /// <param name="codecs">The codecs loaded into the system.</param>
 /// <param name="codecDialog">The file dialog used to locate codec assemblies.</param>
 /// <param name="pluginService">The service used to manage content and importer plug ins.</param>
 /// <param name="plugInCache">The cache for plug in assemblies.</param>
 /// <param name="commonServices">Common application services.</param>
 /// <exception cref="ArgumentNullException">Thrown when any of the parameters are <b>null</b>.</exception>
 public SettingsParameters(ImageEditorSettings settings, ICodecRegistry codecs, IFileDialogService codecDialog, IContentPlugInService pluginService, GorgonMefPlugInCache plugInCache, IViewModelInjection commonServices)
     : base(commonServices)
 {
     Settings        = settings ?? throw new ArgumentNullException(nameof(settings));
     Codecs          = codecs ?? throw new ArgumentNullException(nameof(codecs));
     CodecFileDialog = codecDialog ?? throw new ArgumentNullException(nameof(codecDialog));
     PlugInService   = pluginService ?? throw new ArgumentNullException(nameof(pluginService));
     PlugInCache     = plugInCache ?? throw new ArgumentNullException(nameof(plugInCache));
 }
Exemplo n.º 2
0
        /// <summary>
        /// Function to load the settings for the image editor/importer.
        /// </summary>
        /// <returns>The settings for both plug ins.</returns>
        private static ImageEditorSettings LoadSettings()
        {
            if (!_plugInService.TryGetTarget(out IContentPlugInService plugInService))
            {
                throw new GorgonException(GorgonResult.CannotCreate);
            }

            ImageEditorSettings settings = plugInService.ReadContentSettings <ImageEditorSettings>(ImageEditorPlugIn.SettingsName);

            if (settings == null)
            {
                settings = new ImageEditorSettings();
            }

            return(settings);
        }