worker prints start success but no attachment yet
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -12,9 +12,6 @@ namespace UnifiedFarmLauncher.Models
|
|||||||
|
|
||||||
public class FlamencoConfig
|
public class FlamencoConfig
|
||||||
{
|
{
|
||||||
[JsonPropertyName("workerPath")]
|
|
||||||
public string WorkerPath { get; set; } = string.Empty;
|
|
||||||
|
|
||||||
[JsonPropertyName("networkDrives")]
|
[JsonPropertyName("networkDrives")]
|
||||||
public List<string> NetworkDrives { get; set; } = new();
|
public List<string> NetworkDrives { get; set; } = new();
|
||||||
|
|
||||||
|
|||||||
@@ -197,12 +197,15 @@ namespace UnifiedFarmLauncher.Services
|
|||||||
var sshArgs = BuildSshArgs(parts, interactive);
|
var sshArgs = BuildSshArgs(parts, interactive);
|
||||||
sshArgs.Add(command);
|
sshArgs.Add(command);
|
||||||
|
|
||||||
|
var argsString = string.Join(" ", sshArgs.Select(arg => $"\"{arg.Replace("\"", "\\\"")}\""));
|
||||||
|
|
||||||
var process = new Process
|
var process = new Process
|
||||||
{
|
{
|
||||||
StartInfo = new ProcessStartInfo
|
StartInfo = new ProcessStartInfo
|
||||||
{
|
{
|
||||||
FileName = GetSshExecutable(),
|
FileName = GetSshExecutable(),
|
||||||
Arguments = string.Join(" ", sshArgs.Select(arg => $"\"{arg.Replace("\"", "\\\"")}\"")),
|
WorkingDirectory = Environment.GetFolderPath(Environment.SpecialFolder.UserProfile),
|
||||||
|
Arguments = argsString,
|
||||||
UseShellExecute = false,
|
UseShellExecute = false,
|
||||||
RedirectStandardOutput = true,
|
RedirectStandardOutput = true,
|
||||||
RedirectStandardError = true,
|
RedirectStandardError = true,
|
||||||
@@ -230,6 +233,54 @@ namespace UnifiedFarmLauncher.Services
|
|||||||
return output.ToString();
|
return output.ToString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public async Task<string> ExecuteRemoteScriptAsync(WorkerConfig worker, string script, bool interactive = false)
|
||||||
|
{
|
||||||
|
var parts = ParseConnectionParts(worker.Ssh.Args, worker.Ssh.Host);
|
||||||
|
var sshArgs = BuildSshArgs(parts, interactive);
|
||||||
|
// Add PowerShell command as a single quoted argument for remote execution
|
||||||
|
sshArgs.Add("powershell -NoLogo -NoProfile -NonInteractive -OutputFormat Text -ExecutionPolicy Bypass -Command -");
|
||||||
|
|
||||||
|
var argsString = string.Join(" ", sshArgs.Select(arg => $"\"{arg.Replace("\"", "\\\"")}\""));
|
||||||
|
|
||||||
|
var process = new Process
|
||||||
|
{
|
||||||
|
StartInfo = new ProcessStartInfo
|
||||||
|
{
|
||||||
|
FileName = GetSshExecutable(),
|
||||||
|
WorkingDirectory = Environment.GetFolderPath(Environment.SpecialFolder.UserProfile),
|
||||||
|
Arguments = argsString,
|
||||||
|
UseShellExecute = false,
|
||||||
|
RedirectStandardInput = true,
|
||||||
|
RedirectStandardOutput = true,
|
||||||
|
RedirectStandardError = true,
|
||||||
|
CreateNoWindow = !interactive
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
var output = new StringBuilder();
|
||||||
|
var error = new StringBuilder();
|
||||||
|
|
||||||
|
process.OutputDataReceived += (s, e) => { if (e.Data != null) output.AppendLine(e.Data); };
|
||||||
|
process.ErrorDataReceived += (s, e) => { if (e.Data != null) error.AppendLine(e.Data); };
|
||||||
|
|
||||||
|
process.Start();
|
||||||
|
process.BeginOutputReadLine();
|
||||||
|
process.BeginErrorReadLine();
|
||||||
|
|
||||||
|
// Write script to stdin
|
||||||
|
await process.StandardInput.WriteAsync(script);
|
||||||
|
process.StandardInput.Close();
|
||||||
|
|
||||||
|
await process.WaitForExitAsync();
|
||||||
|
|
||||||
|
if (process.ExitCode != 0 && !interactive)
|
||||||
|
{
|
||||||
|
throw new InvalidOperationException($"SSH script execution failed with exit code {process.ExitCode}: {error}");
|
||||||
|
}
|
||||||
|
|
||||||
|
return output.ToString();
|
||||||
|
}
|
||||||
|
|
||||||
public async Task<string> GetWorkerBasePathAsync(WorkerConfig worker)
|
public async Task<string> GetWorkerBasePathAsync(WorkerConfig worker)
|
||||||
{
|
{
|
||||||
if (_workerBasePathCache.TryGetValue(worker.Name, out var cached))
|
if (_workerBasePathCache.TryGetValue(worker.Name, out var cached))
|
||||||
|
|||||||
@@ -65,7 +65,7 @@ $controllerPath = Join-Path $dataRoot 'controller.ps1'
|
|||||||
[IO.File]::WriteAllBytes($controllerPath, [Convert]::FromBase64String('{controllerBase64}'))
|
[IO.File]::WriteAllBytes($controllerPath, [Convert]::FromBase64String('{controllerBase64}'))
|
||||||
";
|
";
|
||||||
|
|
||||||
await _sshService.ExecuteRemoteCommandAsync(worker, $"powershell -NoLogo -NoProfile -NonInteractive -OutputFormat Text -ExecutionPolicy Bypass -EncodedCommand {Convert.ToBase64String(Encoding.Unicode.GetBytes(script))}");
|
await _sshService.ExecuteRemoteScriptAsync(worker, script);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task DeployAttachHelperAsync(WorkerConfig worker)
|
public async Task DeployAttachHelperAsync(WorkerConfig worker)
|
||||||
@@ -79,7 +79,7 @@ $attachPath = Join-Path $dataRoot 'attach-helper.ps1'
|
|||||||
[IO.File]::WriteAllBytes($attachPath, [Convert]::FromBase64String('{helperBase64}'))
|
[IO.File]::WriteAllBytes($attachPath, [Convert]::FromBase64String('{helperBase64}'))
|
||||||
";
|
";
|
||||||
|
|
||||||
await _sshService.ExecuteRemoteCommandAsync(worker, $"powershell -NoLogo -NoProfile -NonInteractive -OutputFormat Text -ExecutionPolicy Bypass -EncodedCommand {Convert.ToBase64String(Encoding.Unicode.GetBytes(script))}");
|
await _sshService.ExecuteRemoteScriptAsync(worker, script);
|
||||||
}
|
}
|
||||||
|
|
||||||
public string GenerateSheepItPayload(WorkerConfig worker)
|
public string GenerateSheepItPayload(WorkerConfig worker)
|
||||||
@@ -171,7 +171,10 @@ catch {{
|
|||||||
if (worker.WorkerTypes.Flamenco == null)
|
if (worker.WorkerTypes.Flamenco == null)
|
||||||
throw new InvalidOperationException("Worker does not have Flamenco configuration");
|
throw new InvalidOperationException("Worker does not have Flamenco configuration");
|
||||||
|
|
||||||
|
var config = _configService.Load();
|
||||||
var flamenco = worker.WorkerTypes.Flamenco;
|
var flamenco = worker.WorkerTypes.Flamenco;
|
||||||
|
var globalSettings = config.GlobalSettings;
|
||||||
|
var workerPath = globalSettings.FlamencoWorkerPath.Replace("'", "''");
|
||||||
var drives = string.Join(", ", Array.ConvertAll(flamenco.NetworkDrives.ToArray(), d => $"'{d}'"));
|
var drives = string.Join(", ", Array.ConvertAll(flamenco.NetworkDrives.ToArray(), d => $"'{d}'"));
|
||||||
var paths = string.Join(", ", Array.ConvertAll(flamenco.NetworkPaths.ToArray(), p => $"'{p.Replace("\\", "\\\\")}'"));
|
var paths = string.Join(", ", Array.ConvertAll(flamenco.NetworkPaths.ToArray(), p => $"'{p.Replace("\\", "\\\\")}'"));
|
||||||
|
|
||||||
@@ -200,7 +203,7 @@ try {{
|
|||||||
|
|
||||||
# Start worker
|
# Start worker
|
||||||
Write-Host ""Starting Flamenco worker..."" -ForegroundColor Cyan
|
Write-Host ""Starting Flamenco worker..."" -ForegroundColor Cyan
|
||||||
Set-Location '{flamenco.WorkerPath}'
|
Set-Location '{workerPath}'
|
||||||
if (Test-Path 'flamenco-worker.exe') {{
|
if (Test-Path 'flamenco-worker.exe') {{
|
||||||
Write-Host ""Running flamenco-worker.exe..."" -ForegroundColor Green
|
Write-Host ""Running flamenco-worker.exe..."" -ForegroundColor Green
|
||||||
$workerProcess = Start-Process -FilePath '.\flamenco-worker.exe' -NoNewWindow -PassThru -Wait
|
$workerProcess = Start-Process -FilePath '.\flamenco-worker.exe' -NoNewWindow -PassThru -Wait
|
||||||
@@ -208,8 +211,8 @@ try {{
|
|||||||
Write-Host ""Flamenco worker process has terminated with exit code: $exitCode"" -ForegroundColor Yellow
|
Write-Host ""Flamenco worker process has terminated with exit code: $exitCode"" -ForegroundColor Yellow
|
||||||
exit $exitCode
|
exit $exitCode
|
||||||
}} else {{
|
}} else {{
|
||||||
Write-Host ""Error: flamenco-worker.exe not found in {flamenco.WorkerPath}"" -ForegroundColor Red
|
Write-Host ""Error: flamenco-worker.exe not found in {workerPath}"" -ForegroundColor Red
|
||||||
[Console]::Error.WriteLine(""Error: flamenco-worker.exe not found in {flamenco.WorkerPath}"")
|
[Console]::Error.WriteLine(""Error: flamenco-worker.exe not found in {workerPath}"")
|
||||||
exit 1
|
exit 1
|
||||||
}}
|
}}
|
||||||
}}
|
}}
|
||||||
@@ -327,7 +330,8 @@ if ($shouldStart) {{
|
|||||||
}}
|
}}
|
||||||
";
|
";
|
||||||
|
|
||||||
await _sshService.ExecuteRemoteCommandAsync(worker, $"powershell -NoLogo -NoProfile -NonInteractive -OutputFormat Text -ExecutionPolicy Bypass -EncodedCommand {Convert.ToBase64String(Encoding.Unicode.GetBytes(ensureScript))}");
|
// Pipe script through stdin to avoid command line length limits
|
||||||
|
await _sshService.ExecuteRemoteScriptAsync(worker, ensureScript);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task StopWorkerAsync(WorkerConfig worker, string workerType)
|
public async Task StopWorkerAsync(WorkerConfig worker, string workerType)
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ namespace UnifiedFarmLauncher.ViewModels
|
|||||||
private string _sheepItUsername = string.Empty;
|
private string _sheepItUsername = string.Empty;
|
||||||
private string _sheepItRenderKey = string.Empty;
|
private string _sheepItRenderKey = string.Empty;
|
||||||
private bool _isRenderKeyVisible = false;
|
private bool _isRenderKeyVisible = false;
|
||||||
|
private string _flamencoWorkerPath = string.Empty;
|
||||||
|
|
||||||
public GlobalSettingsViewModel(ConfigService configService)
|
public GlobalSettingsViewModel(ConfigService configService)
|
||||||
{
|
{
|
||||||
@@ -34,11 +35,18 @@ namespace UnifiedFarmLauncher.ViewModels
|
|||||||
set => SetAndRaise(ref _isRenderKeyVisible, value);
|
set => SetAndRaise(ref _isRenderKeyVisible, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public string FlamencoWorkerPath
|
||||||
|
{
|
||||||
|
get => _flamencoWorkerPath;
|
||||||
|
set => SetAndRaise(ref _flamencoWorkerPath, value);
|
||||||
|
}
|
||||||
|
|
||||||
private void LoadSettings()
|
private void LoadSettings()
|
||||||
{
|
{
|
||||||
var config = _configService.Load();
|
var config = _configService.Load();
|
||||||
SheepItUsername = config.GlobalSettings.SheepItUsername;
|
SheepItUsername = config.GlobalSettings.SheepItUsername;
|
||||||
SheepItRenderKey = config.GlobalSettings.SheepItRenderKey;
|
SheepItRenderKey = config.GlobalSettings.SheepItRenderKey;
|
||||||
|
FlamencoWorkerPath = config.GlobalSettings.FlamencoWorkerPath;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Save()
|
public void Save()
|
||||||
@@ -46,6 +54,7 @@ namespace UnifiedFarmLauncher.ViewModels
|
|||||||
var config = _configService.Load();
|
var config = _configService.Load();
|
||||||
config.GlobalSettings.SheepItUsername = SheepItUsername;
|
config.GlobalSettings.SheepItUsername = SheepItUsername;
|
||||||
config.GlobalSettings.SheepItRenderKey = SheepItRenderKey;
|
config.GlobalSettings.SheepItRenderKey = SheepItRenderKey;
|
||||||
|
config.GlobalSettings.FlamencoWorkerPath = FlamencoWorkerPath;
|
||||||
_configService.Save(config);
|
_configService.Save(config);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,7 +16,6 @@ namespace UnifiedFarmLauncher.ViewModels
|
|||||||
private int _sshPort = 22;
|
private int _sshPort = 22;
|
||||||
private string _sshArgs = string.Empty;
|
private string _sshArgs = string.Empty;
|
||||||
private string _sheepItGpu = "OPTIX_0";
|
private string _sheepItGpu = "OPTIX_0";
|
||||||
private string _flamencoWorkerPath = string.Empty;
|
|
||||||
private bool _hasSheepIt;
|
private bool _hasSheepIt;
|
||||||
private bool _hasFlamenco;
|
private bool _hasFlamenco;
|
||||||
|
|
||||||
@@ -91,12 +90,6 @@ namespace UnifiedFarmLauncher.ViewModels
|
|||||||
set => SetAndRaise(ref _sheepItGpu, value);
|
set => SetAndRaise(ref _sheepItGpu, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
public string FlamencoWorkerPath
|
|
||||||
{
|
|
||||||
get => _flamencoWorkerPath;
|
|
||||||
set => SetAndRaise(ref _flamencoWorkerPath, value);
|
|
||||||
}
|
|
||||||
|
|
||||||
public ObservableCollection<string> NetworkDrives { get; }
|
public ObservableCollection<string> NetworkDrives { get; }
|
||||||
public ObservableCollection<string> NetworkPaths { get; }
|
public ObservableCollection<string> NetworkPaths { get; }
|
||||||
|
|
||||||
@@ -118,7 +111,6 @@ namespace UnifiedFarmLauncher.ViewModels
|
|||||||
if (worker.WorkerTypes.Flamenco != null)
|
if (worker.WorkerTypes.Flamenco != null)
|
||||||
{
|
{
|
||||||
HasFlamenco = true;
|
HasFlamenco = true;
|
||||||
FlamencoWorkerPath = worker.WorkerTypes.Flamenco.WorkerPath;
|
|
||||||
NetworkDrives.Clear();
|
NetworkDrives.Clear();
|
||||||
foreach (var drive in worker.WorkerTypes.Flamenco.NetworkDrives)
|
foreach (var drive in worker.WorkerTypes.Flamenco.NetworkDrives)
|
||||||
{
|
{
|
||||||
@@ -160,7 +152,6 @@ namespace UnifiedFarmLauncher.ViewModels
|
|||||||
{
|
{
|
||||||
worker.WorkerTypes.Flamenco = new FlamencoConfig
|
worker.WorkerTypes.Flamenco = new FlamencoConfig
|
||||||
{
|
{
|
||||||
WorkerPath = FlamencoWorkerPath,
|
|
||||||
NetworkDrives = NetworkDrives.ToList(),
|
NetworkDrives = NetworkDrives.ToList(),
|
||||||
NetworkPaths = NetworkPaths.ToList()
|
NetworkPaths = NetworkPaths.ToList()
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -4,8 +4,8 @@
|
|||||||
x:Class="UnifiedFarmLauncher.Views.GlobalSettingsWindow"
|
x:Class="UnifiedFarmLauncher.Views.GlobalSettingsWindow"
|
||||||
x:DataType="vm:GlobalSettingsViewModel"
|
x:DataType="vm:GlobalSettingsViewModel"
|
||||||
Title="Global Settings"
|
Title="Global Settings"
|
||||||
Width="500" Height="300"
|
Width="500" Height="350"
|
||||||
MinWidth="400" MinHeight="250">
|
MinWidth="400" MinHeight="300">
|
||||||
<Grid RowDefinitions="Auto,*,Auto" Margin="10">
|
<Grid RowDefinitions="Auto,*,Auto" Margin="10">
|
||||||
<!-- Settings Content -->
|
<!-- Settings Content -->
|
||||||
<TabControl Grid.Row="1" Margin="0,10">
|
<TabControl Grid.Row="1" Margin="0,10">
|
||||||
@@ -29,6 +29,21 @@
|
|||||||
</Grid>
|
</Grid>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</TabItem>
|
</TabItem>
|
||||||
|
<TabItem Header="Flamenco">
|
||||||
|
<StackPanel Margin="10" Spacing="10">
|
||||||
|
<TextBlock Text="Worker Path:"/>
|
||||||
|
<Grid ColumnDefinitions="*,Auto">
|
||||||
|
<TextBox Name="FlamencoWorkerPathTextBox"
|
||||||
|
Grid.Column="0"
|
||||||
|
Text="{Binding FlamencoWorkerPath}"
|
||||||
|
Margin="0,0,5,0"/>
|
||||||
|
<Button Name="BrowseFlamencoPathButton"
|
||||||
|
Grid.Column="1"
|
||||||
|
Content="Browse..."
|
||||||
|
Width="80"/>
|
||||||
|
</Grid>
|
||||||
|
</StackPanel>
|
||||||
|
</TabItem>
|
||||||
</TabControl>
|
</TabControl>
|
||||||
|
|
||||||
<!-- Buttons -->
|
<!-- Buttons -->
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Avalonia.Controls;
|
using Avalonia.Controls;
|
||||||
using Avalonia.Interactivity;
|
using Avalonia.Interactivity;
|
||||||
|
using Avalonia.Platform.Storage;
|
||||||
using UnifiedFarmLauncher.Services;
|
using UnifiedFarmLauncher.Services;
|
||||||
using UnifiedFarmLauncher.ViewModels;
|
using UnifiedFarmLauncher.ViewModels;
|
||||||
|
|
||||||
@@ -30,6 +31,7 @@ namespace UnifiedFarmLauncher.Views
|
|||||||
this.FindControl<Button>("OkButton")!.Click += OkButton_Click;
|
this.FindControl<Button>("OkButton")!.Click += OkButton_Click;
|
||||||
this.FindControl<Button>("CancelButton")!.Click += CancelButton_Click;
|
this.FindControl<Button>("CancelButton")!.Click += CancelButton_Click;
|
||||||
this.FindControl<Button>("ToggleRenderKeyButton")!.Click += ToggleRenderKeyButton_Click;
|
this.FindControl<Button>("ToggleRenderKeyButton")!.Click += ToggleRenderKeyButton_Click;
|
||||||
|
this.FindControl<Button>("BrowseFlamencoPathButton")!.Click += BrowseFlamencoPathButton_Click;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OkButton_Click(object? sender, RoutedEventArgs e)
|
private void OkButton_Click(object? sender, RoutedEventArgs e)
|
||||||
@@ -68,6 +70,23 @@ namespace UnifiedFarmLauncher.Views
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private async void BrowseFlamencoPathButton_Click(object? sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
var topLevel = TopLevel.GetTopLevel(this);
|
||||||
|
if (topLevel?.StorageProvider.CanPickFolder == true)
|
||||||
|
{
|
||||||
|
var folders = await topLevel.StorageProvider.OpenFolderPickerAsync(new FolderPickerOpenOptions
|
||||||
|
{
|
||||||
|
Title = "Select Flamenco Worker Path"
|
||||||
|
});
|
||||||
|
|
||||||
|
if (folders.Count > 0 && folders[0].TryGetLocalPath() is { } localPath)
|
||||||
|
{
|
||||||
|
_viewModel.FlamencoWorkerPath = localPath;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public async Task<bool> ShowDialogAsync(Window parent)
|
public async Task<bool> ShowDialogAsync(Window parent)
|
||||||
{
|
{
|
||||||
await base.ShowDialog(parent);
|
await base.ShowDialog(parent);
|
||||||
|
|||||||
@@ -55,13 +55,13 @@
|
|||||||
<StackPanel Margin="10" Spacing="10">
|
<StackPanel Margin="10" Spacing="10">
|
||||||
<CheckBox Name="HasFlamencoCheckBox" Content="Enable Flamenco Worker" IsChecked="{Binding HasFlamenco}" Margin="0,0,0,10"/>
|
<CheckBox Name="HasFlamencoCheckBox" Content="Enable Flamenco Worker" IsChecked="{Binding HasFlamenco}" Margin="0,0,0,10"/>
|
||||||
|
|
||||||
<TextBlock Text="Worker Path:" IsVisible="{Binding HasFlamenco}"/>
|
<TextBlock Text="Note: Worker Path is configured in Global Settings."
|
||||||
<Grid IsVisible="{Binding HasFlamenco}" ColumnDefinitions="*,Auto">
|
IsVisible="{Binding HasFlamenco}"
|
||||||
<TextBox Name="FlamencoPathTextBox" Grid.Column="0" Text="{Binding FlamencoWorkerPath}" Margin="0,0,5,0"/>
|
Margin="0,0,0,10"
|
||||||
<Button Name="BrowseFlamencoPathButton" Grid.Column="1" Content="Browse..." Width="80"/>
|
Foreground="Gray"
|
||||||
</Grid>
|
TextWrapping="Wrap"/>
|
||||||
|
|
||||||
<TextBlock Text="Network Drives:" IsVisible="{Binding HasFlamenco}" Margin="0,10,0,0"/>
|
<TextBlock Text="Network Drives:" IsVisible="{Binding HasFlamenco}"/>
|
||||||
<Grid IsVisible="{Binding HasFlamenco}" RowDefinitions="*,Auto" Margin="0,5,0,0">
|
<Grid IsVisible="{Binding HasFlamenco}" RowDefinitions="*,Auto" Margin="0,5,0,0">
|
||||||
<ListBox Name="NetworkDrivesListBox" Grid.Row="0" ItemsSource="{Binding NetworkDrives}" MaxHeight="100"/>
|
<ListBox Name="NetworkDrivesListBox" Grid.Row="0" ItemsSource="{Binding NetworkDrives}" MaxHeight="100"/>
|
||||||
<StackPanel Grid.Row="1" Orientation="Horizontal" Margin="0,5,0,0">
|
<StackPanel Grid.Row="1" Orientation="Horizontal" Margin="0,5,0,0">
|
||||||
|
|||||||
@@ -39,7 +39,6 @@ namespace UnifiedFarmLauncher.Views
|
|||||||
{
|
{
|
||||||
this.FindControl<Button>("OkButton")!.Click += OkButton_Click;
|
this.FindControl<Button>("OkButton")!.Click += OkButton_Click;
|
||||||
this.FindControl<Button>("CancelButton")!.Click += CancelButton_Click;
|
this.FindControl<Button>("CancelButton")!.Click += CancelButton_Click;
|
||||||
this.FindControl<Button>("BrowseFlamencoPathButton")!.Click += BrowseFlamencoPathButton_Click;
|
|
||||||
this.FindControl<Button>("AddDriveButton")!.Click += AddDriveButton_Click;
|
this.FindControl<Button>("AddDriveButton")!.Click += AddDriveButton_Click;
|
||||||
this.FindControl<Button>("RemoveDriveButton")!.Click += RemoveDriveButton_Click;
|
this.FindControl<Button>("RemoveDriveButton")!.Click += RemoveDriveButton_Click;
|
||||||
this.FindControl<Button>("AddPathButton")!.Click += AddPathButton_Click;
|
this.FindControl<Button>("AddPathButton")!.Click += AddPathButton_Click;
|
||||||
@@ -78,23 +77,6 @@ namespace UnifiedFarmLauncher.Views
|
|||||||
Close();
|
Close();
|
||||||
}
|
}
|
||||||
|
|
||||||
private async void BrowseFlamencoPathButton_Click(object? sender, RoutedEventArgs e)
|
|
||||||
{
|
|
||||||
var topLevel = TopLevel.GetTopLevel(this);
|
|
||||||
if (topLevel?.StorageProvider.CanPickFolder == true)
|
|
||||||
{
|
|
||||||
var folders = await topLevel.StorageProvider.OpenFolderPickerAsync(new FolderPickerOpenOptions
|
|
||||||
{
|
|
||||||
Title = "Select Flamenco Worker Path"
|
|
||||||
});
|
|
||||||
|
|
||||||
if (folders.Count > 0 && folders[0].TryGetLocalPath() is { } localPath)
|
|
||||||
{
|
|
||||||
_viewModel.FlamencoWorkerPath = localPath;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void AddDriveButton_Click(object? sender, RoutedEventArgs e)
|
private void AddDriveButton_Click(object? sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
// Simplified: use a simple input box
|
// Simplified: use a simple input box
|
||||||
|
|||||||
Reference in New Issue
Block a user