public bool Initialize() { lock (action_lock) { if (!IsInitialized()) { try { if (!Chroma.SdkAvailable) { throw new Exception("No Chroma SDK available"); } Chroma.Instance.Initialize(); Global.logger.LogLine("Razer device, Initialized", Logging_Level.Info); keyboard = Chroma.Instance.Keyboard; mouse = Chroma.Instance.Mouse; headset = Chroma.Instance.Headset; mousepad = Chroma.Instance.Mousepad; keypad = Chroma.Instance.Keypad; if (keyboard == null && mouse == null && headset == null && mousepad == null && keypad == null ) { throw new Exception("No devices connected"); } else { if (Global.Configuration.razer_first_time) { RazerInstallInstructions instructions = new RazerInstallInstructions(); instructions.ShowDialog(); Global.Configuration.razer_first_time = false; Settings.ConfigManager.Save(Global.Configuration); } isInitialized = true; return(true); } } catch (Exception ex) { Global.logger.LogLine("Razer device, Exception! Message:" + ex, Logging_Level.Error); } isInitialized = false; return(false); } return(isInitialized); } }
public bool Initialize() { lock (action_lock) { if (!IsInitialized()) { try { if (!Chroma.SdkAvailable) { throw new Exception("No Chroma SDK available"); } Chroma.Instance.Initialize(); Global.logger.Info("Razer device, Initialized"); keyboard = Chroma.Instance.Keyboard; mouse = Chroma.Instance.Mouse; headset = Chroma.Instance.Headset; mousepad = Chroma.Instance.Mousepad; keypad = Chroma.Instance.Keypad; if (keyboard == null && mouse == null && headset == null && mousepad == null && keypad == null ) { throw new Exception("No devices connected"); } else { /*if (Chroma.Instance.Query(Corale.Colore.Razer.Devices.BladeStealth).Connected || Chroma.Instance.Query(Corale.Colore.Razer.Devices.Blade14).Connected) * bladeLayout = true;*/ if (Global.Configuration.razer_first_time) { RazerInstallInstructions instructions = new RazerInstallInstructions(); instructions.ShowDialog(); Global.Configuration.razer_first_time = false; Settings.ConfigManager.Save(Global.Configuration); } isInitialized = true; return(true); } } catch (Exception ex) { Global.logger.Error("Razer device, Exception! Message:" + ex); } isInitialized = false; return(false); } return(isInitialized); } }