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;