private void NavegateExecute(object index) { int idx; int.TryParse(index + "", out idx); if (idx < 0 || idx == _lastIndex || Pages == null || idx > Pages.Count) { return; } if (Viewer == null) { return; } ActivedPage = Pages[idx]; AnimaterPage = Pages[_lastIndex]; if (_lastIndex < idx) { Viewer.BeginStoryboard((Storyboard)Resources["SlideLeftToRight"]); } else { Viewer.BeginStoryboard((Storyboard)Resources["SlideRightToLeft"]); } _lastIndex = idx; //release the AnimaterPage Task.Run(async() => await Task.Delay(600)).ContinueWith(s => { AnimaterPage = null; }, TaskScheduler.FromCurrentSynchronizationContext()); }
private void PointerOnSelectionChanged(object sender, SelectionChangedEventArgs e) { if (Viewer == null) { return; } AnimaterPage = CarouselPages[_lastIndex]; if (_lastIndex < Pointer.SelectedIndex) { Viewer.BeginStoryboard((Storyboard)Resources["SlideLeftToRight"]); } else { Viewer.BeginStoryboard((Storyboard)Resources["SlideRightToLeft"]); } _lastIndex = Pointer.SelectedIndex; }