using System.Windows.Controls;
using System.Windows.Media;

using CamBooth.App.Core.Logging;

namespace CamBooth.App.Features.DebugConsole;

public partial class DebugConsolePage : Page
{
	public DebugConsolePage(Logger logger)
	{
		logger.InfoLog += this.Logger_OnInfoLog;
		logger.ErrorLog += this.Logger_OnErrorLog;
		this.InitializeComponent();
	}

	private void Logger_OnErrorLog(string text)
	{
		this.tbDebugOutput.Text = this.tbDebugOutput.Text.Insert(0, text + "\n");
		this.tbDebugOutput.Background = new SolidColorBrush(Colors.Tomato);
	}


	private void Logger_OnInfoLog(string text)
	{
		this.tbDebugOutput.Text = this.tbDebugOutput.Text.Insert(0, text + "\n");
	}
}