Fix registry inputs not loading correctly

This commit is contained in:
Pat Hartl 2023-03-30 18:38:57 -05:00
parent 2485fc7cb3
commit a430c93830

View file

@ -2,11 +2,10 @@
<AddOnBefore> <AddOnBefore>
<SimpleSelect @bind-Value="Hive" Style="width: auto;" OnSelectedItemsChanged="() => OnChanged()"> <SimpleSelect @bind-Value="Hive" Style="width: auto;" OnSelectedItemsChanged="() => OnChanged()">
<SelectOptions> <SelectOptions>
<SimpleSelectOption Value="HKCR:\" Label="HKCR:\"></SimpleSelectOption> @foreach (var hive in AvailableHives)
<SimpleSelectOption Value="HKCU:\" Label="HKCU:\"></SimpleSelectOption> {
<SimpleSelectOption Value="HKLM:\" Label="HKLM:\"></SimpleSelectOption> <SimpleSelectOption Value="@hive" Label="@hive"></SimpleSelectOption>
<SimpleSelectOption Value="HKU:\" Label="HKU:\"></SimpleSelectOption> }
<SimpleSelectOption Value="HKCC:\" Label="HKCC:\"></SimpleSelectOption>
</SelectOptions> </SelectOptions>
</SimpleSelect> </SimpleSelect>
</AddOnBefore> </AddOnBefore>
@ -19,6 +18,21 @@
string Hive = "HKCU:\\"; string Hive = "HKCU:\\";
string Path = "SOFTWARE"; string Path = "SOFTWARE";
string[] AvailableHives = new string[]
{
"HKCR:\\",
"HKCU:\\",
"HKLM:\\",
"HKU:\\",
"HKCC:\\"
};
protected override async Task OnInitializedAsync()
{
Hive = AvailableHives.FirstOrDefault(h => Value != null && Value.StartsWith(h));
Path = Value.Substring(Hive.Length);
}
private async void OnChanged() private async void OnChanged()
{ {
Value = Hive + Path; Value = Hive + Path;