/// <summary> /// Assets are attached to an issue and then downloaded. /// The DownloadDelegate can call UIApplication.SharedApplication.BeginBackgroundTask() /// to 'process' the download, AND set a new icon /// </summary> public static void Download(UITextView display) { if (downloading) { return; } downloading = true; var library = NKLibrary.SharedLibrary; var issues = library.Issues; if (issues.Length == 0) { return; } var issue = issues[1]; // New York NKAssetDownload asset = issue.AddAsset(new NSUrlRequest(new NSUrl("http://xamarin.com/"))); newsstandDelegate = new NewsstandUrlDelegate1("NewYorkContent", issue); newsstandDelegate.OnDownloadingFinished += () => { downloading = false; }; //you do not have background download privileges: add 'newsstand-content' to mainBundle.infoDictionary.UIBackgroundModes asset.DownloadWithDelegate(newsstandDelegate); display.Text = string.Format("Issue {0} downloading has started", issues[1].Name); display.Text += "\n\nPress the Read button quickly to see the 'downloading' status detected"; }
/// <summary> /// Assets are attached to an issue and then downloaded. /// The DownloadDelegate can call UIApplication.SharedApplication.BeginBackgroundTask() /// to 'process' the download, AND set a new icon /// </summary> public static void Download (UITextView display) { if (downloading) return; downloading = true; var library = NKLibrary.SharedLibrary; var issues = library.Issues; if (issues.Length == 0) return; var issue = issues[1] ; // New York NKAssetDownload asset = issue.AddAsset (new NSUrlRequest (new NSUrl ("http://xamarin.com/"))); newsstandDelegate = new NewsstandUrlDelegate1 ("NewYorkContent", issue); newsstandDelegate.OnDownloadingFinished += () => { downloading = false; }; //you do not have background download privileges: add 'newsstand-content' to mainBundle.infoDictionary.UIBackgroundModes asset.DownloadWithDelegate (newsstandDelegate); display.Text = string.Format ("Issue {0} downloading has started", issues[1].Name); display.Text += "\n\nPress the Read button quickly to see the 'downloading' status detected"; }