Пример #1
0
 /// <summary>Initializes a new instance of the <see cref="T:Gorgon.Editor.ImageEditor.ImageIO"/> class.</summary>
 /// <param name="defaultCodec">The default codec used by the plug in.</param>
 /// <param name="installedCodecs">The list of installed codecs.</param>
 /// <param name="importDialog">The dialog service used to export an image.</param>
 /// <param name="busyService">The busy state service.</param>
 /// <param name="scratchArea">The file system writer used to write to the temporary area.</param>
 /// <param name="bcCompressor">The block compressor used to block (de)compress image data.</param>
 /// <param name="log">The logging interface to use.</param>
 public ImageIOService(IGorgonImageCodec defaultCodec,
                       ICodecRegistry installedCodecs,
                       IExportImageDialogService exportDialog,
                       IImportImageDialogService importDialog,
                       IBusyStateService busyService,
                       IGorgonFileSystemWriter <Stream> scratchArea,
                       TexConvCompressor bcCompressor,
                       IGorgonLog log)
 {
     _exportDialog   = exportDialog;
     _importDialog   = importDialog;
     DefaultCodec    = defaultCodec;
     InstalledCodecs = installedCodecs;
     ScratchArea     = scratchArea;
     _compressor     = bcCompressor;
     _busyState      = busyService;
     _log            = log ?? GorgonLog.NullLog;
 }
Пример #2
0
        /// <summary>Function to inject dependencies for the view model.</summary>
        /// <param name="injectionParameters">The parameters to inject.</param>
        /// <remarks>
        /// Applications should call this when setting up the view model for complex operations and/or dependency injection. The constructor should only be used for simple set up and initialization of objects.
        /// </remarks>
        protected override void OnInitialize(ImportPlugInSettingsParameters injectionParameters)
        {
            _messageDisplay  = injectionParameters.MessageDisplay ?? throw new ArgumentMissingException(nameof(injectionParameters.MessageDisplay), nameof(injectionParameters));
            _settings        = injectionParameters.Settings ?? throw new ArgumentMissingException(nameof(injectionParameters.Settings), nameof(injectionParameters));
            _plugInService   = injectionParameters.ContentPlugInService ?? throw new ArgumentMissingException(nameof(injectionParameters.ContentPlugInService), nameof(injectionParameters));
            _codecs          = injectionParameters.Codecs ?? throw new ArgumentMissingException(nameof(injectionParameters.Codecs), nameof(injectionParameters));
            _openCodecDialog = injectionParameters.OpenCodecDialog ?? throw new ArgumentMissingException(nameof(injectionParameters.OpenCodecDialog), nameof(injectionParameters));
            _busyService     = injectionParameters.BusyService ?? throw new ArgumentMissingException(nameof(injectionParameters.BusyService), nameof(injectionParameters));

            foreach (GorgonSpriteCodecPlugIn plugin in _codecs.CodecPlugIns)
            {
                foreach (GorgonSpriteCodecDescription desc in plugin.Codecs)
                {
                    IGorgonSpriteCodec codec = _codecs.Codecs.FirstOrDefault(item => string.Equals(item.GetType().FullName, desc.Name, StringComparison.OrdinalIgnoreCase));

                    if (codec == null)
                    {
                        continue;
                    }

                    CodecPlugInPaths.Add(new CodecSetting(codec.CodecDescription, plugin, desc));
                }
            }
        }
 /// <summary>Initializes a new instance of the <see cref="EditorSettingsParameters"/> class.</summary>
 /// <param name="factory">The view model factory.</param>
 /// <param name="categories">The list of settings categories.</param>
 /// <param name="pluginsList">The list of plug ins for the fixed plugin list category.</param>
 /// <param name="messageDisplay">The message display service.</param>
 /// <param name="busyService">The busy state service.</param>
 /// <exception cref="ArgumentNullException">Thrown when any parameter is <b>null</b>.</exception>
 public EditorSettingsParameters(IEnumerable <ISettingsCategoryViewModel> categories, ISettingsPlugInsList pluginsList, IMessageDisplayService messageDisplay, IBusyStateService busyService)
 {
     MessageDisplay = messageDisplay ?? throw new ArgumentNullException(nameof(messageDisplay));
     Categories     = categories ?? throw new ArgumentNullException(nameof(categories));
     PlugInsList    = pluginsList ?? throw new ArgumentNullException(nameof(pluginsList));
     BusyService    = busyService ?? throw new ArgumentNullException(nameof(busyService));
 }
Пример #4
0
 /// <summary>Initializes a new instance of the <see cref="ViewModelInjection"/> class.</summary>
 /// <param name="log">The log for the application.</param>
 /// <param name="busyService">The busy service for the application.</param>
 /// <param name="messageService">The message display service for the application..</param>
 /// <exception cref="ArgumentNullException">Thrown when any of the parameters are <b>null</b>.</exception>
 public ViewModelInjection(IGorgonLog log, IBusyStateService busyService, IMessageDisplayService messageService)
 {
     Log            = log ?? throw new ArgumentNullException(nameof(log));
     BusyService    = busyService ?? throw new ArgumentNullException(nameof(busyService));
     MessageDisplay = messageService ?? throw new ArgumentNullException(nameof(messageService));
 }