private void GestureListener_Hold(object sender, Microsoft.Phone.Controls.GestureEventArgs e) { ArrivalAndDeparture a = (ArrivalAndDeparture)(((FrameworkElement)sender).DataContext); MessageBoxResult r = MessageBox.Show("Notify me when this bus is 5 minutes away?", "Notify me?", MessageBoxButton.OKCancel); if (r == MessageBoxResult.OK) { this.viewModel.SubscribeToToastNotification(a.stopId, a.tripId, 5); } }
/// <summary> /// 手势开始 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void GestureListener_GestureBegin(object sender, Microsoft.Phone.Controls.GestureEventArgs e) { while (TouchPanel.IsGestureAvailable) { GestureSample gs = TouchPanel.ReadGesture(); if (gs.GestureType == GestureType.VerticalDrag) { isVerticalDrag = true; } } }
/// <summary> /// 手势结束 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void GestureListener_GestureCompleted(object sender, Microsoft.Phone.Controls.GestureEventArgs e) { if (isVerticalDrag || AppSetting.HightDragSensitivity) { var scrollviewer = AppSetting.FindChildOfType <ScrollViewer>(TweetListBox); if (scrollviewer == null) { return; } //到底部 if (Math.Abs(scrollviewer.VerticalOffset - scrollviewer.ScrollableHeight) < 2) { GetNextPage(); } ////顶部 //else if (scrollviewer.VerticalOffset < 0.000001) //{ // GetLastest(); //} } }
private void TweetSelected(GestureEventArgs e) { var elem = (FrameworkElement)e.OriginalSource; var vm = elem.DataContext as TweetItemViewModel; if (null == vm) return; _navigationService.NavigateTo(Uris.Tweet(vm)); }