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); } }
/* Green_bar_Value_Changed * * Blue_bar_Value_Changed * Brightness_bar_Value_Changed */ public void Set_Colour(int colour, uint level) { switch (colour) { case 1: //red WMIEC.WMIWriteECRAM(1865UL, (ulong)level * (ulong)g_brightness_level); break; case 2: //green WMIEC.WMIWriteECRAM(1866UL, (ulong)level * (ulong)g_brightness_level); break; case 3: //blue WMIEC.WMIWriteECRAM(1867UL, (ulong)level * (ulong)g_brightness_level); break; case 4: //bright ulong num1 = (ulong)level * (ulong)g_red_level; ulong num2 = (ulong)level * (ulong)g_green_level; ulong num3 = (ulong)level * (ulong)g_blue_level; // Utility.Log(string.Format("SetBrightnessLevel level = {0}", (object) g_brightness_level)); // Utility.Log(string.Format("0x0749h = {0}", (object) num1)); // Utility.Log(string.Format("0x074Ah = {0}", (object) num2)); // Utility.Log(string.Format("0x074Bh = {0}", (object) num3)); WMIEC.WMIWriteECRAM(1865UL, num1); WMIEC.WMIWriteECRAM(1866UL, num2); WMIEC.WMIWriteECRAM(1867UL, num3); break; } }
private void SetPowerSaveMode(uint mode) { object data = (object)0; switch (mode) { case 0: WMIEC.WMIWriteECRAM(1864UL, (ulong)(byte)((uint)(byte)(Convert.ToUInt64(data) & (ulong)byte.MaxValue) & 253U)); break; case 1: WMIEC.WMIWriteECRAM(1864UL, (ulong)(byte)((uint)(byte)(Convert.ToUInt64(data) & (ulong)byte.MaxValue) | 2U)); // Utility.Log(string.Format("0x0748.1 = 1")); break; } }
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")); } }