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 |   60 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++----
 1 files changed, 56 insertions(+), 4 deletions(-)

diff --git a/Plugin.TestResult/InfoTable.xaml.cs b/Plugin.TestResult/InfoTable.xaml.cs
index b2a7f26..008d43f 100644
--- a/Plugin.TestResult/InfoTable.xaml.cs
+++ b/Plugin.TestResult/InfoTable.xaml.cs
@@ -114,7 +114,16 @@
             set
             {
                 RaiseAndSetIfchanged(ref _consumeTime, value);
-                RaisePropertyChanged("consumeTimeStr");
+            }
+        }
+
+        private double? _leftTime;
+        public double? leftTime
+        {
+            get => _leftTime;
+            set
+            {
+                RaiseAndSetIfchanged(ref _leftTime, value);
             }
         }
 
@@ -122,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";
             }
         }
 
@@ -144,6 +189,13 @@
             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