protected async override void OnNavigatedTo(NavigationEventArgs e) { base.OnNavigatedTo(e); type = (NotificationPageType)e.Parameter; switch (type) { case NotificationPageType.Comment: FindName(nameof(NavigateItems)); uri = "list"; Load <SimpleNotificationViewModel>(); break; case NotificationPageType.AtMe: setPageStyle("@我的动态"); Load(); break; case NotificationPageType.AtCommentMe: setPageStyle("@我的评论"); uri = "atCommentMeList"; Load <AtCommentMeNotificationViewModel>(); break; case NotificationPageType.Like: setPageStyle("我收到的赞"); uri = "feedLikeList"; Load <LikeNotificationViewModel>(); break; case NotificationPageType.Follow: setPageStyle("好友关注"); uri = "contactsFollowList"; Load <SimpleNotificationViewModel>(); break; } void setPageStyle(string t) { MainListView.Padding = Settings.stackPanelMargin; FindName(nameof(titleBar)); titleBar.Title = t; } await System.Threading.Tasks.Task.Delay(2000); (VisualTree.FindDescendantByName(MainListView, "ScrollViewer") as ScrollViewer).ViewChanged += (s, ee) => { ScrollViewer scrollViewer = s as ScrollViewer; if (!ee.IsIntermediate) { double a = scrollViewer.VerticalOffset; if (a == scrollViewer.ScrollableHeight) { switch (type) { case NotificationPageType.Comment: Load <SimpleNotificationViewModel>(); break; case NotificationPageType.AtMe: Load(); break; case NotificationPageType.AtCommentMe: Load <AtCommentMeNotificationViewModel>(); break; case NotificationPageType.Like: Load <LikeNotificationViewModel>(); break; case NotificationPageType.Follow: Load <SimpleNotificationViewModel>(); break; } } } }; }
protected async override void OnNavigatedTo(NavigationEventArgs e) { base.OnNavigatedTo(e); type = (NotificationPageType)e.Parameter; switch (type) { case NotificationPageType.Comment: titleBar.Title = ("通知"); uri = "list"; FindName(nameof(NavigateItems)); Load <SimpleNotificationModel>(); break; case NotificationPageType.AtMe: titleBar.Title = ("@我的动态"); uri = "atMeList"; MainListView.Padding = (Thickness)Windows.UI.Xaml.Application.Current.Resources["StackPanelMargin"]; Load(); break; case NotificationPageType.AtCommentMe: titleBar.Title = ("@我的评论"); uri = "atCommentMeList"; MainListView.Padding = (Thickness)Windows.UI.Xaml.Application.Current.Resources["StackPanelMargin"]; Load <AtCommentMeNotificationModel>(); break; case NotificationPageType.Like: titleBar.Title = ("我收到的赞"); uri = "feedLikeList"; MainListView.Padding = (Thickness)Windows.UI.Xaml.Application.Current.Resources["StackPanelMargin"]; Load <LikeNotificationModel>(); break; case NotificationPageType.Follow: titleBar.Title = ("好友关注"); uri = "contactsFollowList"; MainListView.Padding = (Thickness)Windows.UI.Xaml.Application.Current.Resources["StackPanelMargin"]; Load <SimpleNotificationModel>(); break; } await System.Threading.Tasks.Task.Delay(2000); (VisualTree.FindDescendantByName(MainListView, "ScrollViewer") as ScrollViewer).ViewChanged += (s, ee) => { ScrollViewer scrollViewer = s as ScrollViewer; if (!ee.IsIntermediate) { double a = scrollViewer.VerticalOffset; if (a == scrollViewer.ScrollableHeight) { switch (type) { case NotificationPageType.Comment: Load <SimpleNotificationModel>(); break; case NotificationPageType.AtMe: Load(); break; case NotificationPageType.AtCommentMe: Load <AtCommentMeNotificationModel>(); break; case NotificationPageType.Like: Load <LikeNotificationModel>(); break; case NotificationPageType.Follow: Load <SimpleNotificationModel>(); break; } } } }; }