public override void OnSwipeCompleted(double deltaX, double cummulatedX) { Pici.Log.info(typeof(OpenBookSwipeBehaviour), "Swipe Completed"); double completeProgress = 0; if (cummulatedX < -50 && Math.Sign(deltaX) == -1) { completeProgress = -1; } if (cummulatedX > 50 && Math.Sign(deltaX) == 1) { completeProgress = 1; } if (SwipeBehaviour.Direction == Direction.Right) { completeProgress = 1; } if (SwipeBehaviour.Direction == Direction.Left) { completeProgress = -1; } if (BookSwipeTransition.SwipeMode == SwipeMode.Shelf) { //check if there is another shelf to go to if (HBS.ViewModel.ShelfViewModel.SelectedIndex < 0 || HBS.ViewModel.ShelfViewModel.SelectedIndex > HBS.Search.Callback.MaxPageIndex) { completeProgress = 0; } //check if there is a next valid book in shelf if (BookSwipeTransition.NextBookIndex > 0 && BookSwipeTransition.NextBookIndex < Bookshelf.Books3D.Items.Count && Bookshelf.Books3D.Items.ElementAt(BookSwipeTransition.NextBookIndex).Model == null) { completeProgress = 0; } } var ani = Transition.Animate(BookSwipeTransition, completeProgress, HBS.AnimationSeconds * 0.75, HBS.AnimationEaseOut); ani.Complete += (s, e) => { if (completeProgress == 0) { BookSwipeTransition.Direction = Direction.Center; } else { HBS.ViewModel.Opened.BookVM.DropShadowOpacity = 0; } }; }
public void HandleIntent(Intent intent) { if (HBS.ViewModel.Opened.BookVM.Book == null && !HBS.IsAnimating) { var Book3D = intent.GetExtra <Book3DViewModel>("book3D"); var book = HBS.CreateBook(Book3D); Transition.Animate(new OpenBookTransition(Book3D, book), 1, HBS.AnimationSeconds, HBS.AnimationEaseInOut); } }
public void HandleIntent(Intent intent) { var book3D = HBS.ViewModel.Opened.BookVM.Book3D; var book = HBS.ViewModel.Opened.BookVM.Book; if (book3D != null && book != null && !HBS.IsAnimating) { Transition.Animate(new CloseBookTransition(book3D, book), 1, HBS.AnimationSeconds, HBS.AnimationEaseInOut); } }