Пример #1
0
        private void MarkAllListened_Click(object sender, EventArgs e)
        {
            if (MessageBox.Show("Are you sure you want to mark all episodes as listened?",
                                "Are you sure?",
                                MessageBoxButton.OKCancel) == MessageBoxResult.OK)
            {
                List <PodcastEpisodeModel> episodes = null;
                using (var db = new PodcastSqlModel())
                {
                    episodes = db.episodesForSubscription(m_subscription);
                    foreach (PodcastEpisodeModel episode in episodes)
                    {
                        episode.markAsListened(m_cleanListenedEpisodesAutomatically);
                    }
                    db.SubmitChanges();
                    PodcastSubscriptionsManager.getInstance().podcastPlaystateChanged(m_subscription);

                    m_subscription = db.subscriptionModelForIndex(m_podcastId);
                }

                this.DataContext             = m_subscription;
                this.EpisodeList.ItemsSource = m_subscription.EpisodesPublishedDescending;

                App.showNotificationToast("All episodes marked as listened.");
            }
        }
Пример #2
0
        private void DeleteAllDownloads_Click(object sender, EventArgs e)
        {
            if (MessageBox.Show("Are you sure you want to delete all downloaded episodes in this subscription?",
                                "Delete?",
                                MessageBoxButton.OKCancel) == MessageBoxResult.OK)
            {
                List <PodcastEpisodeModel> episodes = null;
                using (var db = new PodcastSqlModel())
                {
                    episodes = db.episodesForSubscription(m_subscription);
                    foreach (PodcastEpisodeModel episode in episodes)
                    {
                        if (episode.EpisodeDownloadState == PodcastEpisodeModel.EpisodeDownloadStateEnum.Downloaded)
                        {
                            episode.deleteDownloadedEpisode();
                            PodcastSubscriptionsManager.getInstance().removedPlayableEpisode(episode);
                        }
                    }
                }

                using (var db = new PodcastSqlModel())
                {
                    m_subscription = db.subscriptionModelForIndex(m_podcastId);
                }
            }

            this.DataContext             = m_subscription;
            this.EpisodeList.ItemsSource = m_subscription.EpisodesPublishedDescending;
        }
Пример #3
0
        public PodcastSearchResultControl()
        {
            InitializeComponent();
            this.Loaded += new RoutedEventHandler(Page_Loaded);

            m_subscriptionManager = PodcastSubscriptionsManager.getInstance();
        }
        public PodcastSearchResultControl()
        {
            InitializeComponent();
            this.Loaded += new RoutedEventHandler(Page_Loaded);

            m_subscriptionManager = PodcastSubscriptionsManager.getInstance();
        }
Пример #5
0
        public AddPodcastFromURL()
        {
            InitializeComponent();

            PodcastSubscriptionsManager.getInstance().OnPodcastChannelAddStarted           += new SubscriptionManagerHandler(AddPodcastFromURL_OnPodcastChannelAddStarted);
            PodcastSubscriptionsManager.getInstance().OnPodcastChannelAddFinishedWithError += new SubscriptionManagerHandler(AddPodcastFromURL_OnPodcastChannelAddFinishedWithError);
        }
Пример #6
0
        protected override void OnNavigatedFrom(System.Windows.Navigation.NavigationEventArgs e)
        {
            using (var db = new PodcastSqlModel())
            {
                PodcastSubscriptionModel sub = db.Subscriptions.First(s => s.PodcastId == m_subscription.PodcastId);
                sub.NewEpisodesCount = 0;
                db.SubmitChanges();
            }

            PodcastSubscriptionsManager.getInstance().NewPlayableEpisode -= new PodcastSubscriptionsManager.EpisodesEventHandler(m_subscription_NewPlayableEpisode);
        }
Пример #7
0
        /************************************* Public implementations *******************************/
        public AddSubscription()
        {
            InitializeComponent();

            m_subscriptionManager = PodcastSubscriptionsManager.getInstance();

            m_subscriptionManager.OnPodcastChannelStarted
                += new SubscriptionManagerHandler(subscriptionManager_OnPodcastChannelStarted);
            m_subscriptionManager.OnPodcastChannelFinished
                += new SubscriptionManagerHandler(subscriptionManager_OnPodcastChannelFinished);
            m_subscriptionManager.OnPodcastChannelFinishedWithError
                += new SubscriptionManagerHandler(subscriptionManager_OnPodcastChannelFinishedWithError);
        }
Пример #8
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            String            podcastUri = NavigationContext.QueryString["url"];
            NetworkCredential nc         = new NetworkCredential();

            nc.UserName = this.Username.Text;
            nc.Password = this.Password.Password;
#if DEBUG
            nc.UserName = "******";
            nc.Password = "******";
#endif
            PodcastSubscriptionsManager.getInstance().addSubscriptionFromURLWithCredentials(podcastUri, nc);
            NavigationService.GoBack();
        }
Пример #9
0
        protected override void OnNavigatedFrom(System.Windows.Navigation.NavigationEventArgs e)
        {
            using (var db = new PodcastSqlModel())
            {
                PodcastSubscriptionModel sub = db.Subscriptions.First(s => s.PodcastId == m_subscription.PodcastId);
                sub.NewEpisodesCount = 0;
                db.SubmitChanges();
            }

            PodcastSubscriptionsManager.getInstance().NewPlayableEpisode -= new PodcastSubscriptionsManager.EpisodesEventHandler(m_subscription_NewPlayableEpisode);

            App.episodeDownloadManager.OnPodcastEpisodeDownloadStateChanged -= new PodcastDownloadManagerHandler(episodeDownloadManager_PodcastEpisodeDownloadStateChanged);
            PodcastPlaybackManager.getInstance().OnPodcastStartedPlaying -= new EventHandler(PodcastEpisodes_OnPodcastPlaystateChanged);
            PodcastPlaybackManager.getInstance().OnPodcastStoppedPlaying -= new EventHandler(PodcastEpisodes_OnPodcastPlaystateChanged);
        }
Пример #10
0
        /************************************* Public implementations *******************************/
        public AddSubscription()
        {
            InitializeComponent();

            m_subscriptionManager = PodcastSubscriptionsManager.getInstance();

            m_subscriptionManager.OnPodcastChannelAddStarted
                += new SubscriptionManagerHandler(subscriptionManager_OnPodcastChannelAddStarted);
            m_subscriptionManager.OnPodcastChannelAddFinished
                += new SubscriptionManagerHandler(subscriptionManager_OnPodcastChannelAddFinished);
            m_subscriptionManager.OnPodcastChannelAddFinishedWithError
                += new SubscriptionManagerHandler(subscriptionManager_OnPodcastChannelAddFinishedWithError);
            m_subscriptionManager.OnPodcastChannelRequiresAuthentication
                += new SubscriptionManagerHandler(subscriptionManager_OnPodcastChannelRequiresAuthentication);
        }
Пример #11
0
        public ImportPodcastsViaOPML()
        {
            InitializeComponent();

            if (App.IsTrial)
            {
                this.opmlDisclaimer.Visibility   = System.Windows.Visibility.Collapsed;
                this.opmlNotAvailable.Visibility = System.Windows.Visibility.Visible;
                this.opmlUrl.IsEnabled           = false;
                this.importFromOpmlUrl.IsEnabled = false;
            }
            else
            {
                this.opmlDisclaimer.Visibility   = System.Windows.Visibility.Visible;
                this.opmlNotAvailable.Visibility = System.Windows.Visibility.Collapsed;
                this.opmlUrl.IsEnabled           = true;
                this.importFromOpmlUrl.IsEnabled = true;
            }

            PodcastSubscriptionsManager.getInstance().OnPodcastChannelAddStarted           += new SubscriptionManagerHandler(ImportPodcastViaOPML_OnPodcastChannelAddStarted);
            PodcastSubscriptionsManager.getInstance().OnPodcastChannelAddFinishedWithError += new SubscriptionManagerHandler(ImportPodcastViaOPML_OnPodcastChannelAddFinishedWithError);
        }
Пример #12
0
        private void resetEpisodeInDB()
        {
            using (var db = new PodcastSqlModel())
            {
                PodcastEpisodeModel e = db.Episodes.FirstOrDefault(ep => ep.EpisodeId == EpisodeId);
                if (e == null)
                {
                    Debug.WriteLine("Episode NULL. Probably alrady deleted.");
                    return;
                }

                e.SavedPlayPos         = SavedPlayPos;
                e.TotalLengthTicks     = TotalLengthTicks;
                e.EpisodeFile          = "";
                e.EpisodeDownloadState = EpisodeDownloadStateEnum.Idle;
                e.EpisodePlayState     = EpisodePlayStateEnum.Idle;
                e.SavedPlayPos         = 0;

                db.SubmitChanges();

                PodcastSubscriptionsManager.getInstance().podcastPlaystateChanged(e.PodcastSubscription);
            }
        }
Пример #13
0
        private void DeleteAllButton_Tap(object sender, System.Windows.Input.GestureEventArgs e)
        {
            if (MessageBox.Show("Are you sure you want to delete all downloaded podcasts?",
                                "Delete all?",
                                MessageBoxButton.OKCancel) == MessageBoxResult.Cancel)
            {
                return;
            }

            List <PodcastEpisodeModel> episodes = null;

            using (var db = new PodcastSqlModel())
            {
                episodes = db.allEpisodes();
            }

            foreach (PodcastEpisodeModel episode in episodes)
            {
                episode.deleteDownloadedEpisode();
                PodcastSubscriptionsManager.getInstance().removedPlayableEpisode(episode);
            }

            long bytes = getDownloadedBytes();

            if (bytes != 0)
            {
                if (MessageBox.Show("I have deleted all episodes from the database. But there are still some files on the filesystem that were not be deleted. Do you want to delete these too?",
                                    "Attention",
                                    MessageBoxButton.OKCancel) == MessageBoxResult.OK)
                {
                    deleteAllDownloadedFiles();
                }
            }

            m_podcastUsageText = null;
            UpdateUsageInformation();
        }
Пример #14
0
        private void DeleteAllButton_Tap(object sender, System.Windows.Input.GestureEventArgs e)
        {
            if (MessageBox.Show("Are you sure you want to delete all downloaded podcasts?",
                                "Delete all?",
                                MessageBoxButton.OKCancel) == MessageBoxResult.Cancel)
            {
                return;
            }

            List <PodcastEpisodeModel> episodes = null;

            using (var db = new PodcastSqlModel())
            {
                episodes = db.allEpisodes();
            }

            foreach (PodcastEpisodeModel episode in episodes)
            {
                episode.deleteDownloadedEpisode();
                PodcastSubscriptionsManager.getInstance().removedPlayableEpisode(episode);
            }

            this.UsageText.Text = getUsageString();
        }
Пример #15
0
        protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e)
        {
            m_podcastId = int.Parse(NavigationContext.QueryString["podcastId"]);
            using (var db = new PodcastSqlModel())
            {
                m_subscription = db.subscriptionModelForIndex(m_podcastId);
                m_cleanListenedEpisodesAutomatically = db.settings().IsAutoDelete;
                if (m_cleanListenedEpisodesAutomatically)
                {
                    PodcastSubscriptionsManager.getInstance().cleanListenedEpisodes(m_subscription);
                }
            }

            m_playableEpisodes = m_subscription.PlayableEpisodes;
            this.DataContext   = m_subscription;

            PodcastSubscriptionsManager.getInstance().NewPlayableEpisode     -= new PodcastSubscriptionsManager.EpisodesEventHandler(m_subscription_NewPlayableEpisode);
            PodcastSubscriptionsManager.getInstance().RemovedPlayableEpisode -= new PodcastSubscriptionsManager.EpisodesEventHandler(m_subscription_RemovedPlayableEpisode);

            PodcastSubscriptionsManager.getInstance().NewPlayableEpisode     += new PodcastSubscriptionsManager.EpisodesEventHandler(m_subscription_NewPlayableEpisode);
            PodcastSubscriptionsManager.getInstance().RemovedPlayableEpisode += new PodcastSubscriptionsManager.EpisodesEventHandler(m_subscription_RemovedPlayableEpisode);

            bool forceUpdate = false;

            try
            {
                forceUpdate = String.IsNullOrEmpty(NavigationContext.QueryString["forceUpdate"]) == false &&
                              bool.Parse(NavigationContext.QueryString["forceUpdate"]);
            }
            catch (KeyNotFoundException)
            {
                forceUpdate = false;
            }

            if (forceUpdate)
            {
                // Clear the back stack
                while (((App)Application.Current).RootFrame.RemoveBackEntry() != null)
                {
                    ;
                }

                ShellTile pinnedSubscriptionTile = m_subscription.getSubscriptionsLiveTile();
                if (pinnedSubscriptionTile != null)
                {
                    StandardTileData tileData = new StandardTileData();
                    tileData.Count     = 0;
                    tileData.BackTitle = "";
                    pinnedSubscriptionTile.Update(tileData);
                }

                PodcastSubscriptionsManager.getInstance().refreshSubscription(m_subscription);
            }

            m_subscription.PodcastCleanStarted  -= new PodcastSubscriptionModel.SubscriptionModelHandler(m_subscription_PodcastCleanStarted);
            m_subscription.PodcastCleanFinished -= new PodcastSubscriptionModel.SubscriptionModelHandler(m_subscription_PodcastCleanFinished);

            m_subscription.PodcastCleanStarted  += new PodcastSubscriptionModel.SubscriptionModelHandler(m_subscription_PodcastCleanStarted);
            m_subscription.PodcastCleanFinished += new PodcastSubscriptionModel.SubscriptionModelHandler(m_subscription_PodcastCleanFinished);

            // Clean old episodes from the listing.
            if (SettingsModel.keepNumEpisodesForSelectedIndex(m_subscription.SubscriptionSelectedKeepNumEpisodesIndex) != SettingsModel.KEEP_ALL_EPISODES)
            {
                m_subscription.cleanOldEpisodes(SettingsModel.keepNumEpisodesForSelectedIndex(m_subscription.SubscriptionSelectedKeepNumEpisodesIndex));
            }

            if (App.episodeDownloadManager == null)
            {
                App.episodeDownloadManager = PodcastEpisodesDownloadManager.getInstance();
            }

            App.episodeDownloadManager.OnPodcastEpisodeDownloadStateChanged += new PodcastDownloadManagerHandler(episodeDownloadManager_PodcastEpisodeDownloadStateChanged);

            PodcastPlaybackManager.getInstance().OnPodcastStartedPlaying += new EventHandler(PodcastEpisodes_OnPodcastPlaystateChanged);
            PodcastPlaybackManager.getInstance().OnPodcastStoppedPlaying += new EventHandler(PodcastEpisodes_OnPodcastPlaystateChanged);
        }
Пример #16
0
 public PodcastListCategory()
 {
     InitializeComponent();
     PodcastSubscriptionsManager.getInstance().OnPodcastChannelAddStarted           += new SubscriptionManagerHandler(PodcastListCategory_OnPodcastChannelAddStarted);
     PodcastSubscriptionsManager.getInstance().OnPodcastChannelAddFinishedWithError += new SubscriptionManagerHandler(PodcastListCategory_OnPodcastChannelAddFinishedWithError);
 }
Пример #17
0
 private void ImportFromOneDriveMenuItem_Click(object sender, EventArgs e)
 {
     PodcastSubscriptionsManager.getInstance().importSubscriptionsFromOneDrive();
 }
Пример #18
0
 private void importFromOpmlUrl_Click(object sender, RoutedEventArgs e)
 {
     PodcastSubscriptionsManager.getInstance().addSubscriptionFromOPMLFile(opmlUrl.Text);
 }
Пример #19
0
 private void addFromUrlButton_Click(object sender, RoutedEventArgs e)
 {
     PodcastSubscriptionsManager.getInstance().addSubscriptionFromURL(addFromUrlInput.Text, true);
 }