Commit fb278a4d 张东亮

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

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