From c1c3772a11b1f3fbad8846cc714120771d85fa53 Mon Sep 17 00:00:00 2001
From: alielie <alielie@git.com>
Date: 星期四, 12 六月 2025 20:10:59 +0800
Subject: [PATCH] 新增SeqEditor

---
 Plugin.TsExecution/SingleControl.xaml.cs |   43 +++++++++++++++++++++++--------------------
 1 files changed, 23 insertions(+), 20 deletions(-)

diff --git a/Plugin.TsExecution/SingleControl.xaml.cs b/Plugin.TsExecution/SingleControl.xaml.cs
index 8b0cfff..c82ecb6 100644
--- a/Plugin.TsExecution/SingleControl.xaml.cs
+++ b/Plugin.TsExecution/SingleControl.xaml.cs
@@ -408,34 +408,37 @@
 
         public void WriteToCSV(string path)
         {
-            try
+            Dispatcher.BeginInvoke(new Action(() =>
             {
-
-                FileInfo fi = new FileInfo(path);
-                if (!fi.Directory.Exists)
+                try
                 {
-                    fi.Directory.Create();  //鏂囦欢涓嶅瓨鍦紝鍒涘缓鏂囦欢
-                }
 
-                using (FileStream fs = new FileStream(path, FileMode.Create, FileAccess.Write))
-                using (StreamWriter sw = new StreamWriter(fs, System.Text.Encoding.UTF8))
-                {
-                    string title = "椤圭洰鍚嶇О,娴嬭瘯鍙傛暟,娴嬭瘯鍊�,涓婇檺,涓嬮檺,鍗曚綅,缁撴灉";
-                    sw.WriteLine(title);
-
-                    if (Datasource != null && Datasource.Count > 0)
+                    FileInfo fi = new FileInfo(path);
+                    if (!fi.Directory.Exists)
                     {
-                        foreach (var data in Datasource)
+                        fi.Directory.Create();  //鏂囦欢涓嶅瓨鍦紝鍒涘缓鏂囦欢
+                    }
+
+                    using (FileStream fs = new FileStream(path, FileMode.Create, FileAccess.Write))
+                    using (StreamWriter sw = new StreamWriter(fs, System.Text.Encoding.UTF8))
+                    {
+                        string title = "椤圭洰鍚嶇О,娴嬭瘯鍙傛暟,娴嬭瘯鍊�,涓婇檺,涓嬮檺,鍗曚綅,缁撴灉";
+                        sw.WriteLine(title);
+
+                        if (Datasource != null && Datasource.Count > 0)
                         {
-                            sw.WriteLine($"{data.Name},{data.Step},{data.Value},{data.LimitUp},{data.LimitDown},{data.Unit},{data.Result}");
+                            foreach (var data in Datasource)
+                            {
+                                sw.WriteLine($"{data.Name},{data.Step},{data.Value},{data.LimitUp},{data.LimitDown},{data.Unit},{data.Result}");
+                            }
                         }
                     }
                 }
-            }
-            catch (Exception ex)
-            {
-                TsExecution.logger.Error("Write CSV File Failed.", ex);
-            }
+                catch (Exception ex)
+                {
+                    TsExecution.logger.Error("Write CSV File Failed.", ex);
+                }
+            }));
         }
 
         public void ShowPausePanel()

--
Gitblit v1.9.1