From 9d1660270272180cd71147d6ddd53d1382643d2e Mon Sep 17 00:00:00 2001
From: wenxiangchao <wenxiangchao@ihengxin.com.cn>
Date: 星期一, 02 十一月 2026 18:00:14 +0800
Subject: [PATCH] merge: 并入远程 Initial commit 作为历史根节点

---
 Plugin.TestResult/InfoTable.xaml.cs |  205 +++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 205 insertions(+), 0 deletions(-)

diff --git a/Plugin.TestResult/InfoTable.xaml.cs b/Plugin.TestResult/InfoTable.xaml.cs
new file mode 100644
index 0000000..008d43f
--- /dev/null
+++ b/Plugin.TestResult/InfoTable.xaml.cs
@@ -0,0 +1,205 @@
+锘縰sing HMI.Util;
+using Plugin.TestResult_WPF.Constant;
+using System;
+using System.ComponentModel;
+using System.Runtime.CompilerServices;
+using System.Windows.Controls;
+
+namespace Plugin.TestResult_WPF
+{
+    /// <summary>
+    /// InfoTable.xaml 鐨勪氦浜掗�昏緫
+    /// </summary>
+    public partial class InfoTable : UserControl, INotifyPropertyChanged
+    {
+
+        #region ...
+        public event PropertyChangedEventHandler PropertyChanged;
+
+        public virtual void RaisePropertyChanged(string name)
+        {
+            PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(name));
+        }
+
+        public void RaiseAndSetIfchanged<T>(ref T old, T @new, [CallerMemberName] string propertyName = null)
+        {
+            old = @new;
+            if (propertyName != null) RaisePropertyChanged(propertyName);
+        }
+        #endregion
+
+        private double _temperature;
+        public double temperature
+        {
+            get => _temperature;
+            set
+            {
+                RaiseAndSetIfchanged(ref _temperature, value);
+                RaisePropertyChanged("temperatureStr");
+            }
+        }
+
+        public string temperatureStr
+        {
+            get => $"{_temperature.ToString("f2")}鈩�";
+        }
+
+        private string _status;
+        public string status
+        {
+            get => _status;
+            set
+            {
+                RaiseAndSetIfchanged(ref _status, value);
+                RaisePropertyChanged("statusStr");
+            }
+        }
+
+        public string statusStr
+        {
+            get => status != null && CommonStatus.STATUS_MAP.ContainsKey(status) ? CommonStatus.STATUS_MAP[status] : "";
+        }
+
+        private int _okCount;
+        public int okCount
+        {
+            get => _okCount;
+            set
+            {
+                RaiseAndSetIfchanged(ref _okCount, value);
+            }
+        }
+
+        private int _ngCount;
+
+        public int ngCount
+        {
+            get => _ngCount;
+            set
+            {
+                RaiseAndSetIfchanged(ref _ngCount, value);
+            }
+        }
+
+        private int _allCount;
+
+        public int allCount
+        {
+            get => _allCount;
+            set
+            {
+                RaiseAndSetIfchanged(ref _allCount, value);
+            }
+        }
+
+        public string countStr
+        {
+            get => $"OK:{okCount},NG:{ngCount},ALL:{allCount}";
+        }
+
+        private string _startTimeStr;
+        public string startTimeStr
+        {
+            get => _startTimeStr;
+            set
+            {
+                RaiseAndSetIfchanged(ref _startTimeStr, value);
+            }
+        }
+
+        private double _consumeTime;
+        public double consumeTime
+        {
+            get => _consumeTime;
+            set
+            {
+                RaiseAndSetIfchanged(ref _consumeTime, value);
+            }
+        }
+
+        private double? _leftTime;
+        public double? leftTime
+        {
+            get => _leftTime;
+            set
+            {
+                RaiseAndSetIfchanged(ref _leftTime, value);
+            }
+        }
+
+        public string consumeTimeStr
+        {
+            get
+            {
+                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";
+            }
+        }
+
+        private string _endTimeStr;
+
+        public string endTimeStr
+        {
+            get => _endTimeStr;
+            set => RaiseAndSetIfchanged(ref _endTimeStr, value);
+        }
+
+        public void UpdateNumber(int ok, int ng)
+        {
+            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;
+            InitializeComponent();
+        }
+    }
+}

--
Gitblit v1.9.1