private void btnAdd_Click(object sender, System.EventArgs e) { this.Cursor = Cursors.WaitCursor; try { Kixeye.Jabber.JID jid = new Kixeye.Jabber.JID(txtEntry.Text); lstJID.Items.Add(jid); txtEntry.Clear(); error.SetError(txtEntry, null); } catch { error.SetError(txtEntry, "Invalid JID"); } this.Cursor = Cursors.Default; }
private void btnRemove_Click(object sender, System.EventArgs e) { this.Cursor = Cursors.WaitCursor; try { Kixeye.Jabber.JID jid = new Kixeye.Jabber.JID(txtEntry.Text); int i = 0; foreach (object o in lstJID.Items) { if (jid.Equals(o)) { lstJID.Items.RemoveAt(i); txtEntry.Clear(); error.SetError(txtEntry, null); break; } i++; } } catch (Exception ex) { error.SetError(txtEntry, "Invalid JID: " + ex.ToString()); } this.Cursor = Cursors.Default; }
private void jid_Validating(object sender, CancelEventArgs e) { TextBox jtxt = (TextBox) sender; if (jtxt.Text == "") return; try { Kixeye.Jabber.JID j = new Kixeye.Jabber.JID(jtxt.Text); } catch { e.Cancel = true; m_form.error.SetError(jtxt, "Invalid JID"); } }