public frmCapture() { InitializeComponent(); //fStats = new frmStatistics(); // creates new stats window // Get the list of devices devices = CaptureDeviceList.Instance; // Make sure there is at least one device if (devices.Count < 1) { MessageBox.Show("No Capture Devices Found"); Application.Exit(); } // Add devices to the combo box foreach (ICaptureDevice dev in devices) { cmbDevices.Items.Add(dev.Description); } // Get the device and display in combo box device = devices[3]; cmbDevices.Text = device.Description; RegisterEventHandler(); if (frmStatistics.instantiations == 0) { fStats = new frmStatistics(); // creates new traffic window } }
private void button1_Click(object sender, EventArgs e) { if (frmStatistics.instantiations == 0) { btnStats.Text = "Hide Statistics"; fStats = new frmStatistics(); // creates new stats window fStats.Show(); } else { btnStats.Text = "Show Statistics"; fStats.Close(); frmStatistics.instantiations--; //fStats.Hide(); } }