|
|
|
|
using Microsoft.SqlServer.Server;
|
|
|
|
|
using Newtonsoft.Json.Converters;
|
|
|
|
|
using Newtonsoft.Json;
|
|
|
|
|
using Rs.MotionPlat.Flow;
|
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
using static Rs.MotionPlat.Commom.SchedulingAlarms;
|
|
|
|
|
using static Rs.MotionPlat.Commom.SchedulingMessageBox;
|
|
|
|
|
using System.Threading;
|
|
|
|
|
using Rs.MotionPlat.Entitys;
|
|
|
|
|
using Rs.Framework;
|
|
|
|
|
|
|
|
|
|
namespace Rs.MotionPlat.Commom
|
|
|
|
|
{
|
|
|
|
|
public class AlarmMsg
|
|
|
|
|
{
|
|
|
|
|
static ETipButton Show(AlarmItem alarmInfo)
|
|
|
|
|
{
|
|
|
|
|
SchedulingAlarms alarms = new SchedulingAlarms();
|
|
|
|
|
alarms.Alarms.Add(alarmInfo);
|
|
|
|
|
alarms.GroupID = 0;
|
|
|
|
|
alarms.TurnoverID = 0;
|
|
|
|
|
alarms.Instruction = EInstruction.SetAlarms;
|
|
|
|
|
string content = JsonConvert.SerializeObject(alarms, new StringEnumConverter());
|
|
|
|
|
TestCenter.Instance.Send(content, Encoding.UTF8,true);
|
|
|
|
|
//信息发出去只有就等待
|
|
|
|
|
while (true)
|
|
|
|
|
{
|
|
|
|
|
AlarmItem? alarm = TestCenter.Instance.GetAlarm(alarmInfo.NO);
|
|
|
|
|
if(alarm != null)
|
|
|
|
|
{
|
|
|
|
|
return alarm.Value.Button;
|
|
|
|
|
}
|
|
|
|
|
Thread.Sleep(500);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static ETipButton Show(int no, AlarmEntity alarmInfo,ETipButton button, Dictionary<ETipButton, string> buttonText)
|
|
|
|
|
{
|
|
|
|
|
AlarmItem msg = new AlarmItem();
|
|
|
|
|
msg.NO = no;
|
|
|
|
|
msg.ZH = alarmInfo.CN;
|
|
|
|
|
msg.EN = alarmInfo.EN;
|
|
|
|
|
msg.KO = alarmInfo.KO;
|
|
|
|
|
msg.Button = button;
|
|
|
|
|
msg.ButtonContexts = buttonText;
|
|
|
|
|
return Show(msg);
|
|
|
|
|
}
|
|
|
|
|
public static ETipButton ShowNoButton(int no, AlarmEntity alarmInfo)
|
|
|
|
|
{
|
|
|
|
|
AlarmItem msg = new AlarmItem();
|
|
|
|
|
msg.NO = no;
|
|
|
|
|
msg.ZH = alarmInfo.CN;
|
|
|
|
|
msg.EN = alarmInfo.EN;
|
|
|
|
|
msg.KO = alarmInfo.KO;
|
|
|
|
|
msg.Button = ETipButton.None;
|
|
|
|
|
return Show(msg);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|