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 作为历史根节点

---
 HMI.DataViewer/DbSettingModal.xaml.cs |   18 ++++++++++++------
 1 files changed, 12 insertions(+), 6 deletions(-)

diff --git a/HMI.DataViewer/DbSettingModal.xaml.cs b/HMI.DataViewer/DbSettingModal.xaml.cs
index 5ab9ed8..66051b3 100644
--- a/HMI.DataViewer/DbSettingModal.xaml.cs
+++ b/HMI.DataViewer/DbSettingModal.xaml.cs
@@ -6,7 +6,6 @@
 using Microsoft.Win32;
 using Panuon.WPF.UI;
 using System;
-using System.Collections.Generic;
 using System.Collections.ObjectModel;
 using System.ComponentModel;
 using System.IO;
@@ -102,10 +101,15 @@
             base.OnClosing(e);
         }
 
-        public bool ValidateDBAddress(object value, out string err)
+        public bool ValidateName(object value, out string err)
         {
             err = null;
-
+            var target = Datasource.FirstOrDefault(e => e.Program == value.ToString());
+            if (target != null && target != Data)
+            {
+                err = this.lang("App.MustBeUnique", LangUtil.Get("Dv.Datasource.Name")); ;
+                return false;
+            }
             return true;
         }
 
@@ -117,6 +121,7 @@
                 Data.Program = programInput.Text;
                 Data.DBFilePath = dbFilePathInput.Text;
                 Data.TableName = tableNameInput.Text;
+                Data.Pattern = TbPattern.Text;
                 Data.TimeCol = Conditions.FirstOrDefault(c => c.IsTimeCol)?.Key;
                 Data.Condition = Conditions;
             }
@@ -135,7 +140,7 @@
             programInput.Text = Data.Program;
             dbFilePathInput.Text = Data.DBFilePath;
             tableNameInput.Text = Data.TableName;
-            Conditions = data?.Condition ?? new ObservableCollection<QueryCondition>();
+            TbPattern.Text = Data.Pattern;
 
             if (!string.IsNullOrEmpty(Data.DBFilePath) && File.Exists(Data.DBFilePath))
             {
@@ -144,6 +149,7 @@
                 tableNameInput.SelectedItem = Data.TableName;
                 UpdateColumnSource(Data.TableName);
             }
+            Conditions = data?.Condition ?? new ObservableCollection<QueryCondition>();
 
             return this.ShowDialog();
         }
@@ -204,7 +210,7 @@
             }
             else if (Helper.DataBaseFile != filePath)
             {
-                Helper.Close();
+                //Helper.Close();
                 Helper = new SqliteHelper(filePath);
             }
         }
@@ -267,7 +273,7 @@
         private void ComboxSelectionChanged(object sender, SelectionChangedEventArgs e)
         {
             UpdateColumnSource(e.AddedItems[0].ToString());
-            Conditions = new ObservableCollection<QueryCondition>();
+            //Conditions = new ObservableCollection<QueryCondition>();
         }
 
         private void RadioButton_Click(object sender, System.Windows.RoutedEventArgs e)

--
Gitblit v1.9.1