bloxstrap/Bloxstrap/UI/ViewModels/ContextMenu/LogTracerViewModel.cs
2023-07-20 18:17:25 +01:00

31 lines
909 B
C#

using System.Windows;
using System.Windows.Input;
using CommunityToolkit.Mvvm.Input;
namespace Bloxstrap.UI.ViewModels.ContextMenu
{
internal class LogTracerViewModel : NotifyPropertyChangedViewModel
{
private readonly Window _window;
private readonly RobloxActivity _activityWatcher;
public ICommand CloseWindowCommand => new RelayCommand(_window.Close);
public string LogLocation => _activityWatcher.LogFilename;
public string LogContents { get; private set; } = "";
public LogTracerViewModel(Window window, RobloxActivity activityWatcher)
{
_window = window;
_activityWatcher = activityWatcher;
_activityWatcher.OnLogEntry += (_, message) =>
{
LogContents += message += "\r\n";
OnPropertyChanged(nameof(LogContents));
};
}
}
}