private void ButtonStart_Click(object sender, EventArgs e) { if (String.IsNullOrEmpty(this.TextHost.Text.Trim())) { this.TextHost.Focus(); return; } this.TextHost.Text = this.TextHost.Text.Trim(); this.ButtonStart.Enabled = false; this.ButtonStop.Enabled = true; this.TextHost.Enabled = false; Application.DoEvents(); if (!this.traceRunning) { if (this.tracert == null) { this.tracert = new TraceRoute(); this.tracert.Completed += this.tracert_Completed; this.tracert.RouteHopFound += this.tracert_RouteHopFound; } this.tracert.Destination = this.TextHost.Text; this.tracert.ResolveNames = this.ResolveCheckBox.Checked; try { this.tracert.Start(); } catch (Exception ex) { string warning = ex.Message.Replace("Ping", "Trace Route"); Log.Warn(warning); this.ResetForm(); MessageBox.Show(warning, "Ups ...", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } this.traceRunning = true; } this.hopList = new List <TraceRouteHopData>(); }
private void ButtonStart_Click(object sender, EventArgs e) { if (String.IsNullOrEmpty(this.TextHost.Text.Trim())) { this.TextHost.Focus(); return; } this.TextHost.Text = this.TextHost.Text.Trim(); this.ButtonStart.Enabled = false; this.ButtonStop.Enabled = true; this.TextHost.Enabled = false; Application.DoEvents(); if (!this.traceRunning) { if (this.tracert == null) { this.tracert = new TraceRoute(); this.tracert.Completed += this.tracert_Completed; this.tracert.RouteHopFound += this.tracert_RouteHopFound; } this.tracert.Destination = this.TextHost.Text; this.tracert.ResolveNames = this.ResolveCheckBox.Checked; try { this.tracert.Start(); } catch (Exception ex) { Log.Warn(ex.Message); this.ResetForm(); MessageBox.Show(ex.Message, "Ups ...", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } this.traceRunning = true; } this.hopList = new List<TraceRouteHopData>(); }