增加和中控通信时弹框报警的处理类

master
lhiven 2 years ago
parent f17e903e15
commit 38206d24ed

@ -0,0 +1,73 @@
using Rs.MotionPlat.Flow;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using static Rs.MotionPlat.Commom.SchedulingMessageBox;
namespace Rs.MotionPlat.Commom
{
public class TestCenterMessageBox
{
private int ID;
private SchedulingMessageBox msgBox;
private ManualResetEvent msgRecivedEvent;
public TestCenterMessageBox()
{
msgBox = new SchedulingMessageBox();
msgRecivedEvent = new ManualResetEvent(false);
}
public void Show(int id,string message,ETipButton button,Dictionary<ETipButton,string> buttonTexts)
{
ID = id;
msgBox.ButtonContexts = buttonTexts;
msgBox.Message = message;
msgBox.Button = button;
msgBox.Instruction = EInstruction.ShowMessage;
msgBox.ID = id;
TestCenter.Instance.ShowMsgBox(msgBox);
TestCenterMessageBoxManager.Add(id, this);
}
public SchedulingMessageBox Result;
public void Recived(SchedulingMessageBox result)
{
Result = result;
msgRecivedEvent.Set();
}
public SchedulingMessageBox WaitResult()
{
msgRecivedEvent.WaitOne();
TestCenterMessageBoxManager.Remove(ID);
return Result;
}
}
public class TestCenterMessageBoxManager
{
private static Dictionary<int, TestCenterMessageBox> msgBoxDic = new Dictionary<int, TestCenterMessageBox>();
public static void Add(int id,TestCenterMessageBox msgBox)
{
msgBoxDic.Add(id,msgBox);
}
public static TestCenterMessageBox GetMsgbox(int id)
{
if(msgBoxDic.ContainsKey(id))
return msgBoxDic[id];
return null;
}
public static void Remove(int id)
{
if( msgBoxDic.ContainsKey(id))
msgBoxDic.Remove(id);
}
}
}

@ -123,6 +123,7 @@
<Compile Include="Commom\QifuManager.cs" />
<Compile Include="Commom\Scheduling.cs" />
<Compile Include="Commom\SlotPoint.cs" />
<Compile Include="Commom\TestCenterMessageBox.cs" />
<Compile Include="Commom\TrayPointManager.cs" />
<Compile Include="Commom\TurnoverSlotOffset.cs" />
<Compile Include="Commom\VacManager.cs" />

Loading…
Cancel
Save