@foreach (var hive in AvailableHives)
{
}
@code {
[Parameter] public string Value { get; set; } = "";
[Parameter] public EventCallback 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();
}
}