コード例 #1
0
ファイル: UserSettings.cs プロジェクト: reserved-words/Whip
        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;
            }
        }
コード例 #2
0
 private void OnTestFacebook()
 {
     _webBrowserService.Open(FacebookUrl);
 }