コード例 #1
0
        public async Task UpdateLastFm()
        {
            try
            {
                _lastAuth = new LastAuth(LAST_FM_API_KEY, LAST_FM_API_SECRET);
                var session = _settingsService.GetNoCache <LastUserSession>(LAST_FM_USER_SESSION_PARAMETER);

                if (session == null)
                {
                    _lastAuth  = null;
                    _scrobbler = null;
                    return;
                }

                _lastAuth.LoadSession(session);

#if WINDOWS_UWP
                _scrobbler = new Scrobbler(_lastAuth);
#else
                var dbFile = await ApplicationData.Current.LocalFolder.CreateFileAsync(
                    "scrobbler.db", CreationCollisionOption.OpenIfExists);

                _scrobbler = new SQLiteScrobbler(_lastAuth, dbFile.Path);
#endif
            }
            catch (Exception ex)
            {
                _lastAuth  = null;
                _scrobbler = null;

                _logService.LogException(ex);
            }
        }
コード例 #2
0
 public AuthSQLiteScrobbler(ILastAuth auth, string dbFile, HttpClient httpClient = null)
 {
     _scrobbler = new SQLiteScrobbler(auth, dbFile, httpClient);
 }