diff --git a/Initializing-CUE.NET.md b/Initializing-CUE.NET.md index 30404ce..2d9fade 100644 --- a/Initializing-CUE.NET.md +++ b/Initializing-CUE.NET.md @@ -1 +1,29 @@ -TODO \ No newline at end of file +CUE.NET needs to be initialized once **(and only once!)** before use. +This can be done anytime (preferable at the application start) by calling +```C# +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: +```C# +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); +} +``` \ No newline at end of file