fix add worker closing whole program

This commit is contained in:
Nathan
2025-12-17 16:17:27 -07:00
parent 9436ab7f62
commit 03b3ae58f4
2 changed files with 560 additions and 9 deletions

View File

@@ -37,13 +37,13 @@ namespace UnifiedFarmLauncher.Views
private void SetupEventHandlers()
{
OkButton.Click += OkButton_Click;
CancelButton.Click += CancelButton_Click;
BrowseFlamencoPathButton.Click += BrowseFlamencoPathButton_Click;
AddDriveButton.Click += AddDriveButton_Click;
RemoveDriveButton.Click += RemoveDriveButton_Click;
AddPathButton.Click += AddPathButton_Click;
RemovePathButton.Click += RemovePathButton_Click;
this.FindControl<Button>("OkButton")!.Click += OkButton_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>("RemoveDriveButton")!.Click += RemoveDriveButton_Click;
this.FindControl<Button>("AddPathButton")!.Click += AddPathButton_Click;
this.FindControl<Button>("RemovePathButton")!.Click += RemovePathButton_Click;
}
private async void OkButton_Click(object? sender, RoutedEventArgs e)
@@ -104,7 +104,7 @@ namespace UnifiedFarmLauncher.Views
private void RemoveDriveButton_Click(object? sender, RoutedEventArgs e)
{
if (NetworkDrivesListBox.SelectedItem is string drive)
if (this.FindControl<ListBox>("NetworkDrivesListBox")?.SelectedItem is string drive)
{
_viewModel.NetworkDrives.Remove(drive);
}
@@ -119,7 +119,7 @@ namespace UnifiedFarmLauncher.Views
private void RemovePathButton_Click(object? sender, RoutedEventArgs e)
{
if (NetworkPathsListBox.SelectedItem is string path)
if (this.FindControl<ListBox>("NetworkPathsListBox")?.SelectedItem is string path)
{
_viewModel.NetworkPaths.Remove(path);
}