private async void FindBtn(object sender, RoutedEventArgs e) { if (NickNameTxt.Text == "" || RegionKey == null) { MessageBox.Show("Enter Nick Name and check region"); } else { VisibilityInfoElements(true); try { PlayerInfo = await new Player("Enter Here api key").GetPlayerInfoAsync(NickNameTxt.Text, RegionKey); MathInfo = await new Player("Enter Here api key").GetMarhInfoAsync(PlayerInfo.AccountId, RegionKey); AccImgUrl = new Player("Enter Here api key").GetProfileImg(NickNameTxt.Text); ConfigUi(); } catch (Exception ex) { if (ex.Message == "The remote server returned an error: (404) Not Found.") { MessageBox.Show("Network error Or Player Not Found!!!"); BackBtn(null, null); } if (ex.Message == "The remote server returned an error: (403) Forbidden.") { MessageBox.Show("Old Api Key"); BackBtn(null, null); } } } }
public MainWindow() { InitializeComponent(); PlayerInfo = null; MathInfo = null; AccImgUrl = null; RegionKey = null; Reg = new Dictionary <string, string>(); Reg.Add("RU", Regions.RU); Reg.Add("KR", Regions.KR); Reg.Add("BR1", Regions.BR1); Reg.Add("OC1", Regions.OC1); Reg.Add("JP1", Regions.JP1); Reg.Add("NA1", Regions.NA1); Reg.Add("EUN1", Regions.EUN1); Reg.Add("EUW1", Regions.EUW1); Reg.Add("TR1", Regions.TR1); Reg.Add("LA1", Regions.LA1); Reg.Add("LA2", Regions.LA2); foreach (var item in Reg) { Region.Items.Add(item.Key); } }