-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAppShell.xaml.cs
More file actions
38 lines (33 loc) · 988 Bytes
/
AppShell.xaml.cs
File metadata and controls
38 lines (33 loc) · 988 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
using System;
using System.Diagnostics;
namespace yTorqueChecker
{
public partial class AppShell : Shell
{
public AppShell()
{
InitializeComponent();
}
protected override void OnAppearing()
{
base.OnAppearing();
string errmsg = "";
int res = YAPI.RegisterHub("usb", ref errmsg);
if (res != YAPI.SUCCESS) {
string error = "Unable to registerHub(usb) : " + errmsg;
Debug.WriteLine(error);
MainThread.BeginInvokeOnMainThread(async () =>
{
await Task.Delay(1000);
await Shell.Current.DisplayAlert("Error", error, "Quit");
Application.Current.Quit();
});
}
}
protected override void OnDisappearing()
{
base.OnDisappearing();
YAPI.UnregisterHub("usb");
}
}
}