private void BtnGetCharsClick(object sender, RoutedEventArgs e) { cbChars.Items.Clear(); try { profile.keyId = tbKeyId.Text; profile.vcode = tbVCode.Text; var info = new APIKeyInfo(profile.keyId.ToString(CultureInfo.InvariantCulture), profile.vcode); info.Query(); if (info.characters.Count == 0) { MessageBox.Show( "No characters for this API information.\nPlease check you API information", "No characters found", MessageBoxButton.OK, MessageBoxImage.Warning ); } else { lblChar.Visibility = Visibility.Visible; cbChars.Visibility = Visibility.Visible; foreach (APIKeyInfo.Character chr in info.characters) { var chara = new CharWrapper { KeyId = profile.keyId, VCode = profile.vcode, Charname = chr.characterName, CharId = chr.characterID }; cbChars.Items.Add(chara); cbChars.SelectedIndex = 0; } if (cbChars.Items.Count > 0) { btnOk.IsEnabled = true; } } } catch (FormatException) { MessageBox.Show( "Key ID must be a number", "Invalid Key ID", MessageBoxButton.OK, MessageBoxImage.Warning ); } }
private void BtnGetCharsClick(object sender, RoutedEventArgs e) { cbChars.Items.Clear(); try { string keyid = tbKeyId.Text; string vcode = tbVCode.Text; var info = new APIKeyInfo(keyid.ToString(CultureInfo.InvariantCulture), vcode); info.Query(); if (info.characters.Count == 0) { MessageBox.Show("No characters for this API information.\nPlease check you API information", "No characters found", MessageBoxButton.OK, MessageBoxImage.Warning); } else { lblChar.Visibility = Visibility.Visible; cbChars.Visibility = Visibility.Visible; foreach (APIKeyInfo.Character chr in info.characters) { var chara = new CharWrapper { KeyId = keyid, VCode = vcode, Charname = chr.characterName, CharId = chr.characterID }; cbChars.Items.Add(chara); cbChars.SelectedIndex = 0; } if (cbChars.Items.Count > 0) { btnOk.IsEnabled = true; } } } catch (FormatException) { MessageBox.Show("Key ID must be a number", "Invalid Key ID", MessageBoxButton.OK, MessageBoxImage.Warning); } }
internal ApiImportSelectFactionWindow(CharWrapper chr) { InitializeComponent(); _chara = chr; }