Пример #1
0
 public bool initHuePlus()
 {
     NZXTSharp.HuePlus.HuePlus hue = new NZXTSharp.HuePlus.HuePlus();
     if (hue.ID != null)
     {
         huePlus = hue;
         return(true);
     }
     else
     {
         return(false);
     }
 }
        public bool Initialize(RGBDeviceType loadFilter = RGBDeviceType.All, bool exclusiveAccessIfPossible = false, bool throwExceptions = false)
        {
            IsInitialized = false;

            try
            {
                UpdateTrigger?.Stop();

                NZXTSharpHandler handler = NZXTSharpHandler.Instance;

                IList <IRGBDevice> devices = new List <IRGBDevice>();

                if (handler.initHuePlus())
                {
                    NZXTSharp.HuePlus.HuePlus hue         = handler.huePlus;
                    NZXTDeviceUpdateQueue     updateQueue = new HuePlusDeviceUpdateQueue(UpdateTrigger, hue.ID, hue.Channel1);
                    INZXTRGBDevice            device      = new HuePlusNZXTRGBDevice(new NZXTRGBDeviceInfo(RGBDeviceType.LedStripe, hue.ID, null, "HuePlus Channel 1"));
                    device.Initialize(updateQueue, hue.Channel1.ChannelInfo.NumLeds);

                    devices.Add(device);

                    updateQueue = new HuePlusDeviceUpdateQueue(UpdateTrigger, hue.ID, hue.Channel2);
                    device      = new HuePlusNZXTRGBDevice(new NZXTRGBDeviceInfo(RGBDeviceType.LedStripe, hue.ID, null, "HuePlus Channel 2"));
                    device.Initialize(updateQueue, hue.Channel2.ChannelInfo.NumLeds);

                    devices.Add(device);
                }

                UpdateTrigger?.Start();

                Devices       = new ReadOnlyCollection <IRGBDevice>(devices);
                IsInitialized = true;
            }
            catch
            {
                if (throwExceptions)
                {
                    throw;
                }
                return(false);
            }

            return(true);
        }