async void DownloadAsync(object sender, EventArgs args)
{
clickButton.Click += manager.EventHandler;
SetDownloading ();
string filePath = string.Empty;
try {
filePath = await manager.DownloadAsync(downloadUrl, "downloaded.png");
} catch(TaskCanceledException) {
Console.WriteLine ("Task Canceled!");
SetReadyToDownload ();
return;
} catch(Exception exc) {
Console.WriteLine (exc);
SetReadyToDownload ();
return;
}
infoLabel.Text = "Resizing Image...";
var bitmap = await FetchBitmap (filePath);
imageview.SetImageBitmap (bitmap);
SetReadyToDownload ();
// Solution is here
clickButton.Click -= manager.EventHandler;
}