private void ViewContacts() { if (this.m_pRegistrations.SelectedItems.Count > 0) { SipRegistration registration = (SipRegistration)this.m_pRegistrations.SelectedItems[0].Tag; SipRegistrationForm sipRegistrationForm = new SipRegistrationForm(this.m_pServer, registration); sipRegistrationForm.ShowDialog(this); } }
private void m_pToolbar_ItemClicked(object sender, ToolStripItemClickedEventArgs e) { if (e.ClickedItem.Tag == null) { return; } if (e.ClickedItem.Tag.ToString() == "add") { SipRegistrationForm sipRegistrationForm = new SipRegistrationForm(this.m_pServer); if (sipRegistrationForm.ShowDialog(this) == DialogResult.OK) { SipRegistration sipRegistration = sipRegistrationForm.VirtualServer.SipRegistrations[sipRegistrationForm.AddressOfRecord]; if (sipRegistration != null) { ListViewItem listViewItem = new ListViewItem(sipRegistration.UserName); listViewItem.SubItems.Add(sipRegistration.AddressOfRecord); listViewItem.Tag = sipRegistration; this.m_pRegistrations.Items.Add(listViewItem); return; } } } else if (e.ClickedItem.Tag.ToString() == "delete") { SipRegistration sipRegistration2 = (SipRegistration)this.m_pRegistrations.SelectedItems[0].Tag; if (MessageBox.Show(this, "Are you sure you want to remove SIP registration '" + sipRegistration2.AddressOfRecord + "' ?", "Remove Registration", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { sipRegistration2.Owner.Remove(sipRegistration2); this.m_pRegistrations.SelectedItems[0].Remove(); return; } } else { if (e.ClickedItem.Tag.ToString() == "refresh") { this.LoadData(); return; } if (e.ClickedItem.Tag.ToString() == "view") { this.ViewContacts(); } } }