/// <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; }); } }
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; }); } }
/// <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(); } }
/// <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>()); } }
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); }); }
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); }); }
/// <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>()); } }
/// <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(); } }
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(); } }); }
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(); } }); }
/// <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); } }); }
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"; }); } }
/// <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; } }); }
/// <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); }
/// <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(); } }
/// <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); }
/// <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); } }); }
/// <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); }
/// <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); }
/// <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(); } }
/// <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; } }); }
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; }); } }
/// <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; }); } }
/// <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); }
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"; }); } }
/// <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); }