public IOSettingsManager(IAppDataManager appDataManager) { fileName = appDataManager.RoamingPath + FILE_NAME; settings = new KeyedCollectionFunc <string, IIOSetting>(s => s.Key); serializers = new Dictionary <Type, IIOSettingsSerializer>(); xmlDocument = Load(); }
public ClipboardObjectsManager(IClipboardObjectManager objectManager, IEnumerable <IFormatsExtractor> formatsExtractors, IEnumerable <IClipboardFilter> clipboardFilters, IServiceProvider serviceProvider) { _objectManager = objectManager; this.formatsExtractors = formatsExtractors; this.clipboardFilters = clipboardFilters; _allCollection = new KeyedCollectionFunc <Guid, ClipboardObject>(co => co.Id, new ConcurrentDictionary <Guid, ClipboardObject>()); _linkedCollection = new ConcurrentDictionary <ClipboardObject, List <ClipboardObject> >(); _listeners = new List <IClipboardObjectsListener>(); clipboardCloner = serviceProvider.Create <ClipboardClonerThread>(this); clipboardTriggerScheduler = serviceProvider.Create <ClipboardTriggerScheduler>(clipboardCloner); }
protected CollectionManager(Func <T, TKey> keySelector, IEnumerable <T> items) { if (keySelector == null) { throw new ArgumentNullException(nameof(keySelector)); } _collection = new KeyedCollectionFunc <TKey, T>(keySelector); foreach (var item in items) { if (!_collection.Add(item)) { throw new ArgumentException($"A {typeof(T).Name} with key {keySelector(item)} is already added", nameof(items)); } } }
public ProgramFiltersProvider(IProgramManager programManager) { this.programManager = programManager; filterCache = new KeyedCollectionFunc <Program, ProgramFilter>(pf => pf.Program); }
public ProgramManager(ILogger <ProgramManager> logger) { this.logger = logger; cache = new KeyedCollectionFunc <string, Program>(p => p.Path !); }