DataServices 现场调试OK

This commit is contained in:
2025-11-26 16:46:48 +08:00
parent 979afae645
commit 010272aa0b
31 changed files with 1866 additions and 267 deletions

View File

@@ -118,31 +118,7 @@ namespace FATrace.WPLApp.ViewModels
public DelegateCommand RefreshCommand { get; }
public DelegateCommand ClearLogsCommand { get; }
#endregion
private void StartLogTimer()
{
if (_logTimer != null) return;
_logTimer = new DispatcherTimer
{
Interval = TimeSpan.FromMilliseconds(500)
};
_logTimer.Tick += (s, e) =>
{
// 从 DataServices 的队列中取出消息并展示
int drain = 0;
while (_data.TryDequeueMessage(out var msg))
{
if (!string.IsNullOrWhiteSpace(msg))
{
AppendLiveMessage(msg);
drain++;
if (drain >= 50) break; // 防止一次处理过多
}
}
};
_logTimer.Start();
}
private void AppendLiveMessage(string message)
{
if (string.IsNullOrWhiteSpace(message)) return;