diff --git a/ColorControl/ColorControl.csproj b/ColorControl/ColorControl.csproj index b3bcf38..d344a57 100644 --- a/ColorControl/ColorControl.csproj +++ b/ColorControl/ColorControl.csproj @@ -27,7 +27,7 @@ ColorControl Maassoft 0 - 4.4.0.0 + 4.5.0.0 false true true diff --git a/ColorControl/LgDevice.cs b/ColorControl/LgDevice.cs index 29a81d6..2de652c 100644 --- a/ColorControl/LgDevice.cs +++ b/ColorControl/LgDevice.cs @@ -123,6 +123,12 @@ public LgDevice(string name, string ipAddress, string macAddress, bool isCustom AddGenericPictureAction("gameOptimizationHDMI2", typeof(OffToOn), category: "other"); AddGenericPictureAction("gameOptimizationHDMI3", typeof(OffToOn), category: "other"); AddGenericPictureAction("gameOptimizationHDMI4", typeof(OffToOn), category: "other"); + //AddGenericPictureAction("freesyncOLEDHDMI4", typeof(OffToOn), category: "other"); + //AddGenericPictureAction("freesyncSupport", typeof(OffToOn), category: "other"); + AddGenericPictureAction("hdmiPcMode_hdmi1", typeof(FalseToTrue), category: "other"); + AddGenericPictureAction("hdmiPcMode_hdmi2", typeof(FalseToTrue), category: "other"); + AddGenericPictureAction("hdmiPcMode_hdmi3", typeof(FalseToTrue), category: "other"); + AddGenericPictureAction("hdmiPcMode_hdmi4", typeof(FalseToTrue), category: "other"); AddGenericPictureAction("adjustingLuminance", minValue: -50, maxValue: 50); AddInvokableAction("turnScreenOff", new Func, bool>(TurnScreenOffAction)); AddInvokableAction("turnScreenOn", new Func, bool>(TurnScreenOnAction)); @@ -321,6 +327,12 @@ public async Task ExecutePreset(LgPreset preset, bool reconnect, LgService { @params = new { mode = "user", flagUpdate = true }; } + + if (preset.appId.Equals("com.webos.app.factorywin")) + { + @params = new { id = "executeFactory", irKey = "inStart" }; + } + await _lgTvApi.LaunchApp(preset.appId, @params); } catch (Exception ex) diff --git a/ColorControl/LgService.cs b/ColorControl/LgService.cs index cb7e8c1..efcd824 100644 --- a/ColorControl/LgService.cs +++ b/ColorControl/LgService.cs @@ -64,6 +64,7 @@ public LgDevice SelectedDevice private int _poweredOffByScreenSaverProcessId; private Task _monitorTask; private int _monitorTaskCounter; + private LgPreset _lastTriggeredPreset; public LgService(string dataPath, bool allowPowerOn) : base(dataPath, "LgPresets.json") { @@ -781,9 +782,11 @@ private async Task ExecuteProcessPresets(ProcessMonitorContext context) toApplyPreset = toApplyPresets.First(); } - if (_lastAppliedPreset != toApplyPreset) + if (_lastTriggeredPreset != toApplyPreset) { await ApplyPreset(toApplyPreset); + + _lastTriggeredPreset = toApplyPreset; } } } diff --git a/ColorControl/MainForm.cs b/ColorControl/MainForm.cs index 58539ed..64d0fd6 100644 --- a/ColorControl/MainForm.cs +++ b/ColorControl/MainForm.cs @@ -1329,7 +1329,7 @@ private void InitLgTab() chkLgRemoteControlShow.Checked = _lgService.Config.ShowRemoteControl; scLgController.Panel2Collapsed = !_lgService.Config.ShowRemoteControl; - Utils.BuildComboBox(cbxLgPresetTrigger, PresetTriggerType.Resume, PresetTriggerType.Screensaver, PresetTriggerType.Shutdown, PresetTriggerType.Standby, PresetTriggerType.Startup); + Utils.BuildComboBox(cbxLgPresetTrigger, PresetTriggerType.Resume, PresetTriggerType.Shutdown, PresetTriggerType.Standby, PresetTriggerType.Startup, PresetTriggerType.Reserved5, PresetTriggerType.ScreensaverStart, PresetTriggerType.ScreensaverStop); } private void InitOptionsTab() @@ -1776,7 +1776,7 @@ private void miLgAddAction_Click(object sender, EventArgs e) var dropDownValues = new List(); foreach (var enumValue in Enum.GetValues(action.EnumType)) { - dropDownValues.Add(enumValue.ToString()); + dropDownValues.Add(enumValue.ToString().Replace("_", "")); } var values = MessageForms.ShowDialog("Choose value", new[] { diff --git a/ColorControl/MessageForms.cs b/ColorControl/MessageForms.cs index 915d916..6665c87 100644 --- a/ColorControl/MessageForms.cs +++ b/ColorControl/MessageForms.cs @@ -97,8 +97,8 @@ public static List ShowDialog(string caption, IEnumerable _connection?.ConnectionClosed ?? true; } @@ -501,7 +507,18 @@ public async Task SetSystemSettings(string key, object value, string category = } else { - jsonValue = $"\"{value}\""; + if (key.Contains("_")) + { + var keys = key.Split('_'); + key = keys[0]; + var childKey = keys[1]; + + jsonValue = @"{ """ + childKey + @""": " + value + " }"; + } + else + { + jsonValue = $"\"{value}\""; + } } var lunauri = "luna://com.webos.settingsservice/setSystemSettings";