void OnDownloadStringCompleted(object aSender, DownloadStringCompletedEventArgs aArgs) { QueryNextSite(); var handler = (Action<REST, RESTResult>)aArgs.UserState; var result = new RESTResult(aArgs); if (result.Error == null && !result.Cancelled && !string.IsNullOrEmpty(aArgs.Result)) ParseData(XDocument.Parse(aArgs.Result, LoadOptions.None)); handler(this, result); }