public void NavigateFromPage() { // animations out INavigate navigatePage = (INavigate)((FlipViewItemEx)this.DeviceModeFlipView.SelectedItem).GetChildViewAsObject(); navigatePage.NavigateFromPage(); }
private void FlipViewEx_SelectionChanged(object sender, SelectionChangedEventArgs e) { // stop the page timer if (null != _pageMoveTimer) { _pageMoveTimer.Stop(); } // if we have a bottom nav bar if (null != this.BottomNavBar) { // get the sender if (sender is FlipViewEx flipView) { // navigate from the previous page if (null != _previousPage) { _previousPage.NavigateFromPage(); } // navigate to the new page if (null != flipView.SelectedItem) { INavigateMoveDirection moveDirection = INavigateMoveDirection.Unknown; // get the pageIndex of the new page int nextPageIndex = flipView.SelectedIndex; // find the index of the previous page int previousPageIndex = flipView.GetIndexOfChildView(_previousPage); // if we got it if (-1 != previousPageIndex) { // are we moving forward or backward to get to the new page? if (previousPageIndex < nextPageIndex) { moveDirection = INavigateMoveDirection.Forward; } else if (nextPageIndex < previousPageIndex) { moveDirection = INavigateMoveDirection.Backward; } } // save the current page so we can navigate away from it later _previousPage = (INavigate)((FlipViewItemEx)flipView.SelectedItem).GetChildViewAsObject(); // navigate to it _previousPage.NavigateToPage(moveDirection); // tell the navbar to move to it this.BottomNavBar.MoveToPageIndex(nextPageIndex, (INavigateMoveDirection.Forward == moveDirection)); } } } }
private void ContentFlipView_SelectionChanged(object sender, SelectionChangedEventArgs e) { if (null != this.ContentFlipView) { // navigate from the previous page if (null != _previousPage) { _previousPage.NavigateFromPage(); } // save the current page so we can navigate away from it later _previousPage = GetCurrentlySelectedChildPage(); // navigate to it if (null != _previousPage) { _previousPage.NavigateToPage(); } // based on the current page, set the scheme to light or dark switch (this.ContentFlipView.SelectedIndex) { case 0: // audio page this.ColorScheme = ColorSchemes.Light; if ((null != this.LeftChevronLight) && (null != LeftChevronDark) && (null != RightChevronLight) && (null != RightChevronDark)) { // hide the left arrow this.LeftChevronLight.Visibility = Visibility.Collapsed; this.LeftChevronDark.Visibility = Visibility.Collapsed; // show the right arrow dark this.RightChevronLight.Visibility = Visibility.Collapsed; this.RightChevronDark.Visibility = Visibility.Visible; } break; case 1: // features page this.ColorScheme = ColorSchemes.Dark; // show the left arrow light if ((null != this.LeftChevronLight) && (null != LeftChevronDark) && (null != RightChevronLight) && (null != RightChevronDark)) { this.LeftChevronLight.Visibility = Visibility.Visible; this.LeftChevronDark.Visibility = Visibility.Collapsed; // show the right arrow dark this.RightChevronLight.Visibility = Visibility.Collapsed; this.RightChevronDark.Visibility = Visibility.Visible; } break; case 2: // speeds and feeds page this.ColorScheme = ColorSchemes.Light; if ((null != this.LeftChevronLight) && (null != LeftChevronDark) && (null != RightChevronLight) && (null != RightChevronDark)) { // show the left arrow dark this.LeftChevronLight.Visibility = Visibility.Collapsed; this.LeftChevronDark.Visibility = Visibility.Visible; // hide the right arrow this.RightChevronLight.Visibility = Visibility.Collapsed; this.RightChevronDark.Visibility = Visibility.Collapsed; } break; } // update play button // - play button has no color changes any longer // update navigation buttons if (null != this.NavigationBarExploreWindows) { this.NavigationBarExploreWindows.ColorScheme = this.ColorScheme; } if (null != this.NavigationBarGoToDesktop) { this.NavigationBarGoToDesktop.ColorScheme = this.ColorScheme; } } }
private void FlipViewEx_SelectionChanged(object sender, SelectionChangedEventArgs e) { // if the count of e.AddedItems == 1, then the SelectedIndex has actually // changed. if it's equal to 3 (the number of panels loaded in a VirtualizingStackPanel), // then this isn't a real change in the SelectedIndex, and we'll ignore it. if (3 != e.AddedItems.Count) { // stop the page timer if (null != _pageMoveTimer) { _pageMoveTimer.Stop(); } } // if we have a bottom nav bar if (null != this.BottomNavBar) { // get the sender if (sender is FlipViewEx flipView) { // navigate from the previous page if (null != _previousPage) { _previousPage.NavigateFromPage(); } // navigate to the new page if (null != flipView.SelectedItem) { INavigateMoveDirection moveDirection = INavigateMoveDirection.Unknown; // get the pageIndex of the new page int nextPageIndex = flipView.SelectedIndex; // find the index of the previous page int previousPageIndex = flipView.GetIndexOfChildView(_previousPage); // if we got it if (-1 != previousPageIndex) { // are we moving forward or backward to get to the new page? if (previousPageIndex < nextPageIndex) { moveDirection = INavigateMoveDirection.Forward; } else if (nextPageIndex < previousPageIndex) { moveDirection = INavigateMoveDirection.Backward; } } // save the current page so we can navigate away from it later _previousPage = (INavigate)((FlipViewItemEx)flipView.SelectedItem).GetChildViewAsObject(); // navigate to it _previousPage.NavigateToPage(moveDirection); // tell the navbar to move to it this.BottomNavBar.MoveToPageIndex(nextPageIndex, (INavigateMoveDirection.Forward == moveDirection)); // telemetry - log section views if (nextPageIndex < PAGE_ACCESSORIES) { TelemetryService.Current?.LogTelemetryEvent(TelemetryEvents.ViewExperience); } else if (nextPageIndex < PAGE_BESTOF) { TelemetryService.Current?.LogTelemetryEvent(TelemetryEvents.ViewAccessories); } else if (nextPageIndex < PAGE_COMPARE) { TelemetryService.Current?.LogTelemetryEvent(TelemetryEvents.ViewBestOf); } else { TelemetryService.Current?.LogTelemetryEvent(TelemetryEvents.ViewComparison); } } } } }
private void DeviceModeFlipView_SelectionChanged(object sender, SelectionChangedEventArgs e) { if ((null != this.DeviceModeFlipView) && (null != this.DeviceModeSlider)) { // navigate from the previous page if (null != _previousPage) { _previousPage.NavigateFromPage(); } // navigate to the current page if (null != this.DeviceModeFlipView.SelectedItem) { INavigateMoveDirection moveDirection = INavigateMoveDirection.Unknown; // get the pageIndex of the new page int nextPageIndex = this.DeviceModeFlipView.SelectedIndex; // find the index of the previous page int previousPageIndex = this.DeviceModeFlipView.Items.IndexOf(_previousPage); // if we got it if (-1 != previousPageIndex) { // are we moving forward or backward? if (previousPageIndex < nextPageIndex) { moveDirection = INavigateMoveDirection.Forward; } else if (nextPageIndex < previousPageIndex) { moveDirection = INavigateMoveDirection.Backward; } } // save the current page so we can navigate from it _previousPage = (INavigate)((FlipViewItemEx)this.DeviceModeFlipView.SelectedItem).GetChildViewAsObject(); // navigate to it _previousPage.NavigateToPage(moveDirection); // telemetry TelemetryService.Current?.LogTelemetryEvent(TelemetryEvents.ViewExperience); } // update slider switch (this.DeviceModeFlipView.SelectedIndex) { case 0: // to avoid infinite event loops, only update if it's not already set to the new value if (DeviceModeSliderSnapPositions.Studio != this.DeviceModeSlider.Position) { this.DeviceModeSlider.SnapTo(DeviceModeSliderSnapPositions.Studio); } break; case 1: // to avoid infinite event loops, only update if it's not already set to the new value if (DeviceModeSliderSnapPositions.Laptop != this.DeviceModeSlider.Position) { this.DeviceModeSlider.SnapTo(DeviceModeSliderSnapPositions.Laptop); } break; case 2: // to avoid infinite event loops, only update if it's not already set to the new value if (DeviceModeSliderSnapPositions.Tablet != this.DeviceModeSlider.Position) { this.DeviceModeSlider.SnapTo(DeviceModeSliderSnapPositions.Tablet); } break; } this.RaiseSelectionChangedEvent(this); } }