From 827157f30f5035997e918cc2a151ca5edad2449e Mon Sep 17 00:00:00 2001 From: Maassoft Date: Fri, 30 May 2025 17:20:37 +0200 Subject: [PATCH] fix several issues, add remote controls to new UI --- ColorControl.UI/ColorControl.UI.csproj | 15 + .../Components/Layout/NavMenu.razor | 2 - .../Components/Pages/AMD/AmdPresetPage.razor | 7 +- .../ColorProfile/ColorProfileSummary.razor | 24 +- .../Pages/Game/GamePresetPage.razor | 441 ++-- .../Pages/Generic/ConfirmModal.razor | 5 +- .../Components/Pages/Generic/FieldDefs.razor | 13 +- .../Pages/Generic/FieldsModal.razor | 13 +- .../Pages/Generic/NullableRangeInput.razor | 73 + .../Components/Pages/Generic/RangeInput.razor | 116 + .../Pages/Generic/ShortcutInput.razor | 9 +- .../Pages/Generic/StartProgramInput.razor | 64 + .../Components/Pages/Generic/StepsInput.razor | 70 +- .../Pages/Generic/TriggerInput.razor | 8 + ColorControl.UI/Components/Pages/Home.razor | 2 - ColorControl.UI/Components/Pages/Info.razor | 1 - .../Components/Pages/LG/LgDevicePage.razor | 28 +- .../Components/Pages/LG/LgPresetPage.razor | 4 +- .../Components/Pages/LG/LgSummary.razor | 30 +- .../Components/Pages/Logging.razor | 2 - .../Pages/Nvidia/NvidiaDithering.razor | 2 - .../Pages/Nvidia/NvidiaDriverSettings.razor | 29 +- .../Pages/Nvidia/NvidiaGpuSettings.razor | 52 +- .../Components/Pages/Nvidia/NvidiaInfo.razor | 109 + .../Pages/Nvidia/NvidiaPreset.razor | 236 +- .../Pages/Nvidia/NvidiaSummary.razor | 65 +- .../Components/Pages/Options.razor | 10 +- .../RemoteControl/GenericRcButtonPage.razor | 120 + .../Pages/RemoteControl/GenericRcPage.razor | 319 +++ .../Pages/Samsung/SamsungDevicePage.razor | 28 +- .../Pages/Samsung/SamsungPresetPage.razor | 2 - .../Pages/Samsung/SamsungSummary.razor | 19 +- ColorControl.UI/Services/JSHelper.cs | 22 + ColorControl.UI/wwwroot/helper.js | 8 + .../wwwroot/remotes/LG_FactorySVC.jpg | Bin 0 -> 42149 bytes ColorControl.UI/wwwroot/remotes/LG_MR20GA.jpg | Bin 0 -> 40287 bytes ColorControl.UI/wwwroot/remotes/LG_MR23GN.jpg | Bin 0 -> 52743 bytes .../wwwroot/remotes/Samsung_AA81-00243A.jpg | Bin 0 -> 66745 bytes .../wwwroot/remotes/Samsung_BN59-01315B.jpg | Bin 0 -> 83292 bytes ColorControl/ColorControl.csproj | 22 +- ColorControl/CommandLineHandler.cs | 30 +- ColorControl/Program.cs | 884 +++---- ColorControl/Resources/LgRemotes.json | 1 + ColorControl/Resources/SamsungRemotes.json | 1 + .../Services/Common/ColorProfileService.cs | 1 + .../Services/Common/NotifyIconManager.cs | 2 +- ColorControl/Services/Common/ServiceBase.cs | 6 +- .../Services/GameLauncher/GameService.cs | 19 +- ColorControl/Services/LG/LgDevice.cs | 12 +- ColorControl/Services/LG/LgPanel.cs | 4 +- ColorControl/Services/LG/LgService.cs | 111 +- .../Services/LG/RemoteControlPanel.cs | 2 +- ColorControl/Services/NVIDIA/NvService.cs | 109 +- .../Services/Samsung/SamTvConnection.cs | 15 +- .../Services/Samsung/SamsungService.cs | 110 +- ColorControl/lgtv/LgTvApi.cs | 4 +- MHC2Gen/IccContext.cs | 2284 +++++++++-------- MHC2Gen/MHC2Wrapper.cs | 6 +- Nspector/Common/DrsSettingsService.cs | 20 +- Nspector/Nspector.csproj | 4 + Nspector/nspector/CustomSettingNames.xml | 6 +- NvAPIWrapper/NvAPIWrapper.csproj | 1 - README.md | 6 +- Shared/Common/NestedItemsBuilder.cs | 103 + Shared/Common/Utils.cs | 4 +- Shared/Contracts/Base/BaseDeviceDto.cs | 31 + Shared/Contracts/DisplayConfig.cs | 1 + .../Contracts/DisplayInfo/DisplayInfoDto.cs | 1 + Shared/Contracts/DpiScaling.cs | 23 + Shared/Contracts/Game/GamePreset.cs | 201 +- Shared/Contracts/LG/LgDeviceDto.cs | 31 +- Shared/Contracts/LG/LgPreset.cs | 182 +- Shared/Contracts/LG/LgPresets.cs | 8 + Shared/Contracts/LG/LgRcDto.cs | 8 + Shared/Contracts/NVIDIA/NvGpuOcSettings.cs | 13 + Shared/Contracts/NVIDIA/NvPreset.cs | 24 +- Shared/Contracts/NVIDIA/NvProfile.cs | 14 + Shared/Contracts/NVIDIA/NvSettingItemDto.cs | 74 +- Shared/Contracts/Presets/PresetBase.cs | 9 +- .../RemoteControl/BaseRcButtonDto.cs | 30 + Shared/Contracts/RemoteControl/BaseRcDto.cs | 17 + Shared/Contracts/Samsung/SamsungButtons.cs | 1 + Shared/Contracts/Samsung/SamsungDeviceDto.cs | 31 +- Shared/Contracts/Samsung/SamsungPreset.cs | 2 - Shared/Contracts/Samsung/SamsungPresets.cs | 19 +- Shared/Contracts/Samsung/SamsungRcDto.cs | 8 + .../EventDispatcher/ProcessEventDispatcher.cs | 7 +- .../WindowMessageDispatcher.cs | 7 + Shared/Forms/TreeNodeBuilder.cs | 110 +- Shared/Native/CCD.cs | 75 +- novideo_srgb/MainWindow.xaml.cs | 28 +- 91 files changed, 4140 insertions(+), 2530 deletions(-) create mode 100644 ColorControl.UI/Components/Pages/Generic/NullableRangeInput.razor create mode 100644 ColorControl.UI/Components/Pages/Generic/RangeInput.razor create mode 100644 ColorControl.UI/Components/Pages/Generic/StartProgramInput.razor create mode 100644 ColorControl.UI/Components/Pages/Nvidia/NvidiaInfo.razor create mode 100644 ColorControl.UI/Components/Pages/RemoteControl/GenericRcButtonPage.razor create mode 100644 ColorControl.UI/Components/Pages/RemoteControl/GenericRcPage.razor create mode 100644 ColorControl.UI/wwwroot/remotes/LG_FactorySVC.jpg create mode 100644 ColorControl.UI/wwwroot/remotes/LG_MR20GA.jpg create mode 100644 ColorControl.UI/wwwroot/remotes/LG_MR23GN.jpg create mode 100644 ColorControl.UI/wwwroot/remotes/Samsung_AA81-00243A.jpg create mode 100644 ColorControl.UI/wwwroot/remotes/Samsung_BN59-01315B.jpg create mode 100644 ColorControl/Resources/LgRemotes.json create mode 100644 ColorControl/Resources/SamsungRemotes.json create mode 100644 Shared/Common/NestedItemsBuilder.cs create mode 100644 Shared/Contracts/Base/BaseDeviceDto.cs create mode 100644 Shared/Contracts/DpiScaling.cs create mode 100644 Shared/Contracts/LG/LgPresets.cs create mode 100644 Shared/Contracts/LG/LgRcDto.cs create mode 100644 Shared/Contracts/NVIDIA/NvProfile.cs create mode 100644 Shared/Contracts/RemoteControl/BaseRcButtonDto.cs create mode 100644 Shared/Contracts/RemoteControl/BaseRcDto.cs create mode 100644 Shared/Contracts/Samsung/SamsungRcDto.cs diff --git a/ColorControl.UI/ColorControl.UI.csproj b/ColorControl.UI/ColorControl.UI.csproj index e2a26dd..a7de281 100644 --- a/ColorControl.UI/ColorControl.UI.csproj +++ b/ColorControl.UI/ColorControl.UI.csproj @@ -72,6 +72,21 @@ PreserveNewest + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + diff --git a/ColorControl.UI/Components/Layout/NavMenu.razor b/ColorControl.UI/Components/Layout/NavMenu.razor index 8b5df25..bb647c6 100644 --- a/ColorControl.UI/Components/Layout/NavMenu.razor +++ b/ColorControl.UI/Components/Layout/NavMenu.razor @@ -4,8 +4,6 @@ @rendermode Constants.RenderMode @inject RpcUiClientService _rpcClientService -@inject AppState AppState -@inject NavigationManager _navigationManager; diff --git a/ColorControl.UI/Components/Pages/ColorProfile/ColorProfileSummary.razor b/ColorControl.UI/Components/Pages/ColorProfile/ColorProfileSummary.razor index 8de5067..1c264e8 100644 --- a/ColorControl.UI/Components/Pages/ColorProfile/ColorProfileSummary.razor +++ b/ColorControl.UI/Components/Pages/ColorProfile/ColorProfileSummary.razor @@ -28,7 +28,7 @@ } else { -
+
@if (!Displays.Any()) { No displays found @@ -54,6 +54,13 @@ else } else { +
+
+ + +
+
+

Display Associated Color profiles

@@ -320,4 +327,19 @@ else await SelectedDisplayChanged(); } + + private async Task AfterUsePerUseSettings() + { + if (SelectedDisplay == null) + { + return; + } + + var result = await _rpcClientService.CallAsync("ColorProfileService", "SetUsePerUserDisplayProfiles", SelectedDisplay.DeviceName, SelectedDisplay.UsePerUserSettings); + + if (result) + { + await RefreshDisplays(); + } + } } diff --git a/ColorControl.UI/Components/Pages/Game/GamePresetPage.razor b/ColorControl.UI/Components/Pages/Game/GamePresetPage.razor index 2fdbf1f..6dc4651 100644 --- a/ColorControl.UI/Components/Pages/Game/GamePresetPage.razor +++ b/ColorControl.UI/Components/Pages/Game/GamePresetPage.razor @@ -9,272 +9,235 @@ @rendermode Constants.RenderMode @inject RpcUiClientService _rpcClientService -@inject AppState AppState -@inject NavigationManager _navigationManager; @code { - private GamePreset? Preset; + private GamePreset? Preset; - [Parameter] - public GamePreset? PresetParam { get; set; } + [Parameter] + public GamePreset? PresetParam { get; set; } - [Parameter] - public Func? AfterApply { get; set; } + [Parameter] + public Func? AfterApply { get; set; } - public List CpuAffinityLabels = Enumerable.Range(0, Environment.ProcessorCount).Select(i => $"CPU #{i}").ToList(); - private List? RecentApps; - private string RecentAppFilename = ""; + public List CpuAffinityLabels = Enumerable.Range(0, Environment.ProcessorCount).Select(i => $"CPU #{i}").ToList(); + private List? RecentApps; + private string RecentAppFilename = ""; - public bool SelectingFile { get; set; } + public bool SelectingFile { get; set; } - private string WasValidated = ""; - private bool IsVisible; + private string WasValidated = ""; + private bool IsVisible; - protected override async Task OnParametersSetAsync() - { - if (PresetParam == null) - { - return; - } + protected override async Task OnParametersSetAsync() + { + if (PresetParam == null) + { + return; + } - Preset = PresetParam.CloneWithId(); + Preset = PresetParam.CloneWithId(); - if (Preset.id == 0) - { - RecentApps = await _rpcClientService.CallAsync>("GameService", "GetMruApps", true); - RecentAppFilename = ""; + if (Preset.id == 0) + { + RecentApps = await _rpcClientService.CallAsync>("GameService", "GetMruApps", true); + RecentAppFilename = ""; - if (RecentApps != null) - { - RecentApps.Insert(0, new GameApp { Filename = "", FriendlyName = "Choose a recent app to fill values" }); - } - } - else - { - RecentApps = null; - } - } + if (RecentApps != null) + { + RecentApps.Insert(0, new GameApp { Filename = "", FriendlyName = "Choose a recent app to fill values" }); + } + } + else + { + RecentApps = null; + } + } - private async Task ApplyClick(MouseEventArgs e) - { - if (Preset == null) - { - return; - } + private async Task ApplyClick(MouseEventArgs e) + { + if (Preset == null) + { + return; + } - if (!IsValid()) - { - WasValidated = "was-validated"; - return; - } + if (!IsValid()) + { + WasValidated = "was-validated"; + return; + } - var result = await _rpcClientService.CallAsync("GameService", "UpdatePreset", Preset); + var result = await _rpcClientService.CallAsync("GameService", "UpdatePreset", Preset); - if (AfterApply != null) - { - await AfterApply.Invoke(Preset); - } + if (AfterApply != null) + { + await AfterApply.Invoke(Preset); + } - IsVisible = false; - } + IsVisible = false; + } - private bool IsValid() - { - return !string.IsNullOrEmpty(Preset?.name) && !string.IsNullOrEmpty(Preset?.Path); - } + private bool IsValid() + { + return !string.IsNullOrEmpty(Preset?.name) && !string.IsNullOrEmpty(Preset?.Path); + } - private async Task SelectFileOnClick(MouseEventArgs e) - { - if (Preset == null) - { - return; - } + private void RecentAppSelected() + { + if (RecentApps == null || Preset == null) + { + return; + } - SelectingFile = true; - try - { - var options = new RpcUiClientOptions - { - Timeout = 60000 - }; + var app = RecentApps.FirstOrDefault(a => a.Filename == RecentAppFilename); - var result = await _rpcClientService.CallWithOptionsAsync("GameService", "SelectPath", options); + if (app != null) + { + Preset.name = app.FriendlyName; + Preset.Path = app.Path; + } + } - if (result != null) - { - Preset.Path = result; - if (string.IsNullOrEmpty(Preset.name)) - { - Preset.name = Path.GetFileNameWithoutExtension(result); - } - } - } - finally - { - SelectingFile = false; - } - } + private void ModalOnFocus(FocusEventArgs e) + { + if (!IsVisible) + { + WasValidated = ""; + IsVisible = true; + } + } + private void PathChanged() + { + if (Preset == null) + { + return; + } - private void RecentAppSelected() - { - if (RecentApps == null || Preset == null) - { - return; - } - - var app = RecentApps.FirstOrDefault(a => a.Filename == RecentAppFilename); - - if (app != null) - { - Preset.name = app.FriendlyName; - Preset.Path = app.Path; - } - } - - private void ModalOnFocus(FocusEventArgs e) - { - if (!IsVisible) - { - WasValidated = ""; - IsVisible = true; - } - } + if (Preset.Path != null && string.IsNullOrEmpty(Preset.name)) + { + Preset.name = Path.GetFileNameWithoutExtension(Preset.Path); + } + } } \ No newline at end of file diff --git a/ColorControl.UI/Components/Pages/Generic/ConfirmModal.razor b/ColorControl.UI/Components/Pages/Generic/ConfirmModal.razor index 220387f..3a40d3c 100644 --- a/ColorControl.UI/Components/Pages/Generic/ConfirmModal.razor +++ b/ColorControl.UI/Components/Pages/Generic/ConfirmModal.razor @@ -4,7 +4,7 @@ @rendermode Constants.RenderMode - + @code { [Parameter] @@ -19,6 +19,9 @@ [Parameter] public string ModalId { get; set; } = "confirmModal"; + [Parameter] + public string? NextModalId { get; set; } + [Parameter] public List? ExtraFields { get; set; } diff --git a/ColorControl.UI/Components/Pages/Generic/FieldDefs.razor b/ColorControl.UI/Components/Pages/Generic/FieldDefs.razor index 48a85b5..2080131 100644 --- a/ColorControl.UI/Components/Pages/Generic/FieldDefs.razor +++ b/ColorControl.UI/Components/Pages/Generic/FieldDefs.razor @@ -4,8 +4,6 @@ @rendermode Constants.RenderMode -@inject NavigationManager _navigationManager; - @if (Fields == null) { return; @@ -106,16 +104,7 @@ { var fieldId = $"fld_{Random.Shared.Next()}"; -
- - - @if (field.SubLabel != null) - { -
- @field.SubLabel -
- } -
+ } } diff --git a/ColorControl.UI/Components/Pages/Generic/FieldsModal.razor b/ColorControl.UI/Components/Pages/Generic/FieldsModal.razor index c788ed3..d6f85bc 100644 --- a/ColorControl.UI/Components/Pages/Generic/FieldsModal.razor +++ b/ColorControl.UI/Components/Pages/Generic/FieldsModal.razor @@ -3,8 +3,7 @@ @using ColorControl.Shared.Common; @rendermode Constants.RenderMode - -@inject NavigationManager _navigationManager; +@inject JSHelper jsHelper;