private void mnuItem_StartCapture_Click(object sender, EventArgs e) { CaptureStatistic.Reset(); CaptureStatistic.StartOfCapture = DateTime.Now; try { NetMonitor.StartCapture(); } catch { return; } // Change some elements properties dgvPackets.Rows.Clear(); trePacket.Nodes.Clear(); pnlTip.Visible = false; lblElapsedTime.Visible = true; lblElpsTime.Visible = true; mnuItem_Options.Enabled = false; mnuItem_StartCapture.Enabled = false; mnuItem_StopCapture.Enabled = true; lblProgramStatus.Text = "Capturing..."; lblProgramStatus.ForeColor = Color.Red; timStatistics.Enabled = true; }
private void mnuItem_StopCapture_Click(object sender, EventArgs e) { NetMonitor.StopCapture(); // Change some elements properties mnuItem_Options.Enabled = true; mnuItem_StartCapture.Enabled = true; mnuItem_StopCapture.Enabled = false; lblProgramStatus.Text = "Stopped"; timStatistics.Enabled = false; }
private void GetDeviceList() { try { SharpPcap.CaptureDeviceList d = SharpPcap.CaptureDeviceList.Instance; NetMonitor.Initialize(d); } catch (DllNotFoundException) { _errOccured = true; MessageBox.Show("WinPcap is not installed on this computer. please install it." + Environment.NewLine + "You can download it from http://www.winpcap.org", "Missing Component...", MessageBoxButtons.OK, MessageBoxIcon.Error); } catch { MessageBox.Show("An unknown error occured while loading components, please reinstall WhiteNet.", "Unknown Error...", MessageBoxButtons.OK, MessageBoxIcon.Error); _errOccured = true; } }
private void FormMain_FormClosed(object sender, FormClosedEventArgs e) { NetMonitor.StopCapture(); _frmSplashScreen.Close(); }