mirror of
https://github.com/danbulant/Cosmos
synced 2026-05-19 20:39:01 +00:00
- Added check for dependencies, which can be installed from the builder. - Replaced CosmosTask with CosmosBuildDefinition, which is much simpler. - The builder can be opened without any command line arguments. - If the VS path is not specified as a command line argument, it can be selected in a dialog.
44 lines
1.3 KiB
C#
44 lines
1.3 KiB
C#
using System;
|
|
using System.Windows;
|
|
|
|
using Cosmos.Build.Builder.Models;
|
|
|
|
namespace Cosmos.Build.Builder.ViewModels
|
|
{
|
|
internal class MainWindowLogger : ILogger
|
|
{
|
|
private static readonly string[] NewLineStringArray = new string[] { Environment.NewLine };
|
|
|
|
private MainWindowViewModel _viewModel;
|
|
|
|
public MainWindowLogger(MainWindowViewModel viewModel)
|
|
{
|
|
_viewModel = viewModel;
|
|
}
|
|
|
|
public void LogMessage(string text) => Application.Current.Dispatcher.Invoke(
|
|
() =>
|
|
{
|
|
_viewModel.CurrentSection.LogMessage(text);
|
|
|
|
foreach (var line in text.Split(NewLineStringArray, StringSplitOptions.None))
|
|
{
|
|
_viewModel.TailItems.Push(line);
|
|
}
|
|
});
|
|
|
|
public void NewSection(string name) => Application.Current.Dispatcher.Invoke(
|
|
() =>
|
|
{
|
|
_viewModel.Sections.Add(new Section(name));
|
|
_viewModel.TailItems.Clear();
|
|
});
|
|
|
|
public void SetError() => Application.Current.Dispatcher.Invoke(
|
|
() =>
|
|
{
|
|
_viewModel.CurrentSection.SetError();
|
|
_viewModel.CloseWhenCompleted = false;
|
|
});
|
|
}
|
|
}
|