From a061384ba628a09bf4df91f50321ab22c03129aa Mon Sep 17 00:00:00 2001
From: alielie <alielie@git.com>
Date: 星期二, 18 三月 2025 20:58:36 +0800
Subject: [PATCH] Winform支持遮罩层;

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

diff --git a/Plugin.TestResult/DataTable.xaml.cs b/Plugin.TestResult/DataTable.xaml.cs
index aa7f621..39e223c 100644
--- a/Plugin.TestResult/DataTable.xaml.cs
+++ b/Plugin.TestResult/DataTable.xaml.cs
@@ -3,7 +3,9 @@
 using Plugin.TestResult_WPF.Model;
 using SuperSocket.SocketBase.Protocol;
 using System;
+using System.Collections.Generic;
 using System.ComponentModel;
+using System.IO;
 using System.Runtime.CompilerServices;
 using System.Windows;
 using System.Windows.Controls;
@@ -76,6 +78,11 @@
         private TcpServer tcpServer;
         private string CountIniPath;
 
+        // 骞冲潎娓╁害
+        public List<double> tempratures = new List<double>();
+        public Dictionary<string, List<double>> detailTempratures
+            = new Dictionary<string, List<double>>();
+
         public DataTable(TestResultView parent, int index, string title,
             string countIniPath,
             BaseConfig config)
@@ -126,11 +133,23 @@
         public void SetTemperature(double t)
         {
             infoTable.temperature = t;
+            tempratures.Add(t);
             chart.AddData(t);
         }
 
         public void SetTemperature(string name, double t)
         {
+            List<double> list;
+            if (detailTempratures.ContainsKey(name))
+            {
+                list = detailTempratures[name];
+            }
+            else
+            {
+                list = new List<double>();
+                detailTempratures.Add(name, list);
+            }
+            list.Add(t);
             multiChart.AddData(name, t);
         }
 
@@ -201,6 +220,9 @@
         {
             chart.Clear();
             multiChart.Clear();
+
+            tempratures.Clear();
+            detailTempratures.Clear();
         }
 
         /// <summary>
@@ -363,5 +385,46 @@
         {
             StartTcpServer();
         }
+
+        public void SaveTempFile(string filePath)
+        {
+            try
+            {
+                FileInfo fi = new FileInfo(filePath);
+                if (!fi.Directory.Exists)
+                {
+                    fi.Directory.Create();  //鏂囦欢涓嶅瓨鍦紝鍒涘缓鏂囦欢
+                }
+
+                using (FileStream fs = new FileStream(filePath, FileMode.Create, FileAccess.Write))
+                using (StreamWriter sw = new StreamWriter(fs, System.Text.Encoding.UTF8))
+                {
+                    string title = string.Join(",", detailTempratures.Keys) + ",骞冲潎鍊�";
+                    sw.WriteLine(title);
+
+                    for (int i = 0; i < tempratures.Count; i++)
+                    {
+                        string line = "";
+                        foreach (string key in detailTempratures.Keys)
+                        {
+                            if (detailTempratures[key] == null || detailTempratures[key].Count <= i)
+                            {
+                                line += ",";
+                            }
+                            else
+                            {
+                                line += $"{detailTempratures[key][i]},";
+                            }
+                        }
+                        line += tempratures[i];
+                        sw.WriteLine(line);
+                    }
+                }
+            }
+            catch (Exception ex)
+            {
+                Console.WriteLine(ex.ToString());
+            }
+        }
     }
 }

--
Gitblit v1.9.1