protected async Task FillFromSpeedrunCom()
        {
            SpeedrunComHelperData data = null;

            try
            {
                data = await SpeedrunComHelper.GetUserInfo(lookupName);
            }
            catch (SpeedrunComHelperException e)
            {
                ShowToast(e.Message);
            }
            catch (Exception e)
            {
                ShowToast("Failed getting sr.com data: " + e.Message);
            }

            if (data == null)
            {
                return;
            }

            ccp.SetCountryForNameCode(data.CountryCode);
            if (!ccp.SelectedCountryNameCode.Equals(data.CountryCode, StringComparison.OrdinalIgnoreCase))
            {
                ccp.SetCountryForNameCode(data.CountryCode.Split('/', 2)[0]);
            }

            displayNameText.Text   = data.DisplayName;
            pronounsText.Text      = data.Pronouns;
            speedrunNameText.Text  = data.SrComName;
            twitchNameText.Text    = data.TwitchName;
            twitterHandleText.Text = data.TwitterHandle;
            extraDataText.Text     = "";
        }
예제 #2
0
        private async void FromSrComButton_Click(object sender, RoutedEventArgs e)
        {
            string lookup_name = lastChangedTextBox.Text.Trim();

            if (lookup_name == "")
            {
                return;
            }

            try
            {
                var srData = await SpeedrunComHelper.GetUserInfo(lookup_name);

                displayNameBox.Text   = srData.DisplayName;
                pronounsBox.Text      = srData.Pronouns;
                countryCodeBox.Code   = srData.CountryCode;
                srcomNameBox.Text     = srData.SrComName;
                twitchNameBox.Text    = srData.TwitchName;
                twitterHandleBox.Text = srData.TwitterHandle;
            }
            catch (Exception ex)
            {
                ErrorMessage?.Invoke(ex.Message);
                return;
            }
        }