public ProductSettingsTracker(Lifetime lifetime, IProductNameAndVersion product, ClientFactory clientFactory, GlobalPerProductStorage globalPerProductStorage, IFileSystemTracker fileSystemTracker, JetBoxSettingsStorage jetBoxSettings) { myClientFactory = clientFactory; mySettingsStore = jetBoxSettings.SettingsStore.BindToContextLive(lifetime, ContextRange.ApplicationWide); mySettingsStore.Changed.Advise(lifetime, _ => InitClient()); myRootFolder = FileSystemPath.Parse(product.ProductName); InitClient(); var productSettingsPath = globalPerProductStorage.XmlFileStorage.Path; SyncFromCloud(productSettingsPath.Value); var fileTrackingLifetime = new SequentialLifetimes(lifetime); productSettingsPath.Change.Advise(lifetime, args => { var path = args.Property.Value; if (lifetime.IsTerminated || path.IsNullOrEmpty()) { fileTrackingLifetime.TerminateCurrent(); } else { fileTrackingLifetime.Next(lt => fileSystemTracker.AdviseFileChanges(lt, path, delta => delta.Accept(new FileChangesVisitor(myClient, myRootFolder)))); } }); }
public GlobalProductSyncSource(Lifetime lifetime, GlobalPerProductStorage globalPerProductStorage) { FilesToSync = new CollectionEvents<IProperty<FileSystemPath>>(lifetime, "GlobalProductSyncSource") { globalPerProductStorage.XmlFileStorage.Path }; }
public GlobalProductSyncSource(Lifetime lifetime, GlobalPerProductStorage globalPerProductStorage) { FilesToSync = new CollectionEvents <IProperty <FileSystemPath> >(lifetime, "GlobalProductSyncSource") { globalPerProductStorage.XmlFileStorage.Path }; }