diff --git a/MainWindow.xaml.cs b/MainWindow.xaml.cs
index 048174c..7769c30 100644
--- a/MainWindow.xaml.cs
+++ b/MainWindow.xaml.cs
@@ -102,7 +102,8 @@ namespace SunlightCentralizedControlManagement_SCCM_
private void ButtonSYS_Click(object sender, RoutedEventArgs e)
{
- Picture.Content = new View.MachinesSet();//EngineerSetView();
+ // Picture.Content = new View.MachinesSet();//EngineerSetView();
+ Picture.Content = new View.EngineerSetView();
}
}
}
diff --git a/Properties/Resources.Designer.cs b/Properties/Resources.Designer.cs
index 0bbd0e9..b7add10 100644
--- a/Properties/Resources.Designer.cs
+++ b/Properties/Resources.Designer.cs
@@ -1311,6 +1311,15 @@ namespace SunlightCentralizedControlManagement_SCCM_.Properties {
}
}
+ ///
+ /// 查找类似 Mode 的本地化字符串。
+ ///
+ public static string Mode {
+ get {
+ return ResourceManager.GetString("Mode", resourceCulture);
+ }
+ }
+
///
/// 查找类似 Monitor 的本地化字符串。
///
@@ -1491,6 +1500,15 @@ namespace SunlightCentralizedControlManagement_SCCM_.Properties {
}
}
+ ///
+ /// 查找类似 Password 的本地化字符串。
+ ///
+ public static string Password {
+ get {
+ return ResourceManager.GetString("Password", resourceCulture);
+ }
+ }
+
///
/// 查找类似 Paused 的本地化字符串。
///
@@ -2076,6 +2094,24 @@ namespace SunlightCentralizedControlManagement_SCCM_.Properties {
}
}
+ ///
+ /// 查找类似 SERVER 的本地化字符串。
+ ///
+ public static string SERVER {
+ get {
+ return ResourceManager.GetString("SERVER", resourceCulture);
+ }
+ }
+
+ ///
+ /// 查找类似 SQL 的本地化字符串。
+ ///
+ public static string SQL {
+ get {
+ return ResourceManager.GetString("SQL", resourceCulture);
+ }
+ }
+
///
/// 查找类似 StartDate 的本地化字符串。
///
diff --git a/Properties/Resources.en-US.resx b/Properties/Resources.en-US.resx
index ab56071..dfcc2f1 100644
--- a/Properties/Resources.en-US.resx
+++ b/Properties/Resources.en-US.resx
@@ -927,4 +927,16 @@
Test
+
+ SQL
+
+
+ SERVER
+
+
+ Password
+
+
+ Mode
+
\ No newline at end of file
diff --git a/Properties/Resources.resx b/Properties/Resources.resx
index 160f9f1..9443815 100644
--- a/Properties/Resources.resx
+++ b/Properties/Resources.resx
@@ -927,4 +927,16 @@
Test
+
+ SQL
+
+
+ SERVER
+
+
+ Password
+
+
+ Mode
+
\ No newline at end of file
diff --git a/Properties/Resources.zh-CN.resx b/Properties/Resources.zh-CN.resx
index 9ccc0a0..4163f78 100644
--- a/Properties/Resources.zh-CN.resx
+++ b/Properties/Resources.zh-CN.resx
@@ -927,4 +927,16 @@
测试
+
+ 数据库
+
+
+ 服务器
+
+
+ 密码
+
+
+ 模式
+
\ No newline at end of file
diff --git a/UserClass/AsyncTcpClient.cs b/UserClass/AsyncTcpClient.cs
index 1f039b1..07513f2 100644
--- a/UserClass/AsyncTcpClient.cs
+++ b/UserClass/AsyncTcpClient.cs
@@ -108,9 +108,8 @@ namespace SunlightCentralizedControlManagement_SCCM_.UserClass
}
else if (SYSAPI == "SC831")
{
- DAT = DAT.Substring(DAT.IndexOf("]") + 1);
-
- MonitorView.TechnologicalProcess = JsonConvert.DeserializeObject(DAT);//反序列化
+ DAT = DAT.Substring(DAT.IndexOf("]") + 1);
+ MonitorView.TechnologicalProcess = JsonConvert.DeserializeObject(DAT);//反序列化
}
else if (SYSAPI == "SC832")
{
@@ -125,20 +124,9 @@ namespace SunlightCentralizedControlManagement_SCCM_.UserClass
else if (SYSAPI == "SC851")
{
DAT = DAT.Substring(DAT.IndexOf("]") + 1);
-
-
-
DataTable obj = JsonConvert.DeserializeObject(DAT);//反序列化
-
-
-
- // client.SendAsync("SC851" + "[" + MainWindowViewModel.S01 + "]" + MainWindowViewModel.dt_d.ToJsonString());//数字开关信息
-
-
}//数字开关表
-
- // tcpClient.Logger.Info($"客户端接收到信息:{mes}");
return EasyTask.CompletedTask;
};
diff --git a/View/EngineerSetView.xaml b/View/EngineerSetView.xaml
index 2536921..b319472 100644
--- a/View/EngineerSetView.xaml
+++ b/View/EngineerSetView.xaml
@@ -10,10 +10,22 @@
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
\ No newline at end of file
diff --git a/View/EngineerSetView.xaml.cs b/View/EngineerSetView.xaml.cs
index 5191cf0..f660adf 100644
--- a/View/EngineerSetView.xaml.cs
+++ b/View/EngineerSetView.xaml.cs
@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
+using System.Data.SqlClient;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
@@ -35,8 +36,15 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
comboBoxCOM2.Text = Configini.IniReadvalue("SYS", "COM");
string[] Language = {"en-US","zh-CN","zh-TW" };
+ string[] SQMOD = { "Windows Authentication", "SQL SERVER"};
comboBoxLanguage.ItemsSource = Language;
+ TEXT_SQMOD.ItemsSource = SQMOD;
comboBoxLanguage.Text = Configini.IniReadvalue("SYS", "Language");
+ TEXT_SQLIP.Text = Configini.IniReadvalue("SQL_SERVER", "SQL1"); //读配置文件
+ TEXT_SQLNAME.Text = Configini.IniReadvalue("SQL_SERVER", "SQL2");
+ TEXT_SQMOD.Text = Configini.IniReadvalue("SQL_SERVER", "SQL3");
+ TEXT_SQLUSER.Text = Configini.IniReadvalue("SQL_SERVER", "SQL4");
+ TEXT_SQLPASWORD.Text = Configini.IniReadvalue("SQL_SERVER", "SQL5");
}
//调用配置文件
private UserClass.IniFile.IniFiles Configini = new UserClass.IniFile.IniFiles(Convert.ToString(System.AppDomain.CurrentDomain.BaseDirectory) + "SCCM.ini");
@@ -52,5 +60,44 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
{
Configini.IniWritevalue("SYS", "Language", comboBoxLanguage.SelectedValue.ToString());
}
+
+ private async void Test_Click(object sender, RoutedEventArgs e)
+ {
+ textlog.Text = "TEST";
+ textlog.Foreground = new SolidColorBrush(Color.FromRgb(0, 0, 255));
+ string Connstr_SC;
+ try
+ {
+ if (TEXT_SQMOD.Text == "Windows Authentication") //连接数据库测试
+ {
+ Connstr_SC = "server=" + TEXT_SQLIP.Text + ";database=" + TEXT_SQLNAME.Text + ";Trusted_Connection=SSPI";
+
+ }
+ else
+ {
+ Connstr_SC = "server=" + TEXT_SQLIP.Text + ";database=" + TEXT_SQLNAME.Text + ";User ID=" + TEXT_SQLUSER.Text + ";Password=" + TEXT_SQLPASWORD.Text;
+ }
+ SqlConnection conn_SC = new SqlConnection(Connstr_SC);
+ await conn_SC.OpenAsync(); //连接数据库
+ conn_SC.Close();
+ }
+ catch (Exception)
+ {
+ textlog.Text = "Link timeout";
+ textlog.Foreground = new SolidColorBrush(Color.FromRgb(255, 0, 0));
+ return;
+ }
+ textlog.Text = "Link succeed";
+ textlog.Foreground = new SolidColorBrush(Color.FromRgb(0, 255, 0));
+ MessageBoxResult SqlShow = System.Windows.MessageBox.Show("Whether the connection is successfully saved", "SQL", MessageBoxButton.YesNo, MessageBoxImage.Information); //连接成功提示是否保存
+ if (SqlShow == MessageBoxResult.Yes)
+ {
+ Configini.IniWritevalue("SQL_SERVER", "SQL1", TEXT_SQLIP.Text);
+ Configini.IniWritevalue("SQL_SERVER", "SQL2", TEXT_SQLNAME.Text);
+ Configini.IniWritevalue("SQL_SERVER", "SQL3", TEXT_SQMOD.SelectedValue.ToString());
+ Configini.IniWritevalue("SQL_SERVER", "SQL4", TEXT_SQLUSER.Text);
+ Configini.IniWritevalue("SQL_SERVER", "SQL5", TEXT_SQLPASWORD.Text);
+ }
+ }
}
}
diff --git a/View/MonitorView.xaml.cs b/View/MonitorView.xaml.cs
index 3979e59..596bc3f 100644
--- a/View/MonitorView.xaml.cs
+++ b/View/MonitorView.xaml.cs
@@ -130,6 +130,7 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
}//信息
else if (machines_info == 1)
{
+
}//输送状态
else if (machines_info == 2)
{