public async Task Add(IImageSourceConfiguration source)
        {
            _sources.Add(source);
            await PersistAllSources();

            _sourceAdds.OnNext(new SourceConfigurationAddedEvent(source));
        }
Exemple #2
0
 public SImageSource ToSerializationModel(IImageSourceConfiguration imageSource)
 {
     return(new SImageSource(imageSource.ImageSourceId.Value,
                             imageSource.ImageSourceName.Value,
                             imageSource.SourceType.Value,
                             imageSource.UpdateInterval,
                             imageSource.IsEnabled));
 }
Exemple #3
0
        public SourcesModule(IImageSourceConfigurations sourceConfigurations, IImageSourceConfigurationFactory sourceConfigurationFactory) : base("/sources")
        {
            Get["/"]           = _ => sourceConfigurations.Select(s => new ImageSourceViewModel(s.ImageSourceId.Value, s.SourceType.Value));
            Post["/add", true] = async(parameters, ctx) =>
            {
                var request = this.Bind <AddRequestModel>();
                IImageSourceConfiguration source = sourceConfigurationFactory.CreateNewSource(new ImageSourceType(request.SourceType));
                await sourceConfigurations.Add(source);

                return(source.ImageSourceId);
            };
        }
 public SourceConfigurationChangedEvent(IImageSourceConfiguration updatedSourceConfiguration)
 {
     UpdatedSourceConfiguration = updatedSourceConfiguration;
 }
 public SourceConfigurationAddedEvent(IImageSourceConfiguration sourceConfiguration)
 {
     SourceConfiguration = sourceConfiguration;
 }
Exemple #6
0
 public ImageSource(IImageSourceConfiguration configuration, IImageSourcePluginFactory imageSourcePluginFactory)
 {
     _configuration            = configuration;
     _imageSourcePluginFactory = imageSourcePluginFactory;
 }
Exemple #7
0
 public IImageSource CreateImageSource(IImageSourceConfiguration imageSourceConfiguration)
 {
     return(new ImageSource(imageSourceConfiguration, _imageSourcePluginFactory));
 }