Ejemplo n.º 1
0
        static void Main()
        {
#if (LIBUSB)
            LibUsbUsbDeviceFactory.Register(Logger, Tracer);
#else
            WindowsUsbDeviceFactory.Register(Logger, Tracer);
#endif
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            MenuItem exitMenuItem = new MenuItem("E&xit", new EventHandler(Exit));

            notifyIcon             = new NotifyIcon();
            notifyIcon.Click      += new EventHandler(OpenApp);
            notifyIcon.Icon        = Properties.Resources.DevIcon_HD500;
            notifyIcon.ContextMenu = new ContextMenu(new MenuItem[] { exitMenuItem });
            notifyIcon.Text        = "Display dock";

            notifyIcon.Visible = true;

            msdock.StartListening();
            msdock.DockDeviceDisconnected += Msdock_DockDeviceDisconnected;
            msdock.DockDeviceInitialized  += Msdock_DockDeviceInitialized;

            Application.Run();
        }
Ejemplo n.º 2
0
        public UsbTransport()
        {
#if (LIBUSB)
            LibUsbUsbDeviceFactory.Register(Logger, Tracer);
#else
            WindowsUsbDeviceFactory.Register(Logger, Tracer);
            WindowsHidDeviceFactory.Register(Logger, Tracer);
#endif
            Devices = new ObservableCollection <UsbDevice>();
            UpdateDeviceList();
        }
Ejemplo n.º 3
0
        private static void Main(string[] args)
        {
            //Register the factory for creating Usb devices. This only needs to be done once.
#if (LIBUSB)
            LibUsbUsbDeviceFactory.Register(Logger);
#else
            WindowsUsbDeviceFactory.Register(Logger);
            WindowsHidDeviceFactory.Register(Logger);
#endif

            _DeviceConnectionExample.TrezorInitialized  += _DeviceConnectionExample_TrezorInitialized;
            _DeviceConnectionExample.TrezorDisconnected += _DeviceConnectionExample_TrezorDisconnected;

            Go();

            new ManualResetEvent(false).WaitOne();
        }
Ejemplo n.º 4
0
        public async override void ViewDidLoad()
        {
            base.ViewDidLoad();

            LibUsbUsbDeviceFactory.Register();

            await TrezorExample.InitializeTrezorAsync();

            var buffer = await TrezorExample.WriteAndReadFromDeviceAsync();

            var alert = new NSAlert
            {
                MessageText = $"Got it! {buffer[0]},{buffer[1]},{buffer[2]}.  Warning: Make sure you unplug and replug before trying again.",
                AlertStyle  = NSAlertStyle.Informational
            };

            alert.AddButton("OK");

            var returnValue = alert.RunModal();
        }