/// <summary> /// Recreates the scrobblers of the ScrobbleViewModels. /// </summary> private void CreateScrobblers() { IAuthScrobbler scrobbler; IAuthScrobbler cachingScrobbler; if (_client.Auth.UserSession != null) { var dbFile = $"{_client.Auth.UserSession.Username}.db"; try { if (!File.Exists(dbFile)) { File.Create(dbFile).Close(); } } catch (Exception ex) { CurrentStatus = $"Error creating cache database. Error: {ex.Message}"; } scrobbler = _scrobblerFactory.CreateScrobbler(_client.Auth); cachingScrobbler = _scrobblerFactory.CreateSQLiteScrobbler(_client.Auth, dbFile); } else { scrobbler = null; cachingScrobbler = null; } _scrobblerVM.UpdateScrobblers(_scrobblerFactory.CreateUserScrobbler(UserViewModel.ActiveUser, scrobbler, cachingScrobbler)); }
/// <summary> /// Recreates the scrobblers of the ScrobbleViewModels. /// </summary> private void CreateScrobblers() { IAuthScrobbler scrobbler; IAuthScrobbler cachingScrobbler; if (Client.Auth.UserSession != null) { string dbFile = Client.Auth.UserSession.Username + ".db"; try { if (!File.Exists(dbFile)) { File.Create(dbFile); } } catch (Exception ex) { CurrentStatus = "Error creating cache database. Error: " + ex.Message; } scrobbler = _scrobblerFactory.CreateScrobbler(Client.Auth); cachingScrobbler = _scrobblerFactory.CreateSQLiteScrobbler(Client.Auth, dbFile); } else { scrobbler = null; cachingScrobbler = null; } _scrobblerVM.UpdateScrobblers(scrobbler, cachingScrobbler); }