Corsair fix attempt

This commit is contained in:
SpoinkyNL committed 2016-02-22 09:34:39 +01:00
1 parent b488ddf8eb
commit fe41d940c9
1 file changed
+13 -2
@@ -1,4 +1,5 @@
using System.Drawing; using System.Drawing;
using System.Threading;
using Artemis.Utilities; using Artemis.Utilities;
using CUE.NET; using CUE.NET;
using CUE.NET.Brushes; using CUE.NET.Brushes;
@@ -21,6 +22,10 @@ namespace Artemis.KeyboardProviders.Corsair
} }
public override bool CanEnable() public override bool CanEnable()
{
// Try for about 10 seconds
var tries = 0;
while (tries < 9)
{ {
try try
{ {
@@ -29,8 +34,11 @@ namespace Artemis.KeyboardProviders.Corsair
catch (CUEException e) catch (CUEException e)
{ {
if (e.Error == CorsairError.ServerNotFound) if (e.Error == CorsairError.ServerNotFound)
return false; {
throw; tries++;
Thread.Sleep(1000);
continue;
}
} }
catch (WrapperException) catch (WrapperException)
{ {
@@ -41,6 +49,9 @@ namespace Artemis.KeyboardProviders.Corsair
return true; return true;
} }
return false;
}
/// <summary> /// <summary>
/// Enables the SDK and sets updatemode to manual as well as the color of the background to black. /// Enables the SDK and sets updatemode to manual as well as the color of the background to black.
/// </summary> /// </summary>