38 lines
1.1 KiB
C#
38 lines
1.1 KiB
C#
using System;
|
|
using System.Threading.Tasks;
|
|
using eSuite.WorkBench.Services;
|
|
using eSuite.WorkBench.WpfHelper;
|
|
|
|
namespace eSuite.WorkBench.Commands;
|
|
|
|
public class LaunchWebUiCommand : AsyncCommandBase
|
|
{
|
|
private readonly MainWindowViewModel _mainWindowViewModel;
|
|
private readonly ICommandsService _commandService;
|
|
|
|
public LaunchWebUiCommand(MainWindowViewModel mainWindowViewModel, ICommandsService commandsService, Action<Exception> onException, EventHandler<FeedbackEventArgs> addFeedbackMessage) : base(onException)
|
|
{
|
|
FeedbackMessage += addFeedbackMessage;
|
|
_mainWindowViewModel = mainWindowViewModel;
|
|
_commandService = commandsService;
|
|
IsEnabled = true;
|
|
}
|
|
|
|
protected override async Task ExecuteAsync(object parameter)
|
|
{
|
|
try
|
|
{
|
|
DoFeedbackMessage("Starting WebUi");
|
|
|
|
await _commandService.LaunchWebUi();
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
DoFeedbackMessage(ex.Message);
|
|
}
|
|
finally
|
|
{
|
|
DoFeedbackMessage("...finished");
|
|
}
|
|
}
|
|
} |