コード例 #1
0
        /// <summary>
        /// Fired when the collector state is updated.
        /// </summary>
        /// <param name="state">The new state</param>
        private async void Collector_OnCollectorStateChange(object sender, OnCollectorStateChangeArgs args)
        {
            // Set loading if needed.
            ToggleLoadingBar(args.State == CollectorState.Updating || args.State == CollectorState.Extending);

            // Toggle the suppress depending on if we are updating, extending, or idle
            ui_postList.SuppressEndOfListEvent = args.State == CollectorState.Updating || args.State == CollectorState.Extending;

            // If we had an error show a message.
            if (m_isVisible && args.State == CollectorState.Error)
            {
                if (args.ErrorState == CollectorErrorState.ServiceDown)
                {
                    App.BaconMan.MessageMan.ShowRedditDownMessage();
                }
                else
                {
                    App.BaconMan.MessageMan.ShowMessageSimple("That's Not Right", "We can't update this subreddit right now, check your Internet connection.");
                }
            }

            // Show no posts if nothing was loaded
            if (args.State == CollectorState.Idle || args.State == CollectorState.FullyExtended)
            {
                bool postLoaded = m_collector.GetCurrentPosts().Count != 0;
                await global::Windows.ApplicationModel.Core.CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
                {
                    ui_noPostText.Visibility = postLoaded ? Visibility.Collapsed : Visibility.Visible;
                });
            }
        }
コード例 #2
0
 private async void CommentCollector_OnCollectorStateChange(object sender, OnCollectorStateChangeArgs e)
 {
     // #todo handle when there are no more
     if (e.State == CollectorState.Idle || e.State == CollectorState.FullyExtended)
     {
         // When we are idle hide the loading message.
         await Windows.ApplicationModel.Core.CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
         {
             // Check if we have any comments
             if (e.NewPostCount == 0 && m_post.Comments.Count == 0)
             {
                 m_post.ShowCommentLoadingMessage       = Visibility.Visible;
                 m_post.ShowCommentsErrorMessage        = "No Comments";
                 m_post.FlipViewShowLoadingMoreComments = false;
             }
             else
             {
                 m_post.ShowCommentLoadingMessage       = Visibility.Collapsed;
                 m_post.FlipViewShowLoadingMoreComments = false;
             }
         });
     }
     else if (e.State == CollectorState.Error)
     {
         // Show an error message if we error
         await Windows.ApplicationModel.Core.CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
         {
             m_post.ShowCommentsErrorMessage        = "Error Loading Comments";
             m_post.FlipViewShowLoadingMoreComments = false;
         });
     }
 }
コード例 #3
0
 /// <summary>
 /// Fired when the collector state changes.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void Collector_OnCollectorStateChange(object sender, OnCollectorStateChangeArgs e)
 {
     if (e.State == CollectorState.Error)
     {
         // If we get an error we are done.
         ReleaseDeferal();
     }
 }
コード例 #4
0
 /// <summary>
 /// Fired when the collector state has changed.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void Collector_OnCollectorStateChange(object sender, OnCollectorStateChangeArgs e)
 {
     // If we go into an error state fire the event indicate we failed.
     if (e.State == CollectorState.Error)
     {
         FireReadyEvent(new List <string>());
     }
 }
コード例 #5
0
 private async void Collector_OnCollectorStateChange(object sender, OnCollectorStateChangeArgs e)
 {
     await Windows.ApplicationModel.Core.CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
     {
         // Show or hide the progress bar
         ToggleProgressBar(e.State == CollectorState.Updating);
     });
 }
コード例 #6
0
ファイル: MessageInbox.xaml.cs プロジェクト: maly7/Baconit
 private async void Collector_OnCollectorStateChange(object sender, OnCollectorStateChangeArgs e)
 {
     await Windows.ApplicationModel.Core.CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
     {
         // Show or hide the progress bar
         ToggleProgressBar(e.State == CollectorState.Updating);
     });
 }
コード例 #7
0
 /// <summary>
 /// Fired when the collector state has changed.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void Collector_OnCollectorStateChange(object sender, OnCollectorStateChangeArgs e)
 {
     // If we go into an error state fire the event indicate we failed.
     if(e.State == CollectorState.Error)
     {
         FireReadyEvent(new List<string>());
     }
 }
