Ejemplo n.º 1
0
        static void NotifyDownloadListeners()
        {
            lock (requestQueue)
            {
                foreach (var quri in queuedUpdates)
                {
                    var list = pendingRequests[quri];
                    pendingRequests.Remove(quri);

                    DownloadInfo down = MBDownloadManager.DownloadInfo(quri.AbsoluteUri);

                    if (down != null)
                    {
                        Android.App.DownloadManager downloadManager = (Android.App.DownloadManager)Application.Context.GetSystemService("download");
                        downloadManager.Remove(down.Id);

                        MBDownloadManager.RegisterDownload(quri.ToString(), down.LocalUri);
                    }

                    foreach (var pr in list)
                    {
                        try
                        {
                            pr.DownloadCompleted(quri.AbsoluteUri, ""); // this is the bit that should be on the UiThread
                        }
                        catch (Exception e)
                        {
                            Log.Error("MWC", e.Message);
                        }
                    }
                }

                queuedUpdates.Clear();
            }
        }