private void m_pTabGeneral_BindingsToolbar_ItemClicked(object sender, ToolStripItemClickedEventArgs e) { if (e.ClickedItem.Tag == null) { return; } if (e.ClickedItem.Tag.ToString() == "add") { wfrm_sys_BindInfo frm = new wfrm_sys_BindInfo(m_pVirtualServer.Server, true, 5060, 5061); if (frm.ShowDialog(this) == DialogResult.OK) { ListViewItem it = new ListViewItem(); it.Text = frm.HostName; if (frm.IP.ToString() == "0.0.0.0") { it.SubItems.Add("Any IPv4"); } else if (frm.IP.ToString() == "0:0:0:0:0:0:0:0") { it.SubItems.Add("Any IPv6"); } else { it.SubItems.Add(frm.IP.ToString()); } it.SubItems.Add(frm.Protocol.ToString()); it.SubItems.Add(frm.Port.ToString()); it.SubItems.Add(frm.SslMode.ToString()); it.SubItems.Add(Convert.ToString(frm.Certificate != null)); it.Tag = new IPBindInfo(frm.HostName, frm.Protocol, frm.IP, frm.Port, frm.SslMode, frm.Certificate); it.Selected = true; m_pTabGeneral_Bindings.Items.Add(it); } } else if (e.ClickedItem.Tag.ToString() == "edit") { if (m_pTabGeneral_Bindings.SelectedItems.Count > 0) { ListViewItem it = m_pTabGeneral_Bindings.SelectedItems[0]; wfrm_sys_BindInfo frm = new wfrm_sys_BindInfo(m_pVirtualServer.Server, true, 5060, 5061, (IPBindInfo)it.Tag); if (frm.ShowDialog(this) == DialogResult.OK) { it.Text = frm.HostName; if (frm.IP.ToString() == "0.0.0.0") { it.SubItems[1].Text = "Any IPv4"; } else if (frm.IP.ToString() == "0:0:0:0:0:0:0:0") { it.SubItems[1].Text = "Any IPv6"; } else { it.SubItems[1].Text = frm.IP.ToString(); } it.SubItems[2].Text = frm.Protocol.ToString(); it.SubItems[3].Text = frm.Port.ToString(); it.SubItems[4].Text = frm.SslMode.ToString(); it.SubItems[5].Text = Convert.ToString(frm.Certificate != null); it.Tag = new IPBindInfo(frm.HostName, frm.Protocol, frm.IP, frm.Port, frm.SslMode, frm.Certificate); } } } else if (e.ClickedItem.Tag.ToString() == "delete") { if (m_pTabGeneral_Bindings.SelectedItems.Count > 0) { if (MessageBox.Show(this, "Are you sure you want to delete binding '" + m_pTabGeneral_Bindings.SelectedItems[0].SubItems[0].Text + ":" + m_pTabGeneral_Bindings.SelectedItems[0].SubItems[1].Text + "' ?", "Confirm:", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { m_pTabGeneral_Bindings.SelectedItems[0].Remove(); } } } }
private void m_pBindings_Add_Click(object sender, EventArgs e) { wfrm_sys_BindInfo frm = new wfrm_sys_BindInfo(m_pVirtualServer.Server,110,995); if(frm.ShowDialog(this) == DialogResult.OK){ ListViewItem it = new ListViewItem(); if(frm.IP.ToString() == "0.0.0.0"){ it.Text = "Any IPv4"; } else if(frm.IP.ToString() == "0:0:0:0:0:0:0:0"){ it.Text = "Any IPv6"; } else{ it.Text = frm.IP.ToString(); } it.SubItems.Add(frm.Port.ToString()); it.SubItems.Add(frm.SSL.ToString()); it.SubItems.Add(Convert.ToString(frm.Certificate != null)); it.Tag = new BindInfo("TCP",frm.IP,frm.Port,frm.SSL,frm.Certificate); it.Selected = true; m_pBindings.Items.Add(it); } }
private void m_pTabGeneral_BindingsToolbar_ItemClicked(object sender,ToolStripItemClickedEventArgs e) { if(e.ClickedItem.Tag == null){ return; } if(e.ClickedItem.Tag.ToString() == "add"){ wfrm_sys_BindInfo frm = new wfrm_sys_BindInfo(m_pVirtualServer.Server,true,WellKnownPorts.IMAP4,WellKnownPorts.IMAP4_SSL); if(frm.ShowDialog(this) == DialogResult.OK){ ListViewItem it = new ListViewItem(); it.Text = frm.HostName; if(frm.IP.ToString() == "0.0.0.0"){ it.SubItems.Add("Any IPv4"); } else if(frm.IP.ToString() == "0:0:0:0:0:0:0:0"){ it.SubItems.Add("Any IPv6"); } else{ it.SubItems.Add(frm.IP.ToString()); } it.SubItems.Add(frm.Protocol.ToString()); it.SubItems.Add(frm.Port.ToString()); it.SubItems.Add(frm.SslMode.ToString()); it.SubItems.Add(Convert.ToString(frm.Certificate != null)); it.Tag = new IPBindInfo(frm.HostName,frm.Protocol,frm.IP,frm.Port,frm.SslMode,frm.Certificate); it.Selected = true; m_pTabGeneral_Bindings.Items.Add(it); } } else if(e.ClickedItem.Tag.ToString() == "edit"){ if(m_pTabGeneral_Bindings.SelectedItems.Count > 0){ ListViewItem it = m_pTabGeneral_Bindings.SelectedItems[0]; wfrm_sys_BindInfo frm = new wfrm_sys_BindInfo(m_pVirtualServer.Server,false,WellKnownPorts.IMAP4,WellKnownPorts.IMAP4_SSL,(IPBindInfo)it.Tag); if(frm.ShowDialog(this) == DialogResult.OK){ it.Text = frm.HostName; if(frm.IP.ToString() == "0.0.0.0"){ it.SubItems[1].Text = "Any IPv4"; } else if(frm.IP.ToString() == "0:0:0:0:0:0:0:0"){ it.SubItems[1].Text = "Any IPv6"; } else{ it.SubItems[1].Text = frm.IP.ToString(); } it.SubItems[2].Text = frm.Port.ToString(); it.SubItems[3].Text = frm.SslMode.ToString(); it.SubItems[4].Text = Convert.ToString(frm.Certificate != null); it.Tag = new IPBindInfo(frm.HostName,frm.Protocol,frm.IP,frm.Port,frm.SslMode,frm.Certificate); } } } else if(e.ClickedItem.Tag.ToString() == "delete"){ if(m_pTabGeneral_Bindings.SelectedItems.Count > 0){ if(MessageBox.Show(this,"Are you sure you want to delete binding '" + m_pTabGeneral_Bindings.SelectedItems[0].SubItems[0].Text + ":" + m_pTabGeneral_Bindings.SelectedItems[0].SubItems[1].Text + "' ?","Confirm:",MessageBoxButtons.YesNo,MessageBoxIcon.Question) == DialogResult.Yes){ m_pTabGeneral_Bindings.SelectedItems[0].Remove(); } } } }
private void m_pBindingsToolbar_ItemClicked(object sender,ToolStripItemClickedEventArgs e) { if(e.ClickedItem.Tag == null){ return; } if(e.ClickedItem.Tag.ToString() == "add"){ wfrm_sys_BindInfo frm = new wfrm_sys_BindInfo(m_pVirtualServer.Server,true,5060,5061); if(frm.ShowDialog(this) == DialogResult.OK){ ListViewItem it = new ListViewItem(); it.Text = frm.Protocol; if(frm.IP.ToString() == "0.0.0.0"){ it.SubItems.Add("Any IPv4"); } else if(frm.IP.ToString() == "0:0:0:0:0:0:0:0"){ it.SubItems.Add("Any IPv6"); } else{ it.SubItems.Add(frm.IP.ToString()); } it.SubItems.Add(frm.Port.ToString()); it.SubItems.Add(frm.SSL.ToString()); it.SubItems.Add(Convert.ToString(frm.Certificate != null)); it.Tag = new BindInfo(frm.Protocol,frm.IP,frm.Port,frm.SSL,frm.Certificate); it.Selected = true; m_pBindings.Items.Add(it); } } else if(e.ClickedItem.Tag.ToString() == "delete"){ if(m_pBindings.SelectedItems.Count > 0){ if(MessageBox.Show(this,"Are you sure you want to delete binding '" + m_pBindings.SelectedItems[0].SubItems[0].Text + ":" + m_pBindings.SelectedItems[0].SubItems[1].Text + "' ?","Confirm:",MessageBoxButtons.YesNo,MessageBoxIcon.Question) == DialogResult.Yes){ m_pBindings.SelectedItems[0].Remove(); } } } }