コード例 #8
0
        /// <summary>
        /// Fired when the collector state changed for the either
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Collector_OnCollectorStateChange(UpdateTypes type, OnCollectorStateChangeArgs e)
        {
            if (e.State == CollectorState.Error)
            {
                // We had an error. This is the end of the line, kill the deferral
                ReleaseDeferral(type);

                // And try to set isRunning
                UnSetIsRunningIfDone();
            }
        }
コード例 #9
0
        private async void Collector_OnCollectorStateChange(object sender, OnCollectorStateChangeArgs e)
        {
            await Windows.ApplicationModel.Core.CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
            {
                // Show or hide the progress bar
                ToggleProgressBar(e.State == CollectorState.Updating || e.State == CollectorState.Extending);

                if(e.State == CollectorState.Error && e.ErrorState == CollectorErrorState.ServiceDown)
                {
                    App.BaconMan.MessageMan.ShowRedditDownMessage();
                }
            });
        }
コード例 #10
0
        private async void Collector_OnCollectorStateChange(object sender, OnCollectorStateChangeArgs e)
        {
            await Windows.ApplicationModel.Core.CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
            {
                // Show or hide the progress bar
                ToggleProgressBar(e.State == CollectorState.Updating || e.State == CollectorState.Extending);

                if (e.State == CollectorState.Error && e.ErrorState == CollectorErrorState.ServiceDown)
                {
                    App.BaconMan.MessageMan.ShowRedditDownMessage();
                }
            });
        }
コード例 #11
0
 /// <summary>
 /// Fired when the collection state is changing
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private async void CurrentSubCollector_OnCollectorStateChange(object sender, OnCollectorStateChangeArgs e)
 {
     await global::Windows.ApplicationModel.Core.CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
     {
         if (e.State == CollectorState.Idle || e.State == CollectorState.Error || e.State == CollectorState.FullyExtended)
         {
             HideProgressBar(SearchResultTypes.Subreddit);
         }
         else
         {
             ShowProgressBar(SearchResultTypes.Subreddit);
         }
     });
 }
コード例 #12
0
 private async void CommentCollector_OnCollectorStateChange(object sender, OnCollectorStateChangeArgs e)
 {
     // #todo handle when there are no more
     if (e.State == CollectorState.Idle)
     {
         // When we are idle hide the loading message.
         await Windows.ApplicationModel.Core.CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
         {
             m_post.ShowCommentLoadingMessage = Visibility.Collapsed;
         });
     }
     else if (e.State == CollectorState.Error)
     {
         // Show an error message if we error
         await Windows.ApplicationModel.Core.CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
         {
             m_post.ShowCommentsErrorMessage = "Error Loading Comments";
         });
     }
 }
コード例 #13
0
        /// <summary>
        /// Fired when the comment list is loading
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private async void CommentCollector_OnCollectorStateChange(object sender, OnCollectorStateChangeArgs e)
        {
            // Jump to the UI thread
            await global::Windows.ApplicationModel.Core.CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync(CoreDispatcherPriority.Low, () =>
            {
                // Kill anything we have
                ui_commentLoadingBar.IsIndeterminate = false;
                ui_commentLoadingBar.Visibility      = Visibility.Collapsed;
                ui_commentLoadingRing.IsActive       = false;
                ui_commentLoadingRing.Visibility     = Visibility.Collapsed;

                // Set the new loading
                if (e.State == CollectorState.Extending || e.State == CollectorState.Updating)
                {
                    if (m_commentList.Count == 0)
                    {
                        ui_commentLoadingRing.IsActive   = true;
                        ui_commentLoadingRing.Visibility = Visibility.Visible;
                    }
                    else
                    {
                        ui_commentLoadingBar.IsIndeterminate = true;
                        ui_commentLoadingBar.Visibility      = Visibility.Visible;
                    }
                }

                // Check for no comments
                if ((e.State == CollectorState.Idle || e.State == CollectorState.FullyExtended) && m_commentList.Count == 0 && e.NewPostCount == 0)
                {
                    ui_commentNoPostsText.Visibility = Visibility.Visible;
                    ui_commentList.Visibility        = Visibility.Collapsed;
                }
                else if (e.State == CollectorState.Idle || e.State == CollectorState.FullyExtended)
                {
                    ui_commentNoPostsText.Visibility = Visibility.Collapsed;
                    ui_commentList.Visibility        = Visibility.Visible;
                }
            });
        }
