diff --git a/MainWindow.xaml b/MainWindow.xaml index 5da463f..bfce87b 100644 --- a/MainWindow.xaml +++ b/MainWindow.xaml @@ -186,9 +186,23 @@ MouseLeftButtonUp="Image_MouseLeftButtonUp" VerticalAlignment="Center"/> - + + + + + diff --git a/MainWindow.xaml.cs b/MainWindow.xaml.cs index f8090de..5cb53d2 100644 --- a/MainWindow.xaml.cs +++ b/MainWindow.xaml.cs @@ -1,9 +1,10 @@ using DyeingComputer.UserClass; -using DyeingComputer.ViewModel; using DyeingComputer.View; +using DyeingComputer.ViewModel; using System; using System.Collections.Generic; using System.Linq; +using System.Net; using System.Text; using System.Threading.Tasks; using System.Windows; @@ -34,8 +35,7 @@ namespace DyeingComputer MainWindowViewModel.ViewID = 1; } - private SQLiteHelper SQLiteHelpers = null; //定义数据库 - + public static SQLiteHelper SQLiteHelpers = null; //定义数据库 private readonly string DBAddress = Environment.CurrentDirectory + "\\DataBase\\800COMPUTER.db"; //数据库路径 /// @@ -197,7 +197,9 @@ namespace DyeingComputer { ((Image)sender).RenderTransform = Transform.Identity; MainWindowViewModel.UserInfoStart = 901; - MainWindowViewModel.UserInfo = Properties.Resources.Manual; + if (MainWindowViewModel._AUTO_bool) + { MainWindowViewModel.UserInfo = Properties.Resources.Auto; } + else { MainWindowViewModel.UserInfo = Properties.Resources.Manual; } }//手动 } } diff --git a/UserClass/AsyncTcpServer.cs b/UserClass/AsyncTcpServer.cs index 9aa174c..74cbf75 100644 --- a/UserClass/AsyncTcpServer.cs +++ b/UserClass/AsyncTcpServer.cs @@ -468,16 +468,32 @@ namespace DyeingComputer.UserClass { Dictionary dat_829; dat_829 = SerializeConvert.JsonDeserializeFromString>(SYSDAT); - if (dat_829.GetValue("LOCK").ToString() == "True") - { - MainWindowViewModel._Lock_bool = true; - client.SendAsync("SC829" + SYSKEY + SYSDAT); + if (dat_829.GetValue("NAME").ToString() == "LOCK") { + if (dat_829.GetValue("VALUE").ToString() == "True") + { + MainWindowViewModel._Lock_bool = true; + client.SendAsync("SC829" + SYSKEY + SYSDAT); + } + else + { + MainWindowViewModel._Lock_bool = false; + client.SendAsync("SC829" + SYSKEY + SYSDAT); + } } - else + else if (dat_829.GetValue("NAME").ToString() == "AUTO") { - MainWindowViewModel._Lock_bool = false; - client.SendAsync("SC829" + SYSKEY + SYSDAT); + if (dat_829.GetValue("VALUE").ToString() == "True") + { + MainWindowViewModel._AUTO_bool = true; + client.SendAsync("SC829" + SYSKEY + SYSDAT); + } + else + { + MainWindowViewModel._AUTO_bool = false; + client.SendAsync("SC829" + SYSKEY + SYSDAT); + } } + MainWindowViewModel.TX++; APILog.DBlog(client.IP, SYSKEY, SYSAPI, SYSDAT);//记录指令 } diff --git a/ViewModel/MainWindowViewModel.cs b/ViewModel/MainWindowViewModel.cs index 8774b15..aefe6e0 100644 --- a/ViewModel/MainWindowViewModel.cs +++ b/ViewModel/MainWindowViewModel.cs @@ -133,8 +133,8 @@ namespace DyeingComputer.ViewModel } } public static bool _AUTO_bool; - Visibility AUTO_bool_xml; //显示手自动状态 - public Visibility AUTO_bool // + bool AUTO_bool_xml; //显示手自动状态 + public bool AUTO_bool // { get => AUTO_bool_xml; set @@ -538,8 +538,8 @@ namespace DyeingComputer.ViewModel else { Lock_bool = Visibility.Collapsed; }//锁图标 if (_Link_bool) { Link_bool = Visibility.Visible; } else { Link_bool = Visibility.Collapsed; }//连线图标 - if (_AUTO_bool) { AUTO_bool = Visibility.Visible; Updata_dtd("3005",true); } - else { AUTO_bool = Visibility.Collapsed; }//手自动图标 + if (_AUTO_bool) { AUTO_bool = _AUTO_bool; Updata_dtd("3005",true); } + else { AUTO_bool = _AUTO_bool; }//手自动图标 if ((Selet_dtm("1010") < 1) || (Selet_dtm("1010") > 160)) { ERRinf.ERRinf_w(errTabler, Resources.Temperature + Resources.Sensor + Resources.Malfunction, "ERR101"); } //温度故障提示