showNotificationToast() public static method

public static showNotificationToast ( string message ) : void
message string
return void
コード例 #1
0
        void wc_DownloadOPMLCompleted(object sender, DownloadStringCompletedEventArgs e)
        {
            if (e.Error != null)
            {
                App.showErrorToast("Cannot fetch OPML from that location.");

                SubscriptionManagerArgs args = new SubscriptionManagerArgs();
                args.message = "Cannot fetch OPML from that location.";
                OnPodcastChannelAddFinishedWithError(this, args);
                return;
            }

            String     opml          = e.Result as String;
            List <Uri> subscriptions = PodcastFactory.podcastUrlFromOPMLImport(opml);

            if (subscriptions == null ||
                subscriptions.Count < 1)
            {
                App.showNotificationToast("No subscriptions to import.");

                SubscriptionManagerArgs args = new SubscriptionManagerArgs();
                args.message = "No podcasts to import.";
                OnPodcastChannelAddFinishedWithError(this, args);
                return;
            }

            foreach (Uri subscription in subscriptions)
            {
                addSubscriptionFromURL(subscription.ToString(), true);
            }
        }
コード例 #2
0
        public void startDefaultBehaviorPlayback()
        {
            using (PodcastSqlModel db = new PodcastSqlModel())
            {
                try
                {
                    PodcastEpisodeModel latestPlayed = db.Episodes.Where(ep => (ep.LastPlayed.HasValue == true && ep.LastPlayed.Value.Year > 2013)).OrderByDescending(ep => ep.LastPlayed).FirstOrDefault();
                    if (latestPlayed != null)
                    {
                        App.showNotificationToast("Playing recently played episode.");
                        play(latestPlayed);
                        return;
                    }
                }
                catch (InvalidOperationException)
                {
                    Debug.WriteLine("Could not find a suitable latest episode played.");
                }

                // Did not find a suitable episode that was previously played, so we have to start a "new" playback.
                // This playback is the latest published episode.
                PodcastEpisodeModel newestEpisode = db.Episodes.OrderByDescending(ep => ep.EpisodePublished).FirstOrDefault();
                if (newestEpisode != null)
                {
                    App.showNotificationToast("Playing newest episode.");
                    play(newestEpisode);
                }
                else
                {
                    Debug.WriteLine("Uups, cannot find a newest episode to play.");
                }
            }
        }
コード例 #3
0
        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.");
        }
コード例 #4
0
        private void LatestEpisodeTapped(object sender, GestureEventArgs e)
        {
            PodcastEpisodeModel episode = DataContext as PodcastEpisodeModel;

            if (episode == null)
            {
                App.showNotificationToast("You don't subscribe to the podcast anymore.");
                return;
            }

            PodcastPlaybackManager.getInstance().play(episode);
        }
コード例 #5
0
        private void MenuItemPin_Click(object sender, RoutedEventArgs e)
        {
            PodcastSubscriptionModel subscriptionToPin = (sender as MenuItem).DataContext as PodcastSubscriptionModel;

            // Copy the logo file to tile's shared location.
            String tileImageLocation = "Shared/ShellContent/" + subscriptionToPin.PodcastLogoLocalLocation.Split('/')[1];

            using (IsolatedStorageFile myIsolatedStorage = IsolatedStorageFile.GetUserStoreForApplication())
            {
                if (myIsolatedStorage.FileExists(subscriptionToPin.PodcastLogoLocalLocation) == false)
                {
                    Debug.WriteLine("Podcast logo not found. Cannot pin.");
                    App.showNotificationToast("Podcast logo not found. Cannot pin.");
                    return;
                }

                if (myIsolatedStorage.FileExists(tileImageLocation) == false)
                {
                    myIsolatedStorage.CopyFile(subscriptionToPin.PodcastLogoLocalLocation,
                                               tileImageLocation);
                }
            }

            // Setup data for the live tile.
            StandardTileData tileData = new StandardTileData();

            tileData.BackgroundImage = new Uri("isostore:/" + tileImageLocation, UriKind.Absolute);
            tileData.Title           = subscriptionToPin.PodcastName;

            IsolatedStorageSettings settings    = IsolatedStorageSettings.ApplicationSettings;
            String subscriptionLatestEpisodeKey = App.LSKEY_BG_SUBSCRIPTION_LATEST_EPISODE + subscriptionToPin.PodcastId;

            if (settings.Contains(subscriptionLatestEpisodeKey) == false)
            {
                settings.Add(subscriptionLatestEpisodeKey, ""); // Create empty key so we know the subscription is pinned.
            }

            subscriptionToPin.EpisodesManager.updatePinnedInformation();

            try
            {
                Uri tileUri = new Uri(string.Format("/Views/PodcastEpisodes.xaml?podcastId={0}&forceUpdate=true", subscriptionToPin.PodcastId), UriKind.Relative);
                Debug.WriteLine(string.Format("Pinning to start: Image: {0} Title: {1} Navigation uri: {2}", tileData.BackgroundImage, tileData.Title, tileUri));
                ShellTile.Create(tileUri, tileData);
            }
            catch (InvalidOperationException)
            {
                Debug.WriteLine("Could not pin to start screen. The subscription is already pinned.");
            }
        }
コード例 #6
0
        private void PlayHistoryItemTapped(object sender, System.Windows.Input.GestureEventArgs e)
        {
            PodcastEpisodeModel episode = DataContext as PodcastEpisodeModel;

            if (episode == null)
            {
                App.showNotificationToast("You don't subscribe to the podcast anymore.");
                return;
            }

            using (var db = new PodcastSqlModel())
            {
                PodcastSubscriptionModel sub = db.Subscriptions.FirstOrDefault(s => s.PodcastId == episode.PodcastId);
                if (sub == null)
                {
                    App.showNotificationToast("You don't subscribe to the podcast anymore.");
                    return;
                }
            }

            (Application.Current.RootVisual as PhoneApplicationFrame).Navigate(new Uri(string.Format("/Views/PodcastEpisodes.xaml?podcastId={0}", episode.PodcastId), UriKind.Relative));
        }
コード例 #7
0
        /****************************** Private implementations *******************************/

        private void showAddedNotification(int count)
        {
            String notification = String.Format("{0} podcast{1} added to play queue.", count, (count > 1) ? "s" : "");

            App.showNotificationToast(notification);
        }