public void LoadAsync (string url)
{
// If WaitOnLoad is true, do not do async
if (wait_on_load) {
Load (url);
return;
}
if (string.IsNullOrEmpty (url))
throw new InvalidOperationException ("ImageLocation not specified.");
image_location = url;
ChangeImage (InitialImage, true);
if (ImageDownload.IsBusy)
ImageDownload.CancelAsync ();
Uri uri = null;
try {
uri = new Uri (url);
} catch (UriFormatException) {
uri = new Uri (Path.GetFullPath (url));
}
ImageDownload.DownloadProgressChanged += new DownloadProgressChangedEventHandler (ImageDownload_DownloadProgressChanged);
ImageDownload.DownloadDataCompleted += new DownloadDataCompletedEventHandler (ImageDownload_DownloadDataCompleted);
ImageDownload.DownloadDataAsync (uri);
}