private void _btnStartStop_Click(object sender, EventArgs e) { if (!_scanner.Active) { try { _scanner.Start(_cmbRangeType.SelectedIndex == 0 ? new IPScanRange(IPAddress.Parse(_tbRangeStart.Text), IPAddress.Parse(_tbRangeEnd.Text)) : new IPScanRange(IPAddress.Parse(_tbRangeStart.Text), int.Parse(_tbRangeEnd.Text))); } catch (FormatException) { MessageBox.Show(this, "Your IP rang or subnet mask have problems!", "Error!", MessageBoxButtons.OK, MessageBoxIcon.Error); } } else { _scanner.Stop(false); } }
private void bntScan_Click(object sender, EventArgs e) { if (!_scanner.Active) { G.ListIp.Clear(); G.portIP = ":" + txtPortIp.Text; try { _scanner.Start( new IPScanRange(IPAddress.Parse(_tbRangeStart.Text), IPAddress.Parse(_tbRangeEnd.Text))); } catch (FormatException) { MessageBox.Show(this, "Cannot parse IP range or subnetmask!", "Error!", MessageBoxButtons.OK, MessageBoxIcon.Error); } } else { _scanner.Stop(false); } }