/// <summary> /// Fired when a post is tapped /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void PostList_SelectionChanged(object sender, SelectionChangedEventArgs e) { if (ui_postList.SelectedIndex == -1) { return; } // Get the post var tappedPost = (Post)ui_postList.SelectedItem; // Navigate to the post var args = new Dictionary <string, object>(); args.Add(PanelManager.NavArgsSubredditName, tappedPost.Subreddit); args.Add(PanelManager.NavArgsForcePostId, tappedPost.Id); // Make sure the page id is unique _mHost.Navigate(typeof(FlipViewPanel), tappedPost.Subreddit + SortTypes.Hot + SortTimeTypes.Week + tappedPost.Id, args); // Color the title so the user knows they read this. tappedPost.TitleTextColor = Color.FromArgb(255, 152, 152, 152); // Reset the selected index ui_postList.SelectedIndex = -1; TelemetryManager.ReportEvent(this, "UserProfilePostOpened"); }
private void SettingsList_SelectionChanged(object sender, SelectionChangedEventArgs e) { switch (ui_settingsList.SelectedIndex) { case 0: m_host.Navigate(typeof(SubredditViewSettings), "SubredditViewSettings"); break; case 1: m_host.Navigate(typeof(FlipViewSettings), "FlipViewSettings"); break; case 2: m_host.Navigate(typeof(BackgroundUpdatingSettings), "BackgroundUpdatingSettings"); break; case 3: m_host.Navigate(typeof(AboutSettings), "AboutSettings"); break; case 4: App.BaconMan.ShowGlobalContent("http://baconit.quinndamerell.com/privacy.html"); break; default: break; } ui_settingsList.SelectedIndex = -1; }
/// <summary> /// Fired when a post is tapped /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void PostList_SelectionChanged(object sender, SelectionChangedEventArgs e) { if (ui_postList.SelectedIndex == -1) { return; } // Get the post Post tappedPost = (Post)ui_postList.SelectedItem; // Navigate to the post Dictionary <string, object> args = new Dictionary <string, object>(); args.Add(PanelManager.NAV_ARGS_SUBREDDIT_NAME, tappedPost.Subreddit); args.Add(PanelManager.NAV_ARGS_FORCE_POST_ID, tappedPost.Id); // Make sure the page id is unique m_host.Navigate(typeof(FlipViewPanel), tappedPost.Subreddit + SortTypes.Hot + SortTimeTypes.Week + tappedPost.Id, args); // Color the title so the user knows they read this. tappedPost.TitleTextColor = Color.FromArgb(255, 152, 152, 152); // Reset the selected index ui_postList.SelectedIndex = -1; App.BaconMan.TelemetryMan.ReportEvent(this, "UserProfilePostOpened"); }
/// <summary> /// Fired when the user taps search. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void SearchSubreddit_Click(object sender, RoutedEventArgs e) { Dictionary <string, object> args = new Dictionary <string, object>(); // If this is an artificial subreddit make the name "" so we just search all posts. string displayName = m_currentSubreddit.IsArtifical ? "" : m_currentSubreddit.DisplayName; args.Add(PanelManager.NAV_ARGS_SEARCH_SUBREDDIT_NAME, displayName); m_host.Navigate(typeof(Search), "Search", args); FireShouldClose(); }
private void NavigateToFlipView(Post post) { // Send the subreddit and post to flipview Dictionary <string, object> args = new Dictionary <string, object>(); args.Add(PanelManager.NAV_ARGS_SUBREDDIT_NAME, m_subreddit.DisplayName); args.Add(PanelManager.NAV_ARGS_SUBREDDIT_SORT, m_currentSortType); args.Add(PanelManager.NAV_ARGS_POST_ID, post.Id); m_host.Navigate(typeof(FlipViewPanel), m_subreddit.DisplayName + m_currentSortType, args); }
/// <summary> /// Fired when a search result is tapped /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void SearchResults_SelectionChanged(object sender, SelectionChangedEventArgs e) { // Grab the result var tappedResult = (SearchResult)ui_searchResults.SelectedItem; if (tappedResult != null) { if (tappedResult.ResultType == SearchResultTypes.ShowMore) { var context = ((string)tappedResult.DataContext); if (context.Equals(CSubredditShowMoreHeader)) { DoFilteredSearch(SearchResultTypes.Subreddit); } else if (context.Equals(CPostShowMoreHeader)) { DoFilteredSearch(SearchResultTypes.Post); } } else if (tappedResult.ResultType == SearchResultTypes.Subreddit) { var subreddit = (Subreddit)tappedResult.DataContext; // If is very important to not send in a upper case display name subreddit.DisplayName = subreddit.DisplayName.ToLower(); // Navigate to the subreddit var args = new Dictionary <string, object>(); // Send the display name. args.Add(PanelManager.NavArgsSubredditName, subreddit.DisplayName); _mPanelManager.Navigate(typeof(SubredditPanel), subreddit.DisplayName + SortTypes.Hot + SortTimeTypes.Week, args); } else if (tappedResult.ResultType == SearchResultTypes.Post) { var post = (Post)tappedResult.DataContext; // Navigate to the post var args = new Dictionary <string, object>(); args.Add(PanelManager.NavArgsSubredditName, post.Subreddit); args.Add(PanelManager.NavArgsForcePostId, post.Id); // Make sure the page id is unique _mPanelManager.Navigate(typeof(FlipViewPanel), post.Subreddit + SortTypes.Hot + SortTimeTypes.Week + post.Id, args); } else if (tappedResult.ResultType == SearchResultTypes.User) { var user = (User)tappedResult.DataContext; // Navigate to the user var args = new Dictionary <string, object>(); args.Add(PanelManager.NavArgsUserName, user.Name); _mPanelManager.Navigate(typeof(UserProfile), user.Name, args); } } // Reset the list ui_searchResults.SelectedIndex = -1; }
/// <summary> /// Fired when a search result is tapped /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void SearchResults_SelectionChanged(object sender, SelectionChangedEventArgs e) { // Grab the result SearchResult tappedResult = (SearchResult)ui_searchResults.SelectedItem; if (tappedResult != null) { if (tappedResult.ResultType == SearchResultTypes.ShowMore) { string context = ((string)tappedResult.DataContext); if (context.Equals(c_subredditShowMoreHeader)) { DoFilteredSearch(SearchResultTypes.Subreddit); } else if (context.Equals(c_postShowMoreHeader)) { DoFilteredSearch(SearchResultTypes.Post); } } else if (tappedResult.ResultType == SearchResultTypes.Subreddit) { Subreddit subreddit = (Subreddit)tappedResult.DataContext; // If is very important to not send in a upper case display name subreddit.DisplayName = subreddit.DisplayName.ToLower(); // Navigate to the subreddit Dictionary <string, object> args = new Dictionary <string, object>(); // Send the display name. args.Add(PanelManager.NAV_ARGS_SUBREDDIT_NAME, subreddit.DisplayName); m_panelManager.Navigate(typeof(SubredditPanel), subreddit.DisplayName + SortTypes.Hot + SortTimeTypes.Week, args); } else if (tappedResult.ResultType == SearchResultTypes.Post) { Post post = (Post)tappedResult.DataContext; // Navigate to the post Dictionary <string, object> args = new Dictionary <string, object>(); args.Add(PanelManager.NAV_ARGS_SUBREDDIT_NAME, post.Subreddit); args.Add(PanelManager.NAV_ARGS_FORCE_POST_ID, post.Id); // Make sure the page id is unique m_panelManager.Navigate(typeof(FlipViewPanel), post.Subreddit + SortTypes.Hot + SortTimeTypes.Week + post.Id, args); } else if (tappedResult.ResultType == SearchResultTypes.User) { User user = (User)tappedResult.DataContext; // Navigate to the user Dictionary <string, object> args = new Dictionary <string, object>(); args.Add(PanelManager.NAV_ARGS_USER_NAME, user.Name); m_panelManager.Navigate(typeof(UserProfile), user.Name, args); } } // Reset the list ui_searchResults.SelectedIndex = -1; }
private void NavigateToFlipView(Post post) { // Send the subreddit and post to flipview var args = new Dictionary <string, object> { { PanelManager.NavArgsSubredditName, _subreddit.DisplayName }, { PanelManager.NavArgsSubredditSort, _currentSortType }, { PanelManager.NavArgsSubredditSortTime, _currentSortTimeType }, { PanelManager.NavArgsPostId, post.Id } }; _host.Navigate(typeof(FlipViewPanel), _subreddit.DisplayName + _currentSortType + _currentSortTimeType, args); }
/// <summary> /// Fired when a user taps view context. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void ViewContext_OnButtonTapped(object sender, EventArgs e) { // Get the message Message message = (Message)((FrameworkElement)sender).DataContext; // We need to get all of the parts of this message we need to send to flip view // The comment replies only have the post id in the "context" so use that for both. string postId = null; try { string context = message.Context; int contextIndex = context.IndexOf('/'); int slashSeenCount = 0; while (contextIndex != -1) { slashSeenCount++; // Iterate one past the / contextIndex++; if (slashSeenCount == 4) { // After 4 slashes we should have the post id int nextSlash = context.IndexOf('/', contextIndex); postId = context.Substring(contextIndex, nextSlash - contextIndex); break; } contextIndex = context.IndexOf('/', contextIndex); } if (String.IsNullOrEmpty(postId)) { throw new Exception("post id was empty"); } } catch (Exception ex) { App.BaconMan.MessageMan.DebugDia("failed to parse message context", ex); App.BaconMan.MessageMan.ShowMessageSimple("Oops", "Something is wrong and we can't show this context right now."); return; } // Navigate flip view and force it to the post and comment. Dictionary <string, object> args = new Dictionary <string, object>(); args.Add(PanelManager.NAV_ARGS_SUBREDDIT_NAME, message.Subreddit); args.Add(PanelManager.NAV_ARGS_FORCE_POST_ID, postId); args.Add(PanelManager.NAV_ARGS_FORCE_COMMENT_ID, message.Id); // Make sure the page Id is unique m_panelHost.Navigate(typeof(FlipViewPanel), message.Subreddit + SortTypes.Hot + SortTimeTypes.Week + postId + message.Id, args); // Also if it is unread set it to read if (message.IsNew) { MarkAsRead_Tapped(sender, e); } }
private void Logo_Tapped(object sender, TappedRoutedEventArgs e) { // Start the snow ui_letItSnow.MakeItSnow(); // Navigate to developer settings m_host.Navigate(typeof(DeveloperSettings), "DeveloperSettings"); }
private void SettingsList_SelectionChanged(object sender, SelectionChangedEventArgs e) { switch (ui_settingsList.SelectedIndex) { case 0: _mHost.Navigate(typeof(ApplicationSettings), "ApplicationSettings"); break; case 1: _mHost.Navigate(typeof(FlipViewSettings), "FlipViewSettings"); break; case 2: _mHost.Navigate(typeof(SubredditViewSettings), "SubredditViewSettings"); break; case 3: _mHost.Navigate(typeof(CommentSettings), "CommentsSettings"); break; case 4: _mHost.Navigate(typeof(MicrosoftBandSettings), "MicrosoftBandSettings"); break; case 5: _mHost.Navigate(typeof(BackgroundMessageUpdatingSettings), "BackgroundMessageUpdating"); break; case 6: _mHost.Navigate(typeof(BackgroundUpdatingSettings), "BackgroundUpdatingSettings"); break; case 7: case 8: App.BaconMan.ShowGlobalContent("http://baconit.quinndamerell.com/privacy.html"); break; case 9: _mHost.Navigate(typeof(AboutSettings), "AboutSettings"); break; default: break; } ui_settingsList.SelectedIndex = -1; }
private void SettingsList_SelectionChanged(object sender, SelectionChangedEventArgs e) { switch (ui_settingsList.SelectedIndex) { case 0: m_host.Navigate(typeof(FlipViewSettings), "FlipViewSettings"); break; case 1: m_host.Navigate(typeof(SubredditViewSettings), "SubredditViewSettings"); break; case 2: m_host.Navigate(typeof(CommentSettings), "CommentsSettings"); break; case 3: //m_host.Navigate(typeof(MicrosoftBandSettings), "MicrosoftBandSettings"); break; case 4: m_host.Navigate(typeof(BackgroundMessageUpdatingSettings), "BackgroundMessageUpdating"); break; case 5: m_host.Navigate(typeof(BackgroundUpdatingSettings), "BackgroundUpdatingSettings"); break; case 6: case 7: App.BaconMan.ShowGlobalContent("https://aaron85176.wixsite.com/pancettaprivacy"); break; case 8: m_host.Navigate(typeof(AboutSettings), "AboutSettings"); break; default: break; } ui_settingsList.SelectedIndex = -1; }
private void Logo_Tapped(object sender, TappedRoutedEventArgs e) { m_host.Navigate(typeof(DeveloperSettings), "DeveloperSettings"); }