fixed source stack panel, added autoscroll to the log when adding an entry

This commit is contained in:
kitbyte
2025-03-21 23:53:24 +02:00
parent 4049ade4b1
commit 68cbbee275
4 changed files with 45 additions and 13 deletions
+8 -3
View File
@@ -17,6 +17,7 @@ namespace WeModPatcher.View.MainWindow
public class MainWindowVm : ObservableObject
{
private readonly MainWindow _view;
public ObservableCollection<LogEntry> LogList { get; } = new ObservableCollection<LogEntry>();
private string _weModPath;
@@ -153,6 +154,7 @@ namespace WeModPatcher.View.MainWindow
}
File.Copy(backupPath, Path.Combine(WeModPath, "resources", "app.asar"), true);
File.Delete(backupPath);
Log("Backup restored successfully.", ELogType.Success);
AlreadyPatched = false;
IsPatchEnabled = true;
@@ -181,16 +183,19 @@ namespace WeModPatcher.View.MainWindow
{
message = $"[{logType.ToString().ToUpper()}] {message}";
LogList.Add(new LogEntry
var entry = new LogEntry
{
LogType = logType,
Message = message
});
};
LogList.Add(entry);
_view.LogList.ScrollIntoView(entry);
});
}
public MainWindowVm()
public MainWindowVm(MainWindow view)
{
_view = view;
SetFolderPathCommand = new RelayCommand(OnFolderPathSelection);
ApplyPatchCommand = new RelayCommand(OnPatching);
RestoreBackupCommand = new RelayCommand(OnBackupRestoring);