使用新框架与技术代替旧框架与技术,实现涂装车间后道标签扫码程序

This commit is contained in:
2025-05-14 13:32:38 +08:00
parent 91cd88e285
commit 289e1e84ec
243 changed files with 4368 additions and 49365 deletions

View File

@@ -0,0 +1,46 @@
using System.Windows;
using System.Windows.Controls;
using RIZO_Application.Infrastructure.CustomAttribute;
using RIZO_Application.Modules.LogModule.ViewModels;
namespace RIZO_Application.Modules.LogModule.Views
{
[AutoRegisterView(ViewName = "SystemLog")]
/// <summary>
/// SystemLog.xaml 的交互逻辑
/// </summary>
public partial class SystemLog : UserControl
{
public SystemLog()
{
InitializeComponent();
Loaded += SystemLogView_Loaded;
}
private void SystemLogView_Loaded(object sender, RoutedEventArgs e)
{
var viewModel = (SystemLogViewModel)DataContext;
if (viewModel != null)
{
viewModel.LogUpdated += ViewModel_LogUpdated;
// 初始加载时滚动到底部
ScrollToBottom();
}
}
private void ViewModel_LogUpdated(object sender, EventArgs e)
{
// 日志更新时滚动到底部(使用 Dispatcher 确保 UI 已更新)
Dispatcher.Invoke(ScrollToBottom);
}
private void ScrollToBottom()
{
if (LogTextBox != null && LogTextBox.Text != null)
{
LogTextBox.CaretIndex = LogTextBox.Text.Length; // 将光标移到末尾
LogTextBox.ScrollToEnd(); // 滚动条滚动到最底部
}
}
}
}