/// <inheritdoc />
 public void Dispose()
 {
     try
     {
         SteelSeriesSDK.Dispose();
     }
     catch { /* shit happens */ }
 }
        /// <inheritdoc />
        public void Dispose()
        {
            try { UpdateTrigger?.Dispose(); }
            catch { /* at least we tried */ }

            try { SteelSeriesSDK.Dispose(); }
            catch { /* shit happens */ }
        }
 /// <inheritdoc />
 public void ResetDevices()
 {
     if (IsInitialized)
     {
         try
         {
             SteelSeriesSDK.ResetLeds();
         }
         catch { /* shit happens */ }
     }
 }
 protected override void OnUpdate(object sender, CustomUpdateData customData)
 {
     if ((customData != null) && (customData["refresh"] as bool? ?? false))
     {
         SteelSeriesSDK.SendHeartbeat();
     }
     else
     {
         base.OnUpdate(sender, customData);
     }
 }
        /// <inheritdoc />
        public bool Initialize(RGBDeviceType loadFilter = RGBDeviceType.All, bool exclusiveAccessIfPossible = false, bool throwExceptions = false)
        {
            try
            {
                IsInitialized = false;

                UpdateTrigger?.Stop();

                if (!SteelSeriesSDK.IsInitialized)
                {
                    SteelSeriesSDK.Initialize();
                }

                IList <IRGBDevice> devices = new List <IRGBDevice>();
                DeviceChecker.LoadDeviceList(loadFilter);

                try
                {
                    foreach ((string model, RGBDeviceType deviceType, int _, SteelSeriesDeviceType steelSeriesDeviceType, string imageLayout, string layoutPath, Dictionary <LedId, SteelSeriesLedId> ledMapping) in DeviceChecker.ConnectedDevices)
                    {
                        ISteelSeriesRGBDevice        device      = new SteelSeriesRGBDevice(new SteelSeriesRGBDeviceInfo(deviceType, model, steelSeriesDeviceType, imageLayout, layoutPath));
                        SteelSeriesDeviceUpdateQueue updateQueue = new SteelSeriesDeviceUpdateQueue(UpdateTrigger, steelSeriesDeviceType.GetAPIName());
                        device.Initialize(updateQueue, ledMapping);
                        devices.Add(device);
                    }
                }
                catch { if (throwExceptions)
                        {
                            throw;
                        }
                }

                UpdateTrigger?.Start();

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

            return(true);
        }
 /// <inheritdoc />
 protected override void Update(Dictionary <object, Color> dataSet)
 => SteelSeriesSDK.UpdateLeds(_deviceType, dataSet.ToDictionary(x => ((SteelSeriesLedId)x.Key).GetAPIName(), x => x.Value.ToIntArray()));