Init() публичный Метод

public Init ( string HidDevicePath ) : bool
HidDevicePath string
Результат bool
Пример #1
0
        public void RefreshList()
        {
            LastWin32Error = 0;

            var keys = new string[_buddies.Keys.Count];

            _buddies.Keys.CopyTo(keys, 0);
            foreach (var Key in keys)
            {
                var buddy = _buddies[Key];
                if (buddy.LastWin32Error != 0)
                {
                    LastWin32Error = buddy.LastWin32Error;
                }
                if (!buddy.IsAlive)
                {
                    buddy.Release();
                    _buddies.Remove(Key);
                }
            }

            List <string> devicePaths = new List <string>();

            devicePaths.AddRange(HIDDevices.Find((int)VendorID.TenxTechnology, (int)TenxTechDeviceID.iBuddy1));
            devicePaths.AddRange(HIDDevices.Find((int)VendorID.TenxTechnology, (int)TenxTechDeviceID.iBuddy2));
            foreach (var devicePath in devicePaths)
            {
                if (!_buddies.ContainsKey(devicePath))
                {
                    var buddy = new iBuddy();
                    if (buddy.Init(devicePath))
                    {
                        _buddies.Add(devicePath, buddy);
                    }
                }
            }
        }
Пример #2
0
        public void Refresh()
        {
            var Keys = new string[_buddies.Keys.Count];
            _buddies.Keys.CopyTo(Keys, 0);
            foreach (var Key in Keys)
            {
                if (!_buddies[Key].IsAlive)
                {
                    _buddies[Key].Release();
                    _buddies.Remove(Key);
                }
            }

            List<string> DevicePaths = new List<string>();
            DevicePaths.AddRange(HIDDevices.Find((int)VendorID.TenxTechnology, (int)TenxTechDeviceID.iBuddy1));
            DevicePaths.AddRange(HIDDevices.Find((int)VendorID.TenxTechnology, (int)TenxTechDeviceID.iBuddy2));
            foreach(var DevicePath in DevicePaths)
            {
                if (!_buddies.ContainsKey(DevicePath))
                {
                    iBuddy Buddy = new iBuddy();
                    if (Buddy.Init(DevicePath))
                    {
                        _buddies.Add(DevicePath, Buddy);
                    }
                }
            }

            UpdateColor();
        }
Пример #3
0
        public void RefreshList()
        {
            LastWin32Error = 0;

            var keys = new string[_buddies.Keys.Count];
            _buddies.Keys.CopyTo(keys, 0);
            foreach (var Key in keys)
            {
                var buddy = _buddies[Key];
                if (buddy.LastWin32Error != 0)
                {
                    LastWin32Error = buddy.LastWin32Error;
                }
                if (!buddy.IsAlive)
                {
                    buddy.Release();
                    _buddies.Remove(Key);
                }
            }

            List<string> devicePaths = new List<string>();
            devicePaths.AddRange(HIDDevices.Find((int)VendorID.TenxTechnology, (int)TenxTechDeviceID.iBuddy1));
            devicePaths.AddRange(HIDDevices.Find((int)VendorID.TenxTechnology, (int)TenxTechDeviceID.iBuddy2));
            foreach(var devicePath in devicePaths)
            {
                if (!_buddies.ContainsKey(devicePath))
                {
                    var buddy = new iBuddy();
                    if (buddy.Init(devicePath))
                    {
                        _buddies.Add(devicePath, buddy);
                    }
                }
            }
        }