using System; using System.Threading.Tasks; using eSuite.WorkBench.Services; using eSuite.WorkBench.WpfHelper; namespace eSuite.WorkBench.Commands; public class LaunchHealthzCommand : AsyncCommandBase { private readonly MainWindowViewModel _mainWindowViewModel; private readonly ICommandsService _commandService; public LaunchHealthzCommand( MainWindowViewModel mainWindowViewModel, ICommandsService commandsService, Action onException, EventHandler addFeedbackMessage ) : base(onException) { FeedbackMessage += addFeedbackMessage; _mainWindowViewModel = mainWindowViewModel; _commandService = commandsService; IsEnabled = true; } protected override async Task ExecuteAsync(object parameter) { try { DoFeedbackMessage("Starting HealthZ"); await _commandService.LaunchHealthZ(); } catch (Exception ex) { DoFeedbackMessage(ex.Message); } finally { DoFeedbackMessage("...finished"); } } }