public void executeOperation(Button btn, Label lbl, String url, IDownloadObserver observer) { mIDownloadObserver = observer; // if (!System.Net.NetworkInformation.NetworkInterface.GetIsNetworkAvailable()) { if (mIDownloadObserver != null) { mIDownloadObserver.onMessage(new DownloadArgument("NetworkFailed")); } return; } if (btn.Text == "Cancel") { btn.Text = "Download"; cancel(url); return; } FileDownloader fd = create(lbl, url, observer, btn); if (fd.DownloadStatus == "Continue") { return; } if (fd.DownloadStatus != "Completed") { fd.DownloadAsync(url, this); btn.Text = "Cancel"; btn.Enabled = true; } }
void IDownloadObserver.onMessage(DownloadArgument e) { if (mIDownloadObserver != null) { mIDownloadObserver.onMessage(e); } }