public MainPage() { InitializeComponent(); _KeepKeyHidDevice = new UWPHidDevice(); LoadApplication(new app(_KeepKeyHidDevice)); Loaded += MainPage_Loaded; }
public MainPage() { InitializeComponent(); var taskCompletionSource = new TaskCompletionSource <IHidDevice>(); var trezorHidDevice = new UWPHidDevice(); trezorHidDevice.Connected += TrezorHidDevice_Connected; poller = new UWPHidDevicePoller(TrezorManager.TrezorProductId, TrezorManager.TrezorVendorId, trezorHidDevice); LoadApplication(new app(trezorHidDevice)); }
private static async Task <IHidDevice> Connect() { var taskCompletionSource = new TaskCompletionSource <IHidDevice>(); var trezorHidDevice = new UWPHidDevice(); var poller = new UWPHidDevicePoller(TrezorManager.TrezorProductId, TrezorManager.TrezorVendorId, trezorHidDevice); trezorHidDevice.Connected += (a, b) => { poller.Stop(); taskCompletionSource.SetResult(trezorHidDevice); }; return(await taskCompletionSource.Task); }