DownloadStringCompleted event and other stuff in Windows Phone, C#

I always wondered why on earth DownloadStringCompleted method of WebClient class is a void type. Is there any way I could’ve gone for a  overloaded DownloadStringCompleted function to get my job done so it can return the result to the caller.

I was trying to use a facade like structure for a Windows Phone app. So usually at very first stage of writing C# code, one usually goes with a instance of WebClient object like below:


WebClient Client=new WebClient();
Client.DownloadStringCompleted += SomeDownloadStringCompletedEventHandler;
Client.DownloadStringAsync(SomeUri)

But the irony is here everytime I fetch a different website I write a minimal line of code redundantly (yes, I was a darn noob). But the thing is, I was trying to attach a parser and get back my result to feed the parser with one call. I thought of forcing the download to synchronous await but didn’t want to jeopardize my apps fluidity rather I decided to even parse on async so even when parsing the fetched data the app doesn’t loose its respective fluidity.

After some searching I came with something like this. I don’t know how would it work later when I write the parser but still works okay and saves me a bunch of redundant codes.


public void DownloadWebSiteNParse(Uri WebUri, Action ResultCallBack, Action ErrorCallBack)
{
string response = string.Empty;
HtmlDocument ReturnDoc = new HtmlDocument();
WClient.DownloadStringCompleted += (sender, e) =
{
response = e.Result;
if (response == null || e.Error != null)
{
if (ErrorCallBack != null)
ErrorCallBack(e.Error.Message);
}
else
{
ReturnDoc.LoadHtml(response);
if (ResultCallBack != null)
ResultCallBack(ReturnDoc);
}
};
WClient.DownloadStringAsync(WebUri);
}