Skip to content
This repository was archived by the owner on Aug 6, 2021. It is now read-only.

Initializing CUE.NET

DarthAffe edited this page Nov 13, 2015 · 5 revisions

CUE.NET needs to be initialized once (and only once!) before use.
This can be done anytime (preferable at the application start) by calling

CueSDK.Initialize();

After this you are free to work with the KeyboardSDK, MouseSDK or HeadsetSDK provided by the static CueSDK class whenever you like.

Since there could always be a problem while initializing CUE.NET you should catch the WrapperException and CUEException and check if the SDK you want to use is initialized.

A full initialization block could look like this:

try
{
    CueSDK.Initialize();
    Debug.WriteLine("Initialized with " + CueSDK.LoadedArchitecture + "-SDK");

    CorsairKeyboard keyboard = CueSDK.KeyboardSDK;
    if (keyboard == null)
        throw new WrapperException("No keyboard found");
}
catch (CUEException ex)
{
    Debug.WriteLine("CUE Exception! ErrorCode: " + Enum.GetName(typeof(CorsairError), ex.Error));
}
catch (WrapperException ex)
{
    Debug.WriteLine("Wrapper Exception! Message:" + ex.Message);
}

Clone this wiki locally