void _tracer_OnHopFail(IPRouteTracer tracer, int hop, int retry, IPAddress address, System.Net.NetworkInformation.IPStatus status) { if (InvokeRequired) { BeginInvoke(new IPRouteTracer.HopFailDelegate(_tracer_OnHopFail), tracer, hop, retry, address, status); return; } _lStatus.Text = "Status: Hop " + hop + " failed! Response from [" + address + "]: \"" + status.ToString() + "\". Retry: " + retry + "."; }
void _tracer_OnTraceCompleted(IPRouteTracer tracer, IPRouteTracer.TraceStatus status) { if (InvokeRequired) { BeginInvoke(new IPRouteTracer.TraceCompletedDelegate(_tracer_OnTraceCompleted), tracer, status); return; } EnableSettings(true); _lStatus.Text = "Status: Trace to [" + tracer.Target + "] " + IPRouteTracer.TraceStatusNames[(int)status] + "!"; }
public IPTraceForm() { InitializeComponent(); _tracer = new IPRouteTracer(null, (int)_spnTimeout.Value, (int)_spnRetries.Value, (int)_spnPingsPerHop.Value, (int)_spnBufferSize.Value); _tracer.OnTraceStarted += new IPRouteTracer.StartTraceDelegate(_tracer_OnTraceStart); _tracer.OnTraceCompleted += new IPRouteTracer.TraceCompletedDelegate(_tracer_OnTraceCompleted); _tracer.OnHopSuccess += new IPRouteTracer.HopDelegate(_tracer_OnHopSuccess); _tracer.OnHopPing += new IPRouteTracer.HopDelegate(_tracer_OnHopPing); _tracer.OnHopFail += new IPRouteTracer.HopFailDelegate(_tracer_OnHopFail); AddColumn(); }
private void _tracer_OnHopPing(IPRouteTracer tracer, IPRouteHop hop) { if (InvokeRequired) { BeginInvoke(new IPRouteTracer.HopDelegate(_tracer_OnHopPing), tracer, hop); return; } ListViewItem item = FindListViewItem(hop); long respTime = hop.ResponseTimes[hop.PingsCompleted - 1]; item.SubItems.Add(respTime < 0 ? "*" : respTime.ToString() + " ms"); }
private void _tracer_OnTraceStart(IPRouteTracer tracer) { if (InvokeRequired) { BeginInvoke(new IPRouteTracer.StartTraceDelegate(_tracer_OnTraceStart), tracer); return; } foreach (ListViewItem item in _lvRouteList.Items) { ((IPRouteHop)item.Tag).OnHostNameAvailable -= hop_OnHostNameAvailable; } _lvRouteList.Items.Clear(); EnableSettings(false); _btnAddHost.Enabled = false; }
private void _tracer_OnHopSuccess(IPRouteTracer tracer, IPRouteHop hop) { if (InvokeRequired) { BeginInvoke(new IPRouteTracer.HopDelegate(_tracer_OnHopSuccess), tracer, hop); return; } ListViewItem item = new ListViewItem(hop.Hop.ToString()); item.Tag = hop; item.SubItems.Add(hop.Address.ToString()); item.SubItems.Add(""); _lvRouteList.Items.Add(item); hop.OnHostNameAvailable += new IPRouteHop.HostNameAvailableDelegate(hop_OnHostNameAvailable); item.SubItems[2].Text = hop.HostName; _lStatus.Text = "Status: Hop " + hop.Hop + " [" + hop.Address + "] successful!"; }