private void DeviceGestureService_GoBackRequested(object sender, DeviceGestureEventArgs e) { // FIXME: VisualStateGroupの状態を取得する良い方法が見つからないため、ViewModelで値を取得している var view = Windows.UI.ViewManagement.UIViewSettings.GetForCurrentView(); if (view.UserInteractionMode == Windows.UI.ViewManagement.UserInteractionMode.Mouse) { // PCもしくはContinuumの場合、アプリを終了する e.Handled = false; e.Cancel = false; } else { // 電話で、アイテムが選択されている画面の場合、リスト画面へと戻る if (this.IsItemsListSelected) { this.SelectedIndex = -1; e.Handled = true; e.Cancel = true; } else { e.Handled = false; e.Cancel = false; } } }
/// <summary> /// /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void OnGoForwardRequested(object sender, DeviceGestureEventArgs e) { if (NavigationService.CanGoForward()) { NavigationService.GoForward(); e.Handled = true; } }
/// <summary> /// /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected virtual void OnHardwareButtonsBackPressed(object sender, BackPressedEventArgs e) { DeviceGestureEventArgs args = new DeviceGestureEventArgs(false, true); RaiseCancelableEvent <DeviceGestureEventArgs>(GoBackRequested, this, args); e.Handled = args.Handled; }
/// <summary> /// /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected virtual void OnSystemNavigationManagerBackRequested(object sender, BackRequestedEventArgs e) { DeviceGestureEventArgs args = new DeviceGestureEventArgs(); RaiseCancelableEvent <DeviceGestureEventArgs>(GoBackRequested, this, args); e.Handled = args.Handled; }
protected virtual void OnGoBackRequested(object sender, DeviceGestureEventArgs e) { if (!e.Handled) { if (NavigationService.CanGoBack()) { NavigationService.GoBack(); e.Handled = true; } } }
/// <summary> /// /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void OnGoBackRequested(object sender, DeviceGestureEventArgs e) { if (NavigationService.CanGoBack()) { NavigationService.GoBack(); e.Handled = true; } else if (DeviceGestureService.IsHardwareBackButtonPresent && e.IsHardwareButton) { Exit(); } }
private void DeviceGestureServiceOnGoBackRequested(object sender, DeviceGestureEventArgs e) { var appShell = (AppShell)Window.Current.Content; var contentFrame = (Frame)appShell.GetContentFrame(); var page = (SessionStateAwarePage)contentFrame.Content; var revertable = page?.DataContext as IRevertState; if (revertable == null || !revertable.CanRevertState()) { return; } e.Handled = true; e.Cancel = true; revertable.RevertState(); }
private void DeviceGestureService_GoBackRequested(object sender, DeviceGestureEventArgs e) { Debug.WriteLine(nameof(this.DeviceGestureService_GoBackRequested)); e.Handled = true; e.Cancel = true; }
private void DeviceGestureService_CameraButtonPressed(object sender, DeviceGestureEventArgs e) { Debug.WriteLine(nameof(this.DeviceGestureService_CameraButtonPressed)); }