diff --git a/src/ClaudeDo.Ui/ViewModels/Modals/WorkerConnectionModalViewModel.cs b/src/ClaudeDo.Ui/ViewModels/Modals/WorkerConnectionModalViewModel.cs new file mode 100644 index 0000000..dcc9b5a --- /dev/null +++ b/src/ClaudeDo.Ui/ViewModels/Modals/WorkerConnectionModalViewModel.cs @@ -0,0 +1,45 @@ +using System; +using System.Diagnostics; +using ClaudeDo.Ui.Services; +using CommunityToolkit.Mvvm.Input; + +namespace ClaudeDo.Ui.ViewModels.Modals; + +public sealed partial class WorkerConnectionModalViewModel : ViewModelBase +{ + private readonly WorkerLocator _workerLocator; + private readonly InstallerLocator _installerLocator; + + public WorkerConnectionModalViewModel(WorkerLocator workerLocator, InstallerLocator installerLocator) + { + _workerLocator = workerLocator; + _installerLocator = installerLocator; + } + + public Action? CloseAction { get; set; } + + [RelayCommand] private void Close() => CloseAction?.Invoke(); + + [RelayCommand] + private void StartWorker() + { + var exe = _workerLocator.Find(); + if (exe is null) return; + try { Process.Start(new ProcessStartInfo(exe) { UseShellExecute = true }); } + catch { /* nothing useful to show */ } + CloseAction?.Invoke(); + } + + [RelayCommand] + private void RerunInstaller() + { + var path = _installerLocator.Find(); + if (path is null) return; + try + { + Process.Start(new ProcessStartInfo(path) { UseShellExecute = true }); + Environment.Exit(0); + } + catch { /* nothing useful to show */ } + } +} diff --git a/src/ClaudeDo.Ui/Views/Modals/WorkerConnectionModalView.axaml b/src/ClaudeDo.Ui/Views/Modals/WorkerConnectionModalView.axaml new file mode 100644 index 0000000..fd0424b --- /dev/null +++ b/src/ClaudeDo.Ui/Views/Modals/WorkerConnectionModalView.axaml @@ -0,0 +1,29 @@ + + + + + + + + + +