添加项目文件。

This commit is contained in:
czj
2026-06-05 10:57:09 +08:00
parent f29671b374
commit d960cb5912
166 changed files with 15996 additions and 0 deletions

View File

@@ -0,0 +1,34 @@
using TestingModule.ViewModels;
using System.Windows.Controls;
namespace TestingModule.Views
{
public partial class LogArea : UserControl
{
public LogArea()
{
InitializeComponent();
// 绑定 DataContext 后,订阅日志集合变化
this.Loaded += (s, e) =>
{
if (DataContext is LogAreaViewModel vm)
{
vm.Logs.CollectionChanged += Logs_CollectionChanged;
}
};
}
private void Logs_CollectionChanged(object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e)
{
// 每次新增日志,滚动到最后一条
if (e.Action == System.Collections.Specialized.NotifyCollectionChangedAction.Add)
{
if (this.LogListView.Items.Count > 0)
{
this.LogListView.ScrollIntoView(this.LogListView.Items[^1]);
}
}
}
}
}