async private void MenuItemBackup_Click(object sender, RoutedEventArgs e)
        {
            String podcastName = m_episodeModel.GetProperty <PodcastSubscriptionModel>("PodcastSubscription").GetProperty <String>("PodcastName");
            String folderId    = await OneDriveManager.getInstance().createFolderIfNotExists(String.Format("Podcasts/{0}", podcastName));

            Debug.WriteLine(String.Format("Backing up podcast to OneDrive, Podcast: {0}, Episode: {1}", podcastName, m_episodeModel.EpisodeName));

            App.showNotificationToast(String.Format("Started backing up '{0}'.", m_episodeModel.EpisodeName));
            await OneDriveManager.getInstance().uploadFileBackground(folderId, new Uri(m_episodeModel.EpisodeFile, UriKind.Relative));

            App.showNotificationToast("Backup completed.");
        }
Example #2
0
        async private void exportToOneDrive(String opmlExportFileName, IsolatedStorageFileStream sourceStream)
        {
            try
            {
                await OneDriveManager.getInstance().uploadFile("me/SkyDrive", opmlExportFileName, sourceStream);

                MessageBox.Show("Exported to OneDrive succesfully!");

                SubscriptionManagerArgs managerArgs = new SubscriptionManagerArgs();
                managerArgs.state = SubscriptionsState.FinishedOneDriveExport;
                OnOPMLExportToOneDriveChanged(this, managerArgs);
            }
            catch (Exception e)
            {
                MessageBox.Show("There was an error uploading to OneDrive. Please try again.");
            }
        }
Example #3
0
        async internal void importSubscriptionsFromOneDrive()
        {
            if (MessageBox.Show("Podcatcher will try to find and import the latest podcasts that were exported from Podcatcher. Please login to OneDrive to continue.",
                                "Import from OneDrive",
                                MessageBoxButton.OKCancel) != MessageBoxResult.OK)
            {
                return;
            }

            OneDriveFile latestExport = (await OneDriveManager.getInstance().getFileListing("me/SkyDrive/files"))
                                        .OrderByDescending(file => file.Created)
                                        .Where(file => file.Name.Contains("PodcatcherSubscriptions"))
                                        .FirstOrDefault();

            if (latestExport == null)
            {
                MessageBox.Show("Could not find any exported podcasts from Podcatcher on OneDrive. Make sure to have the exported OPML file in your root OneDrive folder.");
                return;
            }

            Debug.WriteLine("Going to get file {0} (Id: {1}) from {2}: ", latestExport.Name, latestExport.Id, latestExport.Url);
            PodcastSubscriptionsManager.getInstance().addSubscriptionFromOPMLFile(latestExport.Url);
        }