|
|
|
@ -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);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|