모바일하지만 오류가 제대로 작동(UWP) 하드웨어 돌아 가기를 눌러 내 UWP 응용 프로그램에서 PC
private async void HardwareButtons_BackPressed(object sender, BackPressedEventArgs e)
{
e.Handled = true;
Frame rootFrame = Window.Current.Content as Frame;
if (rootFrame.CanGoBack && rootFrame != null)
{
rootFrame.GoBack();
}
else
{
var msg = new MessageDialog("Confirm Close! \nOr Press Refresh Button to Go Back");
var okBtn = new UICommand("OK");
var cancelBtn = new UICommand("Cancel");
msg.Commands.Add(okBtn);
msg.Commands.Add(cancelBtn);
IUICommand result = await msg.ShowAsync();
if (result != null && result.Label == "OK")
{
Application.Current.Exit();
}
}
}
및 내가 전화에 응용 프로그램을 디버깅 할 때이 모든 코드를 완료 한 후
public App()
{
this.InitializeComponent();
this.Suspending += OnSuspending;
/* Because of this line my app work on mobile great but when
when i debug on pc it through exception "show in image" */
HardwareButtons.BackPressed += HardwareButtons_BackPressed;
}
, 응용 프로그램은 성공적으로 실행 - 모바일 Debuging을 :
그러나 같은 코드를 PC에 디버그,이 오류 - PC의 Debuging 올라올 때 : i가 작동하지 않는 버튼을 다시 돌아 debuging 해결 PC의 디버깅하지만 모바일에서 다음 문제를 HardwareButtons.BackPressed += HardwareButtons_BackPressed;
을 제거 할 때
합니다.
'SystemNavigationManager.GetForCurrentView()를 시도해 볼 수 있습니까? BackRequested + = OnBackRequested; SystemNavigationManager.GetForCurrentView(). AppViewBackButtonVisibility = AppViewBackButtonVisibility입니다."HardwareButtons.BackPressed"대신 Visible;' – Developer
내 문제는 여전히 동일합니다. 모바일과 PC 모두에서 다시 예외가 발생합니다. https://1drv.ms/이 있으면 내 app.xaml.cs 파일에 대한 링크입니다. u/s! Ahppl6XCmlXfj_VUrekI819VqZLG-Q –