private async Task SetLastFmClients() { if (string.IsNullOrEmpty(LastFmUsername)) { return; } try { await _lastFmApiClientService.SetClients(LastFmUsername, LastFmApiSessionKey); if (!_lastFmApiClientService.UserApiClient.Authorized) { var url = _lastFmApiClientService.UserApiClient.AuthUrl; _browserService.Open(url); await _lastFmApiClientService.AuthorizeUserClient(); } LastFmApiSessionKey = _lastFmApiClientService.UserApiClient.SessionKey; } catch (LastFmApiException ex) { if (ex.ErrorCode == ErrorCode.UserNotLoggedIn) { _messenger.Send(new ShowDialogMessage(_messenger, MessageType.Error, "Last.FM Error", ex.Message)); LastFmUsername = string.Empty; LastFmApiSessionKey = null; return; } throw; } }
private void OnTestFacebook() { _webBrowserService.Open(FacebookUrl); }