Commit fb278a4d 张东亮

消息显示间隔延长,避免界面假死

1 个父辈 168e1f62
...@@ -260,6 +260,7 @@ namespace DeviceLibrary ...@@ -260,6 +260,7 @@ namespace DeviceLibrary
/// 整机启动变量,设置为false后将退出线程,只在停止时调用 /// 整机启动变量,设置为false后将退出线程,只在停止时调用
/// </summary> /// </summary>
bool mstart = true; bool mstart = true;
DateTime showTime = DateTime.Now;
public void Run() public void Run()
{ {
mstart = true; mstart = true;
...@@ -303,7 +304,12 @@ namespace DeviceLibrary ...@@ -303,7 +304,12 @@ namespace DeviceLibrary
finally finally
{ {
var m = Msg.get(); var m = Msg.get();
if ((DateTime.Now - showTime).TotalMilliseconds > 800)
{
ProcessMsgEvent?.Invoke(m); ProcessMsgEvent?.Invoke(m);
showTime = DateTime.Now;
}
ServerCM.ProcessMsg(m); ServerCM.ProcessMsg(m);
StoreStatus currnetstoreStatus = StoreStatus.None; StoreStatus currnetstoreStatus = StoreStatus.None;
if (m.Find((aa) => aa.msgLevel == MsgLevel.alarm) == null) if (m.Find((aa) => aa.msgLevel == MsgLevel.alarm) == null)
......
...@@ -182,6 +182,7 @@ namespace TheMachine ...@@ -182,6 +182,7 @@ namespace TheMachine
{ {
SetState(MoveInfo.List); SetState(MoveInfo.List);
} }
void SetState(List<MoveInfo> moveInfoList) void SetState(List<MoveInfo> moveInfoList)
{ {
if (RobotManage.mainMachine == null) if (RobotManage.mainMachine == null)
...@@ -319,6 +320,7 @@ namespace TheMachine ...@@ -319,6 +320,7 @@ namespace TheMachine
SetMsg(lm); SetMsg(lm);
WindowManager.Show(); WindowManager.Show();
} }
object showMsgLoc = new object();
void SetMsg(List<Msg> msgs) void SetMsg(List<Msg> msgs)
{ {
//if (this.InvokeRequired) //if (this.InvokeRequired)
...@@ -329,7 +331,10 @@ namespace TheMachine ...@@ -329,7 +331,10 @@ namespace TheMachine
// }); // });
// return; // return;
//} //}
if(Monitor.TryEnter(showMsgLoc))
{
try
{
this.SuspendLayout(); this.SuspendLayout();
listView1.Items.Clear(); listView1.Items.Clear();
foreach (Msg msg in msgs) foreach (Msg msg in msgs)
...@@ -345,11 +350,18 @@ namespace TheMachine ...@@ -345,11 +350,18 @@ namespace TheMachine
listView1.Items.Add(lvi); listView1.Items.Add(lvi);
if (msg.errInfo == ErrInfo.X09_BoxNotDetect) if (msg.errInfo == ErrInfo.X09_BoxNotDetect)
{ {
btn_IgnoreX09.Invoke(new Action(() =>
{
btn_IgnoreX09.Visible = true; btn_IgnoreX09.Visible = true;
}));
} }
else if (msg.errInfo == ErrInfo.X09_Clear) else if (msg.errInfo == ErrInfo.X09_Clear)
{ {
btn_IgnoreX09.Invoke(new Action(() =>
{
btn_IgnoreX09.Visible = false; btn_IgnoreX09.Visible = false;
}));
} }
else if (msg.errInfo == ErrInfo.RunBtn || msg.errInfo == ErrInfo.ResetBtn) else if (msg.errInfo == ErrInfo.RunBtn || msg.errInfo == ErrInfo.ResetBtn)
{ {
...@@ -373,6 +385,11 @@ namespace TheMachine ...@@ -373,6 +385,11 @@ namespace TheMachine
} }
this.ResumeLayout(true); this.ResumeLayout(true);
} }
finally
{ Monitor.Exit(showMsgLoc); }
}
}
bool userpause = false; bool userpause = false;
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!