File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1- namespace HttpGamepadInput ;
1+ using System . Diagnostics ;
2+
3+ namespace HttpGamepadInput ;
24
35public partial class App : Application
46{
57 public App ( )
68 {
79 InitializeComponent ( ) ;
10+
11+ AppDomain . CurrentDomain . UnhandledException += OnUnhandledException ;
12+ TaskScheduler . UnobservedTaskException += OnUnobservedTaskException ;
13+
814 }
915
1016 protected override Window CreateWindow ( IActivationState ? activationState )
1117 {
1218 return new Window ( new AppShell ( ) ) ;
1319 }
20+
21+ private void OnUnhandledException ( object sender , UnhandledExceptionEventArgs e )
22+ {
23+ Exception ? ex = e . ExceptionObject as Exception ;
24+ Debug . WriteLine ( $ "[UNHANDLED] { ex ? . Message } ") ;
25+ MainThread . BeginInvokeOnMainThread ( async ( ) =>
26+ {
27+ await Application . Current ? . MainPage ? . DisplayAlert ( "Error" , $ "[UNHANDLED] { ex ? . Message } ", "OK" ) ;
28+ } ) ;
29+ }
30+
31+ private void OnUnobservedTaskException ( object sender , UnobservedTaskExceptionEventArgs e )
32+ {
33+ Debug . WriteLine ( $ "[TASK ERROR] { e . Exception . Message } ") ;
34+ e . SetObserved ( ) ;
35+ MainThread . BeginInvokeOnMainThread ( async ( ) =>
36+ {
37+ await Application . Current ? . MainPage ? . DisplayAlert ( "Task error" , $ "[TASK ERROR] { e . Exception . Message } ", "OK" ) ;
38+ } ) ;
39+ }
1440}
Original file line number Diff line number Diff line change 99
1010 <FlyoutItem Title =" Gamepads" >
1111 <ShellContent ContentTemplate =" {DataTemplate views:MainPage}"
12- Title =" 1 Gamepad"
12+ Title =" HTTP Gamepad"
1313 Route =" MainPage" />
1414 </FlyoutItem >
1515 <FlyoutItem Title =" Settings" >
You can’t perform that action at this time.
0 commit comments