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/InfoWindow.xaml.cs |  115 ++++++++++++++++++++++++++++++++++++---------------------
 1 files changed, 72 insertions(+), 43 deletions(-)

diff --git a/Plugin.TestResult/InfoWindow.xaml.cs b/Plugin.TestResult/InfoWindow.xaml.cs
index 5e402af..1cb75b9 100644
--- a/Plugin.TestResult/InfoWindow.xaml.cs
+++ b/Plugin.TestResult/InfoWindow.xaml.cs
@@ -1,14 +1,9 @@
-锘縰sing HMI.Core.Api;
-using HMI.Core.Entity;
-using HMI.Core.Manager;
-using HMI.Core.Util;
+锘縰sing HMI.Core.Util;
 using HMI.UI.Util;
 using Panuon.WPF.UI;
 using Plugin.TestResult_WPF.Model;
 using System;
-using System.Collections.Generic;
 using System.Collections.ObjectModel;
-using System.Linq;
 using System.Windows;
 using System.Windows.Controls;
 
@@ -34,46 +29,72 @@
             get => _dataSource == null ? new ObservableCollection<Info>() : _dataSource;
             set => Set(ref _dataSource, value);
         }
-        private Chart electricChart;
-        private Chart vChart;
-        public InfoWindow(string title, ObservableCollection<Info> infos, Chart electricChart, Chart vChart, int probeCount)
+        private LiveChart waterChart;
+        private LiveChart electricChart;
+        private LiveChart vChart;
+
+        //public InfoWindow(string title, ObservableCollection<Info> infos, Chart waterChart, Chart electricChart, Chart vChart, int probeCount, int probeWarn)
+        //{
+        //    this.title = title;
+        //    this.dataSource = infos;
+        //    DataContext = this;
+        //    Topmost = false;
+        //    this.ProbeWarn = probeWarn;
+        //    InitializeComponent();
+
+
+        //    UpdateProbeCount(probeCount,probeWarn);
+
+        //    if (waterChart != null)
+        //    {
+        //        this.waterChart = waterChart;
+        //        mainGrid.Children.Add(waterChart);
+        //        Grid.SetRow(waterChart, 1);
+        //    }
+
+        //    this.electricChart = electricChart;
+        //    mainGrid.Children.Add(electricChart);
+        //    Grid.SetRow(electricChart, 2);
+
+
+        //    this.vChart = vChart;
+        //    mainGrid.Children.Add(vChart);
+        //    Grid.SetRow(vChart, 3);
+        //}
+
+        public InfoWindow(string title, ObservableCollection<Info> infos, LiveChart[] charts, int probeCount, int probeWarn)
         {
             this.title = title;
             this.dataSource = infos;
             DataContext = this;
             Topmost = false;
+            this.ProbeWarn = probeWarn;
             InitializeComponent();
 
-            if (AlarmProbeCount < 0)
-            {
-                alarmLabel.Visibility = Visibility.Collapsed;
-                alarmValue.Visibility = Visibility.Collapsed;
-            }
-            UpdateProbeCount(probeCount);
 
-            this.electricChart = electricChart;
-            mainGrid.Children.Add(electricChart);
-            Grid.SetRow(electricChart, 1);
-
-            this.vChart = vChart;
-            mainGrid.Children.Add(vChart);
-            Grid.SetRow(vChart, 2);
-        }
-
-        private static int AlarmProbeCount;
-        static InfoWindow()
-        {
-            int probeWarn = -1;
-            try
+            UpdateProbeCount(probeCount, probeWarn);
+            int row = 1;
+            foreach (var chart in charts)
             {
-                probeWarn = Convert.ToInt32(ParameterManager.GetCommonParameter<List<ParameterData>>()
-                    .FirstOrDefault(x => x.Name == "ProbeWarn")?.Value);
+                if (chart == null) return;
+                mainGrid.Children.Add(chart);
+                Grid.SetRow(chart, row++);
             }
-            catch (Exception ex)
-            {
-                probeWarn = -1;
-            }
-            AlarmProbeCount = probeWarn;
+
+            //if (waterChart != null)
+            //{
+            //    this.waterChart = waterChart;
+            //    mainGrid.Children.Add(waterChart);
+            //    Grid.SetRow(waterChart, 1);
+            //}
+
+            //this.electricChart = electricChart;
+            //mainGrid.Children.Add(electricChart);
+            //Grid.SetRow(electricChart, 2);
+
+            //this.vChart = vChart;
+            //mainGrid.Children.Add(vChart);
+            //Grid.SetRow(vChart, 3);
         }
 
         public event EventHandler ClearProbeCountEvent;
@@ -90,21 +111,28 @@
 
         public int ProbeWarn
         {
-            get => AlarmProbeCount;
-            set { }
+            get;
+            set;
         }
-        public void UpdateProbeCount(int count)
+
+        public void UpdateProbeCount(int count, int warn)
         {
             Dispatcher.Invoke(() =>
             {
                 ProbeCount = count;
-                if (AlarmProbeCount >= 0)
+                ProbeWarn = warn;
+
+                if (ProbeWarn < 0)
                 {
-                    probeCountAlarm.Visibility = (ProbeCount >= AlarmProbeCount) ? Visibility.Visible : Visibility.Collapsed;
+                    alarmLabel.Visibility = Visibility.Collapsed;
+                    alarmValue.Visibility = Visibility.Collapsed;
+                }
+                else
+                {
+                    probeCountAlarm.Visibility = (ProbeCount >= ProbeWarn) ? Visibility.Visible : Visibility.Collapsed;
                 }
             });
         }
-
 
         public void UpdateSource(ObservableCollection<Info> infos)
         {
@@ -123,6 +151,7 @@
 
         protected override void OnClosed(EventArgs e)
         {
+            waterChart = null;
             electricChart = null;
             vChart = null;
             mainGrid.Children.Clear();
@@ -139,7 +168,7 @@
 
         private void Button_Click(object sender, RoutedEventArgs e)
         {
-            if (MsgBoxHelper.WarnMessage(this, "纭畾瑕佹竻绌烘帰閽堜娇鐢ㄦ鏁板悧锛�") == MessageBoxResult.OK)
+            if (MsgBoxHelper.WarnMessage(this, this.lang("Ts.MakeSureToClearProbeCount")) == MessageBoxResult.OK)
             {
                 ClearProbeCountEvent?.Invoke(this, null);
             }

--
Gitblit v1.9.1