コード例 #14
0
 /// <summary>
 /// Fired when the collector state changed for the lock screen
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void Collector_OnCollectorStateChangeLockScreen(object sender, OnCollectorStateChangeArgs e)
 {
     Collector_OnCollectorStateChange(UpdateTypes.LockScreen, e);
 }
コード例 #15
0
 /// <summary>
 /// Fired when the collector state changes.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void Collector_OnCollectorStateChange(object sender, OnCollectorStateChangeArgs e)
 {
     if(e.State == CollectorState.Error)
     {
         // If we get an error we are done.
         ReleaseDeferal();
     }
 }
コード例 #16
0
 /// <summary>
 /// Fired when the collector state changed for the lock screen
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void Collector_OnCollectorStateChangeLockScreen(object sender, OnCollectorStateChangeArgs e)
 {
     Collector_OnCollectorStateChange(UpdateTypes.LockScreen, e);
 }
コード例 #17
0
ファイル: Search.xaml.cs プロジェクト: EricYan1/Baconit
 /// <summary>
 /// Fired when the collection state is changing
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private async void CurrentPostCollector_OnCollectorStateChange(object sender, OnCollectorStateChangeArgs e)
 {
     await Windows.ApplicationModel.Core.CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
     {
         if (e.State == CollectorState.Idle || e.State == CollectorState.Error)
         {
             HideProgressBar(SearchResultTypes.Post);
         }
         else
         {
             ShowProgressBar(SearchResultTypes.Post);
         }
     });
 }
コード例 #18
0
 /// <summary>
 /// Fired when the collector state changed for the lock screen
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void Collector_OnCollectorStateChangeDesktop(object sender, OnCollectorStateChangeArgs e)
 {
     Collector_OnCollectorStateChange(UpdateTypes.Desktop, e);
 }
コード例 #19
0
 /// <summary>
 /// Fired when the collector state changed for the band
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void Collector_OnCollectorStateChangeBand(object sender, OnCollectorStateChangeArgs e)
 {
     Collector_OnCollectorStateChange(UpdateTypes.Band, e);
 }
コード例 #20
0
        /// <summary>
        /// Fired when the collector state changed for the either
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Collector_OnCollectorStateChange(UpdateTypes type, OnCollectorStateChangeArgs e)
        {
            if(e.State == CollectorState.Error)
            {
                // We had an error. This is the end of the line, kill the deferral
                ReleaseDeferral(type);

                // And try to set isRunning
                UnSetIsRunningIfDone();
            }
        }
コード例 #21
0
        /// <summary>
        /// Fired when the comment list is loading
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private async void CommentCollector_OnCollectorStateChange(object sender, OnCollectorStateChangeArgs e)
        {
            // Jump to the UI thread
            await Windows.ApplicationModel.Core.CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync(CoreDispatcherPriority.Low, () =>
            {
                // Kill anything we have
                ui_commentLoadingBar.IsIndeterminate = false;
                ui_commentLoadingBar.Visibility = Visibility.Collapsed;
                ui_commentLoadingRing.IsActive = false;
                ui_commentLoadingRing.Visibility = Visibility.Collapsed;

                // Set the new loading
                if (e.State == CollectorState.Extending || e.State == CollectorState.Updating)
                {
                    if (m_commentList.Count == 0)
                    {
                        ui_commentLoadingRing.IsActive = true;
                        ui_commentLoadingRing.Visibility = Visibility.Visible;
                    }
                    else
                    {
                        ui_commentLoadingBar.IsIndeterminate = true;
                        ui_commentLoadingBar.Visibility = Visibility.Visible;
                    }
                }

                // Check for no comments
                if ((e.State == CollectorState.Idle || e.State == CollectorState.FullyExtended) && m_commentList.Count == 0 && e.NewPostCount == 0)
                {
                    ui_commentNoPostsText.Visibility = Visibility.Visible;
                    ui_commentList.Visibility = Visibility.Collapsed;
                }
                else if (e.State == CollectorState.Idle || e.State == CollectorState.FullyExtended)
                {
                    ui_commentNoPostsText.Visibility = Visibility.Collapsed;
                    ui_commentList.Visibility = Visibility.Visible;
                }
            });
        }
