private void SystemEvents_PowerModeChanged(object sender, PowerModeChangedEventArgs e) { // Utility.Log(nameof(SystemEvents_PowerModeChanged)); if (e.Mode != PowerModes.Resume) { return; } /* Utility.Log("---------------" + GetTime() + "---------------"); * Utility.Log("Resume"); * this.LoadRegistry(); * Thread.Sleep(3000); * this.SetBrightnessLevel(g_brightness_level, true); * this.SetBrightnessLayout(g_brightness_level); * this.SetRedLayout(g_red_level); * this.SetGreenLayout(g_green_level); * this.SetBlueLayout(g_blue_level); * this.SetPowerSaveModeLayout(g_PowerSaveMode); * this.SetBreathingLightEffectLayout(g_BreathingLightEffect);*/ object data = (object)0; if (!WMIEC.WMIReadECRAM(1864UL, ref data)) { Console.WriteLine("[LightBarAPP][SystemEvents_PowerModeChanged]WMIReadECRAM failed "); } else { long uint64 = (long)Convert.ToUInt64(data); Thread.Sleep(500); //this.SetPowerSaveMode(g_PowerSaveMode, true); //this.SetBreathingLightEffect(g_BreathingLightEffect, true); } }
private void LoadSetting() { // Utility.Log(string.Format("LoadSetting()")); object data = (object)0; if (!WMIEC.WMIReadECRAM(1864UL, ref data)) { Console.WriteLine("[LightBarAPP][LoadSetting]WMIReadECRAM failed "); } else { WMIEC.WMIWriteECRAM(1864UL, (ulong)(byte)((uint)(byte)((uint)(byte)(Convert.ToUInt64(data) & (ulong)byte.MaxValue) | 1U) & (uint)sbyte.MaxValue)); // Utility.Log(string.Format("0x0748.0 = 1")); // Utility.Log(string.Format("0x0748.7 = 0")); } }