53 lines
No EOL
1.4 KiB
Text
53 lines
No EOL
1.4 KiB
Text
<AntDesign.Input Type="InputType.Text" @bind-Value="Path" OnBlur="() => OnChanged()">
|
|
<AddOnBefore>
|
|
<SimpleSelect @bind-Value="Hive" Style="width: auto;" OnSelectedItemsChanged="() => OnChanged()">
|
|
<SelectOptions>
|
|
@foreach (var hive in AvailableHives)
|
|
{
|
|
<SimpleSelectOption Value="@hive" Label="@hive"></SimpleSelectOption>
|
|
}
|
|
</SelectOptions>
|
|
</SimpleSelect>
|
|
</AddOnBefore>
|
|
</AntDesign.Input>
|
|
|
|
@code {
|
|
[Parameter] public string Value { get; set; } = "";
|
|
[Parameter] public EventCallback<string> ValueChanged { get; set; }
|
|
|
|
string Hive = "HKCU:\\";
|
|
string Path = "SOFTWARE";
|
|
|
|
string[] AvailableHives = new string[]
|
|
{
|
|
"HKCR:\\",
|
|
"HKCU:\\",
|
|
"HKLM:\\",
|
|
"HKU:\\",
|
|
"HKCC:\\"
|
|
};
|
|
|
|
protected override async Task OnInitializedAsync()
|
|
{
|
|
if (Hive == null)
|
|
Hive = "HKCU:\\";
|
|
|
|
if (Value == null)
|
|
Value = Hive;
|
|
|
|
if (!String.IsNullOrWhiteSpace(Value))
|
|
Hive = AvailableHives.FirstOrDefault(h => Value != null && Value.StartsWith(h));
|
|
|
|
Path = Value.Substring(Hive.Length);
|
|
}
|
|
|
|
private async void OnChanged()
|
|
{
|
|
Value = Hive + Path;
|
|
|
|
if (ValueChanged.HasDelegate)
|
|
await ValueChanged.InvokeAsync(Value);
|
|
|
|
StateHasChanged();
|
|
}
|
|
} |