From 559890c482f5973f06aafdfec9550fee5ba3c7f2 Mon Sep 17 00:00:00 2001
From: wenxiangchao <wenxiangchao@ihengxin.com.cn>
Date: 星期一, 09 十一月 2026 17:02:15 +0800
Subject: [PATCH] feat: CAN 模拟器 TCP 化 + 多设备并发调试 + 后台生命周期管理

---
 Plugin.TestResult/InfoTable.xaml.cs |   72 +++++++++++++++++++++++++++++++-----
 1 files changed, 62 insertions(+), 10 deletions(-)

diff --git a/Plugin.TestResult/InfoTable.xaml.cs b/Plugin.TestResult/InfoTable.xaml.cs
index 4bff3b1..008d43f 100644
--- a/Plugin.TestResult/InfoTable.xaml.cs
+++ b/Plugin.TestResult/InfoTable.xaml.cs
@@ -1,4 +1,5 @@
-锘縰sing Plugin.TestResult_WPF.Constant;
+锘縰sing HMI.Util;
+using Plugin.TestResult_WPF.Constant;
 using System;
 using System.ComponentModel;
 using System.Runtime.CompilerServices;
@@ -66,7 +67,6 @@
             set
             {
                 RaiseAndSetIfchanged(ref _okCount, value);
-                RefreshCount();
             }
         }
 
@@ -78,7 +78,6 @@
             set
             {
                 RaiseAndSetIfchanged(ref _ngCount, value);
-                RefreshCount();
             }
         }
 
@@ -115,7 +114,16 @@
             set
             {
                 RaiseAndSetIfchanged(ref _consumeTime, value);
-                RaisePropertyChanged("consumeTimeStr");
+            }
+        }
+
+        private double? _leftTime;
+        public double? leftTime
+        {
+            get => _leftTime;
+            set
+            {
+                RaiseAndSetIfchanged(ref _leftTime, value);
             }
         }
 
@@ -123,9 +131,45 @@
         {
             get
             {
-                if (consumeTime < 60) return $"{consumeTime.ToString("f2")}s";
-                else if (consumeTime < 3600) return $"{Math.Floor(consumeTime / 60)}m{(consumeTime % 60).ToString("f2")}s";
-                return $"{Math.Floor(consumeTime / 3600)}h{Math.Floor((consumeTime % 3600) / 60)}m{(consumeTime % 60).ToString("f2")}s";
+                var str1 = ConvertDurtion(consumeTime);
+                if (leftTime != null)
+                {
+                    str1 += $"/{ConvertDurtion(leftTime.Value)}";
+                }
+                return str1;
+            }
+        }
+
+        private string ConvertDurtion(double seconds)
+        {
+            if (seconds <= 0)
+            {
+                return "0s";
+            }
+            if (seconds <= 60)
+            {
+                return $"{seconds.ToString("f2")}s";
+            }
+            else if (seconds <= 3600)
+            {
+                var min = Math.Floor(seconds / 60);
+                seconds = seconds % 60;
+                if (seconds > 0)
+                {
+                    return $"{min}m{seconds.ToString("f2")}s";
+                }
+                return $"{min}m";
+            }
+            else
+            {
+                var hour = Math.Floor(seconds / 3600);
+                var min = Math.Floor((seconds % 3600) / 60);
+                seconds = seconds % 60;
+                if (seconds > 0)
+                {
+                    return $"{hour}h{min}m{seconds.ToString("f2")}s";
+                }
+                return $"{hour}h{min}m";
             }
         }
 
@@ -137,13 +181,21 @@
             set => RaiseAndSetIfchanged(ref _endTimeStr, value);
         }
 
-
-        private void RefreshCount()
+        public void UpdateNumber(int ok, int ng)
         {
-            this.allCount = this.okCount + this.ngCount;
+            this._okCount = ok;
+            this._ngCount = ng;
+            this._allCount = this._okCount + this._ngCount;
             RaisePropertyChanged("countStr");
         }
 
+        public void UpdateConsumeTime(double consumeTime, double? leftTime)
+        {
+            this.consumeTime = consumeTime;
+            this.leftTime = leftTime;
+            RaisePropertyChanged("consumeTimeStr");
+        }
+
         public InfoTable()
         {
             this.DataContext = this;

--
Gitblit v1.9.1