Auto populate server working directory based on executable path
This commit is contained in:
parent
d869a5a763
commit
9a55dac778
2 changed files with 10 additions and 1 deletions
|
@ -24,6 +24,7 @@
|
||||||
@code {
|
@code {
|
||||||
[Parameter] public string Value { get; set; }
|
[Parameter] public string Value { get; set; }
|
||||||
[Parameter] public EventCallback<string> ValueChanged { get; set; }
|
[Parameter] public EventCallback<string> ValueChanged { get; set; }
|
||||||
|
[Parameter] public EventCallback<string> OnSelected { get; set; }
|
||||||
[Parameter] public Guid ArchiveId { get; set; }
|
[Parameter] public Guid ArchiveId { get; set; }
|
||||||
[Parameter] public string Title { get; set; } = "Choose File";
|
[Parameter] public string Title { get; set; } = "Choose File";
|
||||||
[Parameter] public string OkText { get; set; } = "Select File";
|
[Parameter] public string OkText { get; set; } = "Select File";
|
||||||
|
@ -75,6 +76,9 @@
|
||||||
if (ValueChanged.HasDelegate)
|
if (ValueChanged.HasDelegate)
|
||||||
await ValueChanged.InvokeAsync(Value);
|
await ValueChanged.InvokeAsync(Value);
|
||||||
|
|
||||||
|
if (OnSelected.HasDelegate)
|
||||||
|
await OnSelected.InvokeAsync(Value);
|
||||||
|
|
||||||
StateHasChanged();
|
StateHasChanged();
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -73,7 +73,7 @@
|
||||||
</Select>
|
</Select>
|
||||||
</FormItem>
|
</FormItem>
|
||||||
<FormItem Label="Path">
|
<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>
|
||||||
<FormItem Label="Arguments">
|
<FormItem Label="Arguments">
|
||||||
<Input @bind-Value="@context.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)
|
private void NotifyServerAdded(object? sender, LocationChangedEventArgs e)
|
||||||
{
|
{
|
||||||
NavigationManager.LocationChanged -= NotifyServerAdded;
|
NavigationManager.LocationChanged -= NotifyServerAdded;
|
||||||
|
|
Loading…
Add table
Reference in a new issue