运行暂停按钮功能

This commit is contained in:
sc committed 2025-05-07 23:35:19 +08:00
commit 87bec34e0a
9 files changed
+147 -27

No files matched your search

+49 -1
View File
@@ -29,6 +29,9 @@ using System.Diagnostics.Eventing.Reader;
using System.IO;
using System.Threading;
using TouchSocket.Sockets;
using static System.Windows.Forms.VisualStyles.VisualStyleElement.Button;
using System.Windows.Input;
using CommunityToolkit.Mvvm.Input;
namespace DyeingComputer.ViewModel
@@ -79,6 +82,12 @@ namespace DyeingComputer.ViewModel
UPort(); //启动串口
CountDown(); //启动循环任务
_ = AsyncTcpServer.Main();
IsInteractive = false;
UserButton = false;
ProgramgroupView_run = new RelayCommand(
execute:ProgramgroupView_run_ );//开始/暂停事件
}
DataTable dt_con = new DataTable();
DataTable dt_sys = new DataTable();
@@ -188,7 +197,46 @@ namespace DyeingComputer.ViewModel
SM02 = Convert.ToInt16(Selet_sys("SM02"));//FG
SM03 = Convert.ToInt16(Selet_sys("SM03"));//FG
}
private void ProgramgroupView_run_()////运行/暂停
{
if (WORK_RUN == 2)
{
UserButton = true;
IsInteractive = true;
}
else
if (WORK_RUN == 1)
{
UserButton = false;
IsInteractive = false;
}
else
{
UserButton = true;
IsInteractive = true;
}
}
public ICommand ProgramgroupView_run { get; }
bool _isInteractive;
public bool IsInteractive//步骤表交互选择
{
get => _isInteractive;
set
{
_isInteractive = value;
OnPropertyChanged("IsInteractive");
}
}
bool _UserButton;
public bool UserButton//步骤按钮交互选择
{
get => _UserButton;
set
{
_UserButton = value;
OnPropertyChanged("UserButton");
}
}
public string work_Temp; //显示温度
public string Work_Temp //通知UI控件参数改变
{