public void DownloadDidFinish(NSUrlDownload download) { var data = File.ReadAllBytes(tempFile); owner.eventsHandler.OnDataAvailable(data, data.Length); owner.eventsHandler.OnDownloadCompleted(true, "done"); }
public void DecideDestinationWithSuggestedFilename(NSUrlDownload download, String suggestedFilename) { if (!owner.eventsHandler.OnStartDownload(new Uri(download.Request.Url.ToString()))) { download.Cancel(); return; } bytesRecd = 0; tempFile = Path.GetTempFileName(); // todo: use LJ temp files manager to ensure eventual cleanup download.SetDestination(tempFile, true); }
public void DidFailWithError(NSUrlDownload download, NSError error) { owner.eventsHandler.OnDownloadCompleted(false, error.LocalizedDescription); }
public void DidReceiveDataOfLength(NSUrlDownload download, int length) { bytesRecd += length; owner.eventsHandler.OnProgress(bytesRecd, bytesRecd, "downloading"); // todo: use OnProgress ret val for cancellation }