修改查询状态时间为5s一查询

This commit is contained in:
maqiao 2024-12-10 09:09:34 +08:00
parent 3b7ef9e29f
commit f2614723e2
4 changed files with 29 additions and 24 deletions

View File

@ -860,7 +860,7 @@ namespace DM_Weight.ViewModels
bool loop = true;
while (loop)
{
await Task.Delay(3000);
await Task.Delay(5000);
bool[] boolsl = ModbusHelper.GetInstance().GetAllBoxState();
bool state = Array.TrueForAll(boolsl, b => b == false);
if (state)

View File

@ -285,32 +285,37 @@ namespace DM_Weight.ViewModels
// _regionManager.RequestNavigate("ContentRegion", SelectedMenu.Children[0].PremissionPath);
// }
//}
if (SelectedMenu != null && SelectedMenu.PremissionName == "退出")
if (!ModbusHelper.BoxOperate)
{
//bool[] boolArrs = ModbusHelper.GetInstance().GetAllBoxState();
//bool allTrue = Array.TrueForAll(boolArrs, b => b);
//false是关着,true是开着
if (!ModbusHelper.BoxOperate)
if (SelectedMenu != null && SelectedMenu.PremissionName == "退出")
{
logger.Info($"用户【{Operator?.Nickname}】退出登录");
Operator = null;
Reviewer = null;
_regionManager.RequestNavigate("MainRegion", "LoginWindow");
//bool[] boolArrs = ModbusHelper.GetInstance().GetAllBoxState();
//bool allTrue = Array.TrueForAll(boolArrs, b => b);
//false是关着,true是开着
//if (!ModbusHelper.BoxOperate)
//{
logger.Info($"用户【{Operator?.Nickname}】退出登录");
Operator = null;
Reviewer = null;
_regionManager.RequestNavigate("MainRegion", "LoginWindow");
//}
//else
//{
// //还有药箱开着不能退出
// _portUtil.SpeakAsync("请关闭药箱后再退出");
// SelectedMenu = _premissionDmList[0];
//}
}
else
{
//还有药箱开着不能退出
_portUtil.SpeakAsync("请关闭药箱后再退出");
SelectedMenu = _premissionDmList[0];
}
}
else
{
//SelectedMenu.Children = SelectedMenu.Children;
//SelectedChildMenu = SelectedMenu.Children[0];
if (!_portUtil.Operate)
{
_regionManager.RequestNavigate("ContentRegion", SelectedMenu.Children[0].PremissionPath);
//SelectedMenu.Children = SelectedMenu.Children;
//SelectedChildMenu = SelectedMenu.Children[0];
if (!_portUtil.Operate)
{
_regionManager.RequestNavigate("ContentRegion", SelectedMenu.Children[0].PremissionPath);
}
}
}
}

View File

@ -674,7 +674,7 @@ namespace DM_Weight.ViewModels
bool loop = true;
while (loop)
{
await Task.Delay(3000);
await Task.Delay(5000);
bool[] boolsl = ModbusHelper.GetInstance().GetAllBoxState();
bool state = Array.TrueForAll(boolsl, b => b == false);
if(state)

View File

@ -232,7 +232,7 @@ namespace DM_Weight.ViewModels
bool loop = true;
while (loop)
{
await Task.Delay(3000);
await Task.Delay(5000);
bool[] boolsl = ModbusHelper.GetInstance().GetAllBoxState();
bool state = Array.TrueForAll(boolsl, b => b == false);
if (state)