/// <summary> /// Initializes a new instance of the PingerDialog class /// </summary> /// <param name="address"></param> /// <param name="startPinging"></param> public PingerDialog(string address, bool autoStartPinging) { // // Required for Windows Form Designer support // this.InitializeComponent(); this.StartPosition = FormStartPosition.CenterParent; _pinger = new Pinger(); _pinger.Exception += new EventHandler <ExceptionEventArgs>(OnPingException); _pinger.PingStarted += new EventHandler <PingerEventArgs>(OnPingStarted); _pinger.PingResult += new EventHandler <PingerResultEventArgs>(OnPingResult); _pinger.PingStatistics += new EventHandler <PingerStatisticsEventArgs>(OnPingStatistics); _pinger.PingFinished += new EventHandler(OnPingFinished); _textBoxAddress.Text = address; _autoStartPinging = autoStartPinging; _textBoxAddress.TextChanged += new EventHandler(OnTextBoxTextChanged); _textBoxPingCount.TextChanged += new EventHandler(OnTextBoxTextChanged); _textBoxOutput.LinkClicked += new LinkClickedEventHandler(OnLinkClicked); _buttonAction.Click += new EventHandler(OnButtonActionClicked); _buttonCancel.Click += new EventHandler(OnButtonCloseClicked); }
/// <summary> /// Stops the ping process /// </summary> protected void StopPing() { if (_pinger != null) { _pinger = null; } }
/// <summary> /// Initializes a new instance of the PingerDialog class /// </summary> /// <param name="address"></param> /// <param name="startPinging"></param> public PingerDialog(string address, bool autoStartPinging) { // // Required for Windows Form Designer support // this.InitializeComponent(); this.StartPosition = FormStartPosition.CenterParent; _pinger = new Pinger(); _pinger.Exception += new EventHandler<ExceptionEventArgs>(OnPingException); _pinger.PingStarted += new EventHandler<PingerEventArgs>(OnPingStarted); _pinger.PingResult += new EventHandler<PingerResultEventArgs>(OnPingResult); _pinger.PingStatistics += new EventHandler<PingerStatisticsEventArgs>(OnPingStatistics); _pinger.PingFinished += new EventHandler(OnPingFinished); _textBoxAddress.Text = address; _autoStartPinging = autoStartPinging; _textBoxAddress.TextChanged += new EventHandler(OnTextBoxTextChanged); _textBoxPingCount.TextChanged += new EventHandler(OnTextBoxTextChanged); _textBoxOutput.LinkClicked += new LinkClickedEventHandler(OnLinkClicked); _buttonAction.Click += new EventHandler(OnButtonActionClicked); _buttonCancel.Click += new EventHandler(OnButtonCloseClicked); }