예제 #1
0
        private void bnEditIP_Click(object sender, EventArgs e)
        {
            if (tcpipListView.SelectedItems.Count == 1)
            {
                CheckState active = tcpipListView.SelectedItems[0].CheckState;

                IpAddressRangeForm ipForm = new IpAddressRangeForm(tcpipListView.SelectedItems[0].Key, (string)tcpipListView.SelectedItems[0].SubItems[0].Value);
                if (ipForm.ShowDialog() == DialogResult.OK)
                {
                    if (!tcpipListView.Items.Exists(ipForm.StartAddress))
                    {
                        tcpipListView.Items.Remove(tcpipListView.SelectedItems[0]);

                        UltraListViewItem item = tcpipListView.Items.Add(ipForm.StartAddress, ipForm.StartAddress);
                        item.SubItems[0].Value = ipForm.EndAddress;
                        item.CheckState        = active;
                    }
                    else
                    {
                        MessageBox.Show("Start IP address already exists. Range will not be added.", "Invalid IP Range", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                    }
                }
            }
            else if (tcpipListView.SelectedItems.Count > 1)
            {
                MessageBox.Show("Only one entry can edited at a time.", "AuditWizard", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            else
            {
                MessageBox.Show("Please select an IP range to edit.", "AuditWizard", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
예제 #2
0
        private void bnAddIP_Click(object sender, EventArgs e)
        {
            IpAddressRangeForm ipForm = new IpAddressRangeForm();

            if (ipForm.ShowDialog() == DialogResult.OK)
            {
                if (!tcpipListView.Items.Exists(ipForm.StartAddress))
                {
                    UltraListViewItem item = tcpipListView.Items.Add(ipForm.StartAddress, ipForm.StartAddress);
                    item.SubItems[0].Value = ipForm.EndAddress;
                    item.CheckState        = CheckState.Checked;
                }
                else
                {
                    MessageBox.Show("Start IP address already exists. Range will not be added.", "Invalid IP Range", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                }
            }
        }