mirror of
https://github.com/danbulant/Cosmos
synced 2026-05-19 12:30:32 +00:00
42 lines
1.2 KiB
C#
42 lines
1.2 KiB
C#
using System;
|
|
using System.ComponentModel;
|
|
using System.Threading;
|
|
|
|
using Cosmos.TestRunner.Core;
|
|
|
|
namespace Cosmos.TestRunner.UI.ViewModels
|
|
{
|
|
internal class MainWindowViewModel : INotifyPropertyChanged
|
|
{
|
|
public event PropertyChangedEventHandler PropertyChanged;
|
|
|
|
public MainWindowViewModel(IEngineConfiguration aEngineConfiguration)
|
|
{
|
|
var xEngine = new Engine(aEngineConfiguration)
|
|
{
|
|
OutputHandler = new OutputHandler(
|
|
m =>
|
|
{
|
|
TestRunnerLog += m + Environment.NewLine;
|
|
OnPropertyChanged(nameof(TestRunnerLog));
|
|
})
|
|
};
|
|
|
|
new Thread(() => xEngine.Execute()).Start();
|
|
}
|
|
|
|
public string TestRunnerLog { get; set; }
|
|
|
|
private void OnPropertyChanged(string aPropertyName) =>
|
|
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(aPropertyName));
|
|
|
|
internal class OutputHandler : OutputHandlerFullTextBase
|
|
{
|
|
private Action<string> mLog;
|
|
|
|
public OutputHandler(Action<string> aLog) => mLog = aLog;
|
|
|
|
protected override void Log(string message) => mLog(message);
|
|
}
|
|
}
|
|
}
|