Beispiel #1
0
        public void DeleteMediaItem(MediaItemsListModelItem item)
        {
            var downloads = LoggedUser.Downloads.Where(dl => dl.Id == item.Id).ToList();

            if (downloads.Count > 0)
            {
                DownloadManager.CancelDownloads(downloads)
                .ObserveOnDispatcher()
                .Finally(() =>
                {
                    using (IsolatedStorageFile isf = IsolatedStorageFile.GetUserStoreForApplication())
                    {
                        foreach (var download in downloads)
                        {
                            string path = Utils.MediaFilePath(LoggedUser, download);
                            if (isf.FileExists(path))
                            {
                                isf.DeleteFile(path);
                            }
                        }
                    }
                })
                .Subscribe();

                LoggedUser.Downloads.Remove(downloads);
            }
            else
            {
                using (IsolatedStorageFile isf = IsolatedStorageFile.GetUserStoreForApplication())
                {
                    string path = Utils.MediaFilePath(LoggedUser, item);
                    if (isf.FileExists(path))
                    {
                        isf.DeleteFile(path);
                    }
                }
            }
        }
Beispiel #2
0
 public void StartDownload(QueuedDownload download)
 {
     DownloadManager.StartDownload(download);
 }