using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace SunVoteARSPPT { public class ARSSequence : IResponse { /// /// 排序类 /// public SunVote.Sequence Sequence = null; /// /// 构造函数 /// public ARSSequence() { Sequence = new SunVote.Sequence(); Sequence.KeyStatus += new SunVote.ISequenceEvents_KeyStatusEventHandler(Sequence_KeyStatus); //杨斌 2015-01-09 Sequence.KeyStatusSN += new SunVote.ISequenceEvents_KeyStatusSNEventHandler(Sequence_KeyStatusSN); //PVS事件。杨斌 2015-03-17 FrmPvsServer.GetFrmPvs().OnKeyVote += myPVS_KeyVote; TagSet = new TagSet(); } void Sequence_KeyStatusSN(string BaseTag, string KeySN, string KeyValue, double KeyTime) { ResponsePar ObjResponseValue = new ResponsePar(); ObjResponseValue.BaseTag = BaseTag; ObjResponseValue.KeyID = KeySN; ObjResponseValue.KeyValue = KeyValue; ObjResponseValue.Speed = KeyTime; if (ResponseEventHander != null) ResponseEventHander(ObjResponseValue); } void myPVS_KeyVote(int ID, int iMode, string sInfo) { ResponsePar ObjResponseValue = new ResponsePar(); //ObjResponseValue.BaseTag = BaseTag; ObjResponseValue.KeyID = ID.ToString(); string KeyValue = ""; double KeyTime = 0; string[] ary = sInfo.Split(new char[] { ',' }); KeyValue = ary[0]; if (ary.Length >= 2) double.TryParse(ary[1], out KeyTime); ObjResponseValue.KeyValue = KeyValue; ObjResponseValue.Speed = KeyTime; if (ResponseEventHander != null) ResponseEventHander(ObjResponseValue); } /// /// 键盘状态事件 /// /// /// /// /// void Sequence_KeyStatus(string BaseTag, int KeyID, string KeyValue, double KeyTime) { Sequence_KeyStatusSN(BaseTag, KeyID.ToString(), KeyValue, KeyTime); } #region IResponse 成员 /// /// 反馈事件 /// public event ResponseEventHander ResponseEventHander; public void Start() { if (GlobalInfo.GetSdkType() == 0) { //设置参数 Sequence.BaseConnection = BaseConnection; //选项显示 0:按字母,1:按数字 Sequence.OptionsMode = TagSet.GetValue(TagKey.KeypadPara_OptionMode).ToInt == 1 ? 0 : 1;//杨斌 2012-06-25 //修改模式 0:不允许,1:允许 Sequence.ModifyMode = (TagSet.GetValue(TagKey.KeypadPara_ModifyMode).ToInt == 0 ? 1 : 0); //保密模式 0:不保密,1:保密 Sequence.SecrecyMode = 0; //提交模式 0:可缺选,1:需选出足够项目数,2:选项可多次重复输入 //Sequence.LessEnabled:0可缺选,1不可缺选,2允许重复选项(可缺选)。杨斌 2014-04-21 //Sequence.LessEnabled = TagSet.GetValue(TagKey.Order_IisN).ToInt; ////Sequence.LessEnabled = 0;//杨斌 2012-06-04 日本的不要 int IisN = TagSet.GetValue(TagKey.Order_IisN).ToInt; int AABB = TagSet.GetValue(TagKey.Order_AABB).ToInt; if (AABB == 1) { Sequence.LessEnabled = 2; } else { if (IisN == 1) Sequence.LessEnabled = 1; else Sequence.LessEnabled = 0; } //选项个数 Sequence.OptionalN = TagSet.GetValue(TagKey.Order_OptionCount).ToInt; //可选个数 Sequence.OptionalCount = TagSet.GetValue(TagKey.Order_OptionLimit).ToInt; //启动模式 0:继续,1:清空继续开始,2:重新提交并继续开始 Sequence.StartMode = 1; Sequence.Start(); } if (GlobalInfo.GetSdkType() == 1) { //选项编号模式 0:按字母,1:按数字 int iOptionsMode = TagSet.GetValue(TagKey.KeypadPara_OptionMode).ToInt == 1 ? 0 : 1; int iModifyMode = TagSet.GetValue(TagKey.KeypadPara_ModifyMode).ToInt == 0 ? 1 : 0; //杨斌 2015-05-22 if (ResponseType == SunVoteARSPPT.ResponseType.Order) iOptionsMode = 1; //选项个数 int iMax = TagSet.GetValue(TagKey.Order_OptionCount).ToInt; //可选个数 int iMin = TagSet.GetValue(TagKey.Order_OptionLimit).ToInt; int pvsVoteMode = 0; string pvsVoteSetting = ""; pvsVoteMode = 5; pvsVoteSetting = (iOptionsMode == 0 ? 1 : 2) + "," + iMax + "," + iMin; //排序模式,只支持8位。杨斌 2015-05-15 pvsVoteSetting = (iOptionsMode == 0 ? 3 : 4) + "," + iMax + "," + iMin; FrmPvsServer.GetFrmPvs().VoteStart(pvsVoteMode, pvsVoteSetting); } } public void Stop() { if (GlobalInfo.GetSdkType() == 0) { Sequence.Stop(); } else if (GlobalInfo.GetSdkType() == 1) { FrmPvsServer.GetFrmPvs().VoteStop(); } } /// /// 基站连接 /// public SunVote.BaseConnection BaseConnection { get; set; } /// /// 幻灯片Tag值 /// public TagSet TagSet { get; set; } /// /// 反馈类型 /// public ResponseType ResponseType { get; set; } #endregion } }