private void AddCharSearchNameBtn_Click(object sender, EventArgs e) { XDocument CharFinder = Program.GetThisURL(string.Concat(@"character/?c:show=returned,displayname,id&displayname=^", AddCharNameKeyTB.Text)); AddCharNameConfirm.Enabled = false; foreach (XElement thisChar in CharFinder.Root.Elements("character")) { AddCharNameSearchRsltsLB.Items.Add(new AddCharResult(thisChar.Attribute("displayname").Value, long.Parse(thisChar.Attribute("id").Value))); } if (AddCharNameSearchRsltsLB.Items.Count == 0) { AddCharNameKeyTB.Text = string.Empty; _ = AddCharNameKeyTB.Focus(); _ = MessageBox.Show("No characters were found with that name.\nRemember, capitolization and spelling count!", "Alert", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } else { AddCharNameSearchRsltsLB.SelectedIndex = 0; AddCharNameConfirm.Enabled = true; _ = AddCharNameConfirm.Focus(); } }
private void AddCharNameReset_Click(object sender, EventArgs e) { AddCharNameKeyTB.Text = string.Empty; AddCharNameSearchRsltsLB.Items.Clear(); _ = AddCharNameKeyTB.Focus(); }