예제 #1
0
        static HidSelector()
        {
            foreach (var hidManager in new HidManager[]
                {
                    new Windows.WinHidManager(),
                    new Linux.LinuxHidManager(),
                    new MacOS.MacHidManager(),
                    new Unsupported.UnsupportedHidManager()
                })
            {
                if (hidManager.IsSupported)
                {
                    System.Console.WriteLine(hidManager);
                    var readyEvent = new ManualResetEvent(false);

                    Instance = hidManager;
                    ManagerThread = new Thread(Instance.RunImpl);
                    ManagerThread.IsBackground = true;
                    ManagerThread.Start(readyEvent);
                    readyEvent.WaitOne();

                    break;
                }
            }
        }
예제 #2
0
        static HidSelector()
        {
            foreach (var hidManager in new HidManager[]
            {
                new Windows.WinHidManager(),
                new Linux.LinuxHidManager(),
                new MacOS.MacHidManager(),
                new Unsupported.UnsupportedHidManager()
            })
            {
                if (hidManager.IsSupported)
                {
                    System.Console.WriteLine(hidManager);
                    var readyEvent = new ManualResetEvent(false);

                    Instance      = hidManager;
                    ManagerThread = new Thread(Instance.RunImpl);
                    ManagerThread.IsBackground = true;
                    ManagerThread.Start(readyEvent);
                    readyEvent.WaitOne();

                    break;
                }
            }
        }
예제 #3
0
        static HidSelector()
        {
            foreach (var hidManager in new HidManager[]
            {
                new Windows.WinHidManager(),
                new Linux.LinuxHidManager(),
                new MacOS.MacHidManager(),
                new Unsupported.UnsupportedHidManager()
            })
            {
                if (hidManager.IsSupported)
                {
                    var readyEvent = new ManualResetEvent(false);

                    Instance = hidManager;
                    Instance.InitializeEventManager();
                    ManagerThread = new Thread(Instance.RunImpl)
                    {
                        IsBackground = true, Name = "HID Manager"
                    };
                    ManagerThread.Start(readyEvent);
                    readyEvent.WaitOne();
                    break;
                }
            }
        }
예제 #4
0
        static HidSelector()
        {
            if (Instance != null)
            {
                return;
            }

            switch (PlatformDetector.RunningPlatform())
            {
            case PlatformDetector.Platform.Linux:
                Instance = new Libusb.LibusbHidManager();
                break;

            case PlatformDetector.Platform.Mac:
                Instance = new MacOS.MacHidManager();
                break;

            case PlatformDetector.Platform.Windows:
                Instance = new Windows.WinHidManager();
                break;
            }

            var readyEvent = new ManualResetEvent(false);

            ManagerThread = new Thread(Instance.RunImpl);
            ManagerThread.IsBackground = true;
            ManagerThread.Start(readyEvent);
            readyEvent.WaitOne();

            /*
             * foreach (var hidManager in new HidManager[]
             * {
             * new Windows.WinHidManager(),
             * //new Linux.LinuxHidManager(), //Disabled, because BlinkStick does not use this
             * new MacOS.MacHidManager(),
             * new Libusb.LibusbHidManager(),
             * new Unsupported.UnsupportedHidManager()
             * })
             * {
             * if (hidManager.IsSupported)
             * {
             * var readyEvent = new ManualResetEvent(false);
             *
             * Instance = hidManager;
             * ManagerThread = new Thread(Instance.RunImpl);
             * ManagerThread.IsBackground = true;
             * ManagerThread.Start(readyEvent);
             * readyEvent.WaitOne();
             *
             * break;
             * }
             * }
             */
        }
예제 #5
0
        static HidSelector ()
		{
			if (Instance != null) {
				return;	
			}

			switch (PlatformDetector.RunningPlatform()) {
				case PlatformDetector.Platform.Linux:
					Instance = new Libusb.LibusbHidManager();
					break;
				case PlatformDetector.Platform.Mac:
					Instance = new MacOS.MacHidManager();
					break;
				case PlatformDetector.Platform.Windows:
					Instance = new Windows.WinHidManager();
					break;
			}
            
			var readyEvent = new ManualResetEvent(false);
            ManagerThread = new Thread(Instance.RunImpl);
            ManagerThread.IsBackground = true;
            ManagerThread.Start(readyEvent);
            readyEvent.WaitOne();

			/*
            foreach (var hidManager in new HidManager[]
                {
                    new Windows.WinHidManager(),
                    //new Linux.LinuxHidManager(), //Disabled, because BlinkStick does not use this
                    new MacOS.MacHidManager(),
                    new Libusb.LibusbHidManager(),
                    new Unsupported.UnsupportedHidManager()
                })
            {
                if (hidManager.IsSupported)
                {
                    var readyEvent = new ManualResetEvent(false);

                    Instance = hidManager;
                    ManagerThread = new Thread(Instance.RunImpl);
                    ManagerThread.IsBackground = true;
                    ManagerThread.Start(readyEvent);
                    readyEvent.WaitOne();

                    break;
                }
            }
            */
        }