private void btStart_Click(object sender, EventArgs e) { if (isNumeric(tbTimeOut.Text) == true) { port = 0; btnStart.Enabled = false; btnStop.Enabled = true; tbIPStart.Enabled = false; tbIPEnd.Enabled = false; cbNIC.Enabled = false; cbUseSubnet.Enabled = false; cbNIC.Enabled = false; rbNames.Enabled = false; rbDescription.Enabled = false; tbPort.Enabled = false; ips.Clear(); timeout = Convert.ToInt32(tbTimeOut.Text); GetHosts(); dataGridView1.DataSource = ips; DataGridViewColumnSelector dgvCS = new DataGridViewColumnSelector(); dgvCS.DataGridView = dataGridView1; dataGridView1.ReadOnly = true; dataGridView1.AllowUserToAddRows = false; dataGridView1.Columns["Hostname"].Visible = false; dataGridView1.Columns["First_Seen"].DefaultCellStyle.Format = "dd/MM HH:mm:ss"; dataGridView1.Columns["Last_Seen"].DefaultCellStyle.Format = "dd/MM HH:mm:ss"; dataGridView1.Columns["Last_Checked"].DefaultCellStyle.Format = "dd/MM HH:mm:ss"; dataGridView1.Columns["Last_Checked"].Visible = false; dataGridView1.Columns["RunningCheck"].Visible = false; dataGridView1.Columns["CountChecks"].Visible = false; timer1.Start(); } else { MessageBox.Show("Enter valid Timeout!"); } if (tbPort.Text != "" && IpHelpers.IsValidPort(tbPort.Text) == true) { port = Convert.ToInt32(tbPort.Text); dataGridView1.Columns["PortOpen"].Visible = true; } else if (tbPort.Text != "" && IpHelpers.IsValidPort(tbPort.Text) == false) { MessageBox.Show("Enter valid Port or leave empty"); dataGridView1.Columns["PortOpen"].Visible = false; } else { dataGridView1.Columns["PortOpen"].Visible = false; } }
public void Clear() { var cut = new SortedBindingList <Data>(); var raisedEvents = new List <ListChangedEventArgs>(); cut.ListChanged += (s, e) => raisedEvents.Add(e); var data = new Data(); cut.Add(data); cut.Clear(); var last = raisedEvents.Last(); Assert.AreEqual(0, cut.Count); Assert.AreEqual(ListChangedType.Reset, last.ListChangedType); }