using InABox.Core; using InABox.Logging; using InABox.Wpf.Console; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Console = InABox.Wpf.Console.Console; namespace PRSDesktop; public class DesktopConsole : Console { private EventLogger? logger; public DesktopConsole(string description): base(description) { } protected override void OnLoaded() { base.OnLoaded(); ConsoleControl.Enabled = true; logger = new EventLogger(OnLog); MainLogger.AddLogger(logger); } private void OnLog(string message) { Dispatcher.BeginInvoke(() => { ConsoleControl.LoadLogEntry(message); }); } protected override void OnClosing() { base.OnClosing(); if(logger is not null) { MainLogger.RemoveLogger(logger); } } protected override string GetLogDirectory() { return CoreUtils.GetPath(); } }