Available Events
DownloadManager provides several events for both the overall batch and for individual files that can be responded to such as:
- DownloadError
- DownloadCanceled
- DowloadFileStarted
- DownloadFileCompleted
- FileDownloadProgressPercent
- OverallDownloadProgressPercent
- AllDownloadsCompleted
iOS Example
using Appracatappra.Web.DownloadManager;
...
private DownloadManager _downloadManager;
...
public override void ViewDidLoad ()
{
//Initialize the manager
_dowloadManager=new DownloadManager();
//Wireup completion handler
_downloadManager.AllDownloadsCompleted+= delegate() {
//Update GUI on main thread
using(var pool = new NSAutoreleasePool()){
pool.BeginInvokeOnMainThread(delegate{
//Display Alert Dialog Box
using(var alert = new UIAlertView("DownloadManager", "All files have been downloaded", null, "OK", null))
{
alert.Show();
}
});
}
};
//Specify the directory to download the file to
string directory=Environment.GetFolderPath(Environment.SpecialFolder.Personal);
//Queue up a file to download: Source URL, Directory to download to and optionally renaming the file
_downloadManager.QueueFile("https://appracatappra.com/wp-content/plugins/download-monitor/download.php?id=4",directory,"NDA.pdf");
//Start the download process
_downloadManager.StartDownloading();
}