DataServices 现场调试OK
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user