예제 #1
0
 public MainPage()
 {
     InitializeComponent();
     _KeepKeyHidDevice = new UWPHidDevice();
     LoadApplication(new app(_KeepKeyHidDevice));
     Loaded += MainPage_Loaded;
 }
예제 #2
0
        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));
        }
예제 #3
0
        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);
        }