Exemplo n.º 1
0
        protected ArchiveModelManager(Storage storage, IDatabaseContextFactory contextFactory, MutableDatabaseBackedStoreWithFileIncludes <TModel, TFileModel> modelStore, IIpcHost importHost = null)
        {
            ContextFactory = contextFactory;

            ModelStore              = modelStore;
            ModelStore.ItemAdded   += item => handleEvent(() => ItemAdded?.Invoke(item));
            ModelStore.ItemRemoved += s => handleEvent(() => ItemRemoved?.Invoke(s));

            Files = new FileStore(contextFactory, storage);

            if (importHost != null)
            {
                ipc = new ArchiveImportIPCChannel(importHost, this);
            }

            ModelStore.Cleanup();
        }
Exemplo n.º 2
0
        protected ArchiveModelManager(Storage storage, IDatabaseContextFactory contextFactory, MutableDatabaseBackedStoreWithFileIncludes <TModel, TFileModel> modelStore, IIpcHost importHost = null)
        {
            ContextFactory = contextFactory;

            ModelStore              = modelStore;
            ModelStore.ItemUpdated += item => handleEvent(() => itemUpdated.Value = new WeakReference <TModel>(item));
            ModelStore.ItemRemoved += item => handleEvent(() => itemRemoved.Value = new WeakReference <TModel>(item));

            exportStorage = storage.GetStorageForDirectory("exports");

            Files = new FileStore(contextFactory, storage);

            if (importHost != null)
            {
                ipc = new ArchiveImportIPCChannel(importHost, this);
            }

            ModelStore.Cleanup();
        }