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>
<SimpleSelect @bind-Value="Hive" Style="width: auto;" OnSelectedItemsChanged="() => OnChanged()">
<SelectOptions>
<SimpleSelectOption Value="HKCR:\" Label="HKCR:\"></SimpleSelectOption>
<SimpleSelectOption Value="HKCU:\" Label="HKCU:\"></SimpleSelectOption>
<SimpleSelectOption Value="HKLM:\" Label="HKLM:\"></SimpleSelectOption>
<SimpleSelectOption Value="HKU:\" Label="HKU:\"></SimpleSelectOption>
<SimpleSelectOption Value="HKCC:\" Label="HKCC:\"></SimpleSelectOption>
@foreach (var hive in AvailableHives)
{
<SimpleSelectOption Value="@hive" Label="@hive"></SimpleSelectOption>
}
</SelectOptions>
</SimpleSelect>
</AddOnBefore>
@ -19,6 +18,21 @@
string Hive = "HKCU:\\";
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()
{
Value = Hive + Path;