private void ScanButton_Click(object sender, EventArgs e)
 {
     scanCount             = 0;
     scanProgressBar.Value = 0;
     //this.ScanResultsListView.Items.Clear();
     if (ScanButton.Text == "Scan")
     {
         ScanStatusLabel.Text = "Initiating Scan...";
         ScanButton.Text      = "Stop";
         Application.DoEvents();
         List <int> ports = new List <int>();
         if (this.RDPCheckbox.Checked)
         {
             ports.Add(Connections.ConnectionManager.RDPPort);
         }
         if (this.VNCCheckbox.Checked || this.VMRCCheckbox.Checked)
         {
             ports.Add(Connections.ConnectionManager.VNCVMRCPort);
         }
         if (this.TelnetCheckbox.Checked)
         {
             ports.Add(Connections.ConnectionManager.TelnetPort);
         }
         if (this.SSHCheckbox.Checked)
         {
             ports.Add(Connections.ConnectionManager.SSHPort);
         }
         manager              = new Terminals.Scanner.NetworkScanManager(ATextbox.Text, BTextbox.Text, CTextbox.Text, DTextbox.Text, ETextbox.Text, ports);
         manager.OnScanHit   += new Terminals.Scanner.NetworkScanManager.ScanHitHandler(manager_OnScanHit);
         manager.OnScanStart += new Terminals.Scanner.NetworkScanManager.ScanStartHandler(manager_OnScanStart);
         manager.OnScanMiss  += new Terminals.Scanner.NetworkScanManager.ScanMissHandler(manager_OnScanMiss);
         manager.StartScan();
     }
     else
     {
         ScanStatusLabel.Text = "Scan Stopped.";
         ScanButton.Text      = "Scan";
         Application.DoEvents();
         if (manager != null)
         {
             manager.StopScan();
         }
     }
 }
 private void InitScanManager()
 {
     this.manager = new NetworkScanManager();
     this.manager.OnAddressScanHit += new NetworkScanHandler(this.manager_OnScanHit);
     this.manager.OnAddressScanFinished += new NetworkScanHandler(this.manager_OnAddresScanFinished);
 }