Auto populate server working directory based on executable path
parent
d869a5a763
commit
9a55dac778
|
@ -24,6 +24,7 @@
|
|||
@code {
|
||||
[Parameter] public string Value { get; set; }
|
||||
[Parameter] public EventCallback<string> ValueChanged { get; set; }
|
||||
[Parameter] public EventCallback<string> OnSelected { get; set; }
|
||||
[Parameter] public Guid ArchiveId { get; set; }
|
||||
[Parameter] public string Title { get; set; } = "Choose File";
|
||||
[Parameter] public string OkText { get; set; } = "Select File";
|
||||
|
@ -75,6 +76,9 @@
|
|||
if (ValueChanged.HasDelegate)
|
||||
await ValueChanged.InvokeAsync(Value);
|
||||
|
||||
if (OnSelected.HasDelegate)
|
||||
await OnSelected.InvokeAsync(Value);
|
||||
|
||||
StateHasChanged();
|
||||
};
|
||||
}
|
||||
|
|
|
@ -73,7 +73,7 @@
|
|||
</Select>
|
||||
</FormItem>
|
||||
<FormItem Label="Path">
|
||||
<FilePicker Root="@RootPath" EntrySelectable="x => x is FileManagerFile" @bind-Value="@context.Path" />
|
||||
<FilePicker Root="@RootPath" EntrySelectable="x => x is FileManagerFile" @bind-Value="@context.Path" OnSelected="OnPathSelected" />
|
||||
</FormItem>
|
||||
<FormItem Label="Arguments">
|
||||
<Input @bind-Value="@context.Arguments" />
|
||||
|
@ -193,6 +193,11 @@
|
|||
}
|
||||
}
|
||||
|
||||
private void OnPathSelected(string path)
|
||||
{
|
||||
Server.WorkingDirectory = Path.GetDirectoryName(path);
|
||||
}
|
||||
|
||||
private void NotifyServerAdded(object? sender, LocationChangedEventArgs e)
|
||||
{
|
||||
NavigationManager.LocationChanged -= NotifyServerAdded;
|
||||
|
|
Loading…
Reference in New Issue