コード例 #1
0
 private void MainPageLoaded(object sender, RoutedEventArgs e)
 {
     ProgrammatorDevice.UsbDeviceFound += async(o, args) =>
     {
         _programmator = args.ProgrammatorDevice;
         await _programmator.SendRandomMessage();
     };
     ProgrammatorDevice.SearchForUsbDevices(Dispatcher);
 }
コード例 #2
0
 private void MainPageLoaded(object sender, RoutedEventArgs e)
 {
     ProgrammatorDevice.UsbDeviceFound += async (o, args) =>
     {
         _programmator = args.ProgrammatorDevice;
         await _programmator.SendRandomMessage();
     };
     ProgrammatorDevice.SearchForUsbDevices(Dispatcher);
 }
コード例 #3
0
 public static void SearchForUsbDevices(CoreDispatcher dispatcher)
 {
     DeviceWatcher deviceWatcher =
         DeviceInformation.CreateWatcher(HidDevice.GetDeviceSelector(uPage, uid));
     deviceWatcher.Added += (s, a) => dispatcher.RunAsync(CoreDispatcherPriority.Normal, async () =>
     {
         HidDevice hidDevice = await HidDevice.FromIdAsync(a.Id, FileAccessMode.ReadWrite);
         var launcher = new ProgrammatorDevice(hidDevice);
         if (UsbDeviceFound != null)
         {
             UsbDeviceFound(null, new ProgrammatorDeviceEventArgs(launcher));
         }
           
         deviceWatcher.Stop();
     });
     deviceWatcher.Start();
 }
コード例 #4
0
        public static void SearchForUsbDevices(CoreDispatcher dispatcher)
        {
            DeviceWatcher deviceWatcher =
                DeviceInformation.CreateWatcher(HidDevice.GetDeviceSelector(uPage, uid));

            deviceWatcher.Added += (s, a) => dispatcher.RunAsync(CoreDispatcherPriority.Normal, async() =>
            {
                HidDevice hidDevice = await HidDevice.FromIdAsync(a.Id, FileAccessMode.ReadWrite);
                var launcher        = new ProgrammatorDevice(hidDevice);
                if (UsbDeviceFound != null)
                {
                    UsbDeviceFound(null, new ProgrammatorDeviceEventArgs(launcher));
                }

                deviceWatcher.Stop();
            });
            deviceWatcher.Start();
        }
コード例 #5
0
 public ProgrammatorDeviceEventArgs(ProgrammatorDevice programmator)
 {
     ProgrammatorDevice = programmator;
 }
コード例 #6
0
 public ProgrammatorDeviceEventArgs(ProgrammatorDevice programmator)
 {
     ProgrammatorDevice = programmator;
 }