private void StartTest(TestStatus test) { ProcessStatus ps = test as ProcessStatus; if (ps != null) { StartProcess(ps, true); return; } DnsResolveStatus rs = test as DnsResolveStatus; if (rs != null) { StartDnsResolve(rs); return; } MultiProcessStatus mps = test as MultiProcessStatus; if (mps != null) { StartMultiPorcess(mps); return; } Debug.Assert(false); }
public void DnsTestFinishedThreadSafe(DnsResolveStatus rs) { if (this.InvokeRequired) { var myDelegate = new DnsTestFinishedDelegate(DnsTestFinishedThreadSafe); this.BeginInvoke(myDelegate, new object[] { rs }); return; } rs.Stop(); NotifyUiTestFinished(); }
private void DnsCallback(IAsyncResult result) { DnsResolveStatus rs = result.AsyncState as DnsResolveStatus; try { IPAddress[] ips = Dns.EndGetHostAddresses(result); rs.IPAddresses = ips; } catch (Exception ex) { System.Diagnostics.Trace.WriteLine(ex.ToString()); } DnsTestFinishedThreadSafe(rs); }
private void StartDnsResolve(DnsResolveStatus rs) { Dns.BeginGetHostAddresses(rs.Hostname, new AsyncCallback(DnsCallback), rs); }