/// <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 Razor.Networking.ExceptionEventHandler(OnPingException); _pinger.PingStarted += new PingerEventHandler(OnPingStarted); _pinger.PingResult += new PingerResultEventHandler(OnPingResult); _pinger.PingStatistics += new PingerStatisticsEventHandler(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; } }