修改连线逻辑

This commit is contained in:
sc committed 2025-04-10 22:58:20 +08:00
commit 26c41a0c10
3 files changed
+14 -11

No files matched your search

+2 -2
View File
@@ -90,7 +90,7 @@ namespace SunlightCentralizedControlManagement_SCCM_.UserClass
{
DataRow drEmployee = MainWindowViewModel.Machines.Select("IP='" + client.IP + "'").First();
drEmployee.BeginEdit();
drEmployee["State"] = "899";
drEmployee["State"] = "800";
drEmployee["WorkOrder"] = "------";
drEmployee["Dyelot"] = "";
drEmployee["Temperature"] = "---.-";
@@ -123,7 +123,7 @@ namespace SunlightCentralizedControlManagement_SCCM_.UserClass
DataRow drEmployee = MainWindowViewModel.Machines.Select("IP='" + client.IP + "'").First();
drEmployee.BeginEdit();
drEmployee["SYSKEY"] = Chart_new.GetValue("SYSKEY").ToString();
drEmployee["NAME"] = Chart_new.GetValue("MACHINE").ToString();
// drEmployee["NAME"] = Chart_new.GetValue("MACHINE").ToString();
drEmployee["Groups"] = Chart_new.GetValue("GROUP").ToString();
drEmployee["State"] = "802";
drEmployee.EndEdit();
+1 -1
View File
@@ -40,7 +40,7 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
{
public MonitorView()
{
DataContext = new MainWindowViewModel();
//DataContext = new MainWindowViewModel();
InitializeComponent();
CountDown();
}
+11 -8
View File
@@ -15,7 +15,9 @@ using System.Data.SqlClient;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Timers;
using System.Windows.Controls;
using System.Windows.Forms;
using System.Windows.Media;
@@ -149,14 +151,13 @@ namespace SunlightCentralizedControlManagement_SCCM_.ViewModel
LogGing.LogGingDATA("[Database='" + ex + "']=SQLSERVER");
ERR_c++;
}
}
}
public void CountDown()
{
DispatcherTimer timer1s = new DispatcherTimer//初始化循环,每1秒调用一次Tick
{
Interval = TimeSpan.FromSeconds(1)//秒
};
timer1s.Tick += Tick_Event_1S;
DispatcherTimer timer1s = new DispatcherTimer(DispatcherPriority.Normal);//初始化循环,每1秒调用一次Tick
timer1s.Interval = TimeSpan.FromMilliseconds(950);//秒
timer1s.Tick += Tick_Main_1S;
timer1s.Start();
DispatcherTimer dis50ms = new DispatcherTimer
@@ -164,7 +165,7 @@ namespace SunlightCentralizedControlManagement_SCCM_.ViewModel
Interval = TimeSpan.FromMilliseconds(10) //毫秒
};
dis50ms.Tick += new EventHandler(DisTimer_50MS);//每一秒执行的方法
dis50ms.Start();//计时开始
dis50ms.Start();//计时开始
}//时间周期初始化
void DisTimer_50MS(object sender, EventArgs e)//Tick_Event周期执行事件50MS
{
@@ -174,7 +175,9 @@ namespace SunlightCentralizedControlManagement_SCCM_.ViewModel
MachiensTcpClient[t.ID].SendAsync(t.DAT);
}
}
void Tick_Event_1S(object sender, EventArgs e)//Tick_Event周期执行事件1S
void Tick_Main_1S(object sender, EventArgs e)//Tick_Event周期执行事件1S
{
DATA_view();
//下传工单信息