public async Task Initialise() { _logger.LogInformation("Initialising stores."); // Load all stores _storesFolder = await ApplicationData.Current.RoamingFolder.CreateFolderAsync("stores", CreationCollisionOption.OpenIfExists); await LoadStoreCache(); foreach (var store in _storesCache.Stores) { store.RegisterLocalBacker(); await store.LoadAsync(); await store.LoadHeadersAsync(); _logger.LogInformation($"Store {store} loaded."); } // If no stores exist, create the default local store if (!_storesCache.Stores.Any()) { var store = new DrxStore { Name = "Default Local Store" }; store.RegisterLocalBacker(); await AddStoreAsync(store); await SaveStoreCache(); _logger.LogInformation($"Default store {store} autocreated."); } }
public async Task DeleteStoreAsync(DrxStore store) { _logger.LogInformation($"Removing store {store} from cache."); await store.DeleteAsync(); _storesCache.Stores.Remove(store); }
/// <summary> /// Initialises the specified store and adds it to the cache. /// </summary> public async Task AddStoreAsync(DrxStore store) { _logger.LogInformation($"Adding store {store} to cache."); await store.LoadAsync(); _storesCache.Stores.Add(store); }
/// <summary> /// Registers the default local backer for use with the specified store. /// </summary> internal static void RegisterLocalBacker(this DrxStore store) => store.RegisterBacker(new LocalBacker(store.Id));