private void LogiColourCycle(System.Drawing.Color col)
{
lock(_LogiColourCycle)
{
while (state == 3)
{
for (int x = 0; x <= 250; x += 5)
{
if (state != 3) { break; }
Thread.Sleep(10);
LogitechGSDK.LogiLedSetLighting((int)Math.Ceiling((double)(250 * 100) / 255), (int)Math.Ceiling((double)(x * 100) / 255), 0);
}
for (int x = 250; x >= 5; x -= 5)
{
if (state != 3) { break; }
Thread.Sleep(10);
LogitechGSDK.LogiLedSetLighting((int)Math.Ceiling((double)(x * 100) / 255), (int)Math.Ceiling((double)(250 * 100) / 255), 0);
}
for (int x = 0; x <= 250; x += 5)
{
if (state != 3) { break; }
Thread.Sleep(10);
LogitechGSDK.LogiLedSetLighting((int)Math.Ceiling((double)(x * 100) / 255), (int)Math.Ceiling((double)(250 * 100) / 255), 0);
}
for (int x = 250; x >= 5; x -= 5)
{
if (state != 3) { break; }
Thread.Sleep(10);
LogitechGSDK.LogiLedSetLighting(0, (int)Math.Ceiling((double)(x * 100) / 255), (int)Math.Ceiling((double)(250 * 100) / 255));
}
for (int x = 0; x <= 250; x += 5)
{
if (state != 3) { break; }
Thread.Sleep(10);
LogitechGSDK.LogiLedSetLighting((int)Math.Ceiling((double)(x * 100) / 255), 0, (int)Math.Ceiling((double)(250 * 100) / 255));
}
for (int x = 250; x >= 5; x -= 5)
{
if (state != 3) { break; }
Thread.Sleep(10);
LogitechGSDK.LogiLedSetLighting((int)Math.Ceiling((double)(250 * 100) / 255), 0, (int)Math.Ceiling((double)(x * 100) / 255));
}
}
Thread.Sleep(100);
LogitechGSDK.LogiLedSetLighting((int)Math.Ceiling((double)(col.R * 100) / 255), (int)Math.Ceiling((double)(col.G * 100) / 255), (int)Math.Ceiling((double)(col.B * 100) / 255));
}
}