コード例 #22
0
 private async void CommentCollector_OnCollectorStateChange(object sender, OnCollectorStateChangeArgs e)
 {
     // #todo handle when there are no more
     if(e.State == CollectorState.Idle || e.State == CollectorState.FullyExtended)
     {
         // When we are idle hide the loading message.
         await Windows.ApplicationModel.Core.CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
         {
             // Check if we have any comments
             if(e.NewPostCount == 0 && m_post.Comments.Count == 0)
             {
                 m_post.ShowCommentLoadingMessage = Visibility.Visible;
                 m_post.ShowCommentsErrorMessage = "No Comments";
                 m_post.FlipViewShowLoadingMoreComments = false;
             }
             else
             {
                 m_post.ShowCommentLoadingMessage = Visibility.Collapsed;
                 m_post.FlipViewShowLoadingMoreComments = false;
             }
         });
     }
     else if(e.State == CollectorState.Error)
     {
         // Show an error message if we error
         await Windows.ApplicationModel.Core.CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
         {
             m_post.ShowCommentsErrorMessage = "Error Loading Comments";
             m_post.FlipViewShowLoadingMoreComments = false;
         });
     }
 }
コード例 #23
0
        /// <summary>
        /// Fired when the collector state is updated.
        /// </summary>
        /// <param name="state">The new state</param>
        private async void Collector_OnCollectorStateChange(object sender, OnCollectorStateChangeArgs args)
        {
            // Set loading if needed.
            ToggleLoadingBar(args.State == CollectorState.Updating || args.State == CollectorState.Extending);

            // Toggle the suppress depending on if we are updating, extending, or idle
            ui_postList.SuppressEndOfListEvent = args.State == CollectorState.Updating || args.State == CollectorState.Extending;

            // If we had an error show a message.
            if (m_isVisible && args.State == CollectorState.Error)
            {
                if(args.ErrorState == CollectorErrorState.ServiceDown)
                {
                    App.BaconMan.MessageMan.ShowRedditDownMessage();
                }
                else
                {
                    App.BaconMan.MessageMan.ShowMessageSimple("That's Not Right", "We can't update this subreddit right now, check your Internet connection.");
                }
            }

            // Show no posts if nothing was loaded
            if (args.State == CollectorState.Idle || args.State == CollectorState.FullyExtended)
            {
                bool postLoaded = m_collector.GetCurrentPosts().Count != 0;
                await Windows.ApplicationModel.Core.CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
                {
                    ui_noPostText.Visibility = postLoaded ? Visibility.Collapsed : Visibility.Visible;
                });
            }
        }
コード例 #24
0
 /// <summary>
 /// Fired when the collector state changed for the lock screen
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void Collector_OnCollectorStateChangeDesktop(object sender, OnCollectorStateChangeArgs e)
 {
     Collector_OnCollectorStateChange(UpdateTypes.Desktop, e);
 }
コード例 #25
0
 private async void CommentCollector_OnCollectorStateChange(object sender, OnCollectorStateChangeArgs e)
 {
     // #todo handle when there are no more
     if(e.State == CollectorState.Idle)
     {
         // When we are idle hide the loading message.
         await Windows.ApplicationModel.Core.CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
         {
             m_post.ShowCommentLoadingMessage = Visibility.Collapsed;
         });
     }
     else if(e.State == CollectorState.Error)
     {
         // Show an error message if we error
         await Windows.ApplicationModel.Core.CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
         {
             m_post.ShowCommentsErrorMessage = "Error Loading Comments";
         });
     }
 }
コード例 #26
0
 /// <summary>
 /// Fired when the collector state changed for the band
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void Collector_OnCollectorStateChangeBand(object sender, OnCollectorStateChangeArgs e)
 {
     Collector_OnCollectorStateChange(UpdateTypes.Band, e);
 }