ARSText.cs 3.89 KB
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using GeneralLib;

namespace SunVoteARSPPT
{
    public class ARSText : IResponse
    {
        /// <summary>
        /// 数字评分类
        /// </summary>
        public SunVote.Cloze Text = null;

        /// <summary>
        /// 构造函数
        /// </summary>
        public ARSText()
        {
            Text = new SunVote.Cloze();
            Text.KeyStatus += new SunVote.IClozeEvents_KeyStatusEventHandler(Text_KeyStatus);            
            Text.KeyStatusSN += new SunVote.IClozeEvents_KeyStatusSNEventHandler(Text_KeyStatusSN);

            //PVS事件。杨斌 2015-03-17
            FrmPvsServer.GetFrmPvs().OnKeyVote += myPVS_KeyVote;

            TagSet = new TagSet();
        }

        void myPVS_KeyVote(int ID, int iMode, string sInfo)
        {
            string KeyValue = ConvertOper.DoNumberString(sInfo);

            ResponsePar ObjResponseValue = new ResponsePar();
            //ObjResponseValue.BaseTag = BaseTag;
            ObjResponseValue.KeyID = ID.ToString();
            ObjResponseValue.KeyValue = KeyValue;
            ObjResponseValue.Speed = 0;

            if (ResponseEventHander != null)
                ResponseEventHander(ObjResponseValue);
        }

        void Text_KeyStatusSN(string BaseTag, string KeySN, string KeyValue, double KeyTime)
        {
            KeyValue = ConvertOper.DoNumberString(KeyValue);//杨斌 2013-08-29

            ResponsePar ObjResponseValue = new ResponsePar();
            ObjResponseValue.BaseTag = BaseTag;
            ObjResponseValue.KeyID = KeySN;
            ObjResponseValue.KeyValue = KeyValue;
            ObjResponseValue.Speed = KeyTime;
            ResponseEventHander(ObjResponseValue);
        }

        /// <summary>
        /// 键盘状态
        /// </summary>
        /// <param name="BaseTag"></param>
        /// <param name="KeyID"></param>
        /// <param name="KeyValue"></param>
        /// <param name="KeyTime"></param>
        void Text_KeyStatus(string BaseTag, int KeyID, string KeyValue, double KeyTime)
        {
            Text_KeyStatusSN(BaseTag, KeyID.ToString(), KeyValue, KeyTime);
        }

        #region IResponse 成员

        public event ResponseEventHander ResponseEventHander;

        /// <summary>
        /// 修改:杨斌 2012-06-27
        /// </summary>
        public void Start()
        {
            if (GlobalInfo.GetSdkType() == 0)
            {
                Text.BaseConnection = BaseConnection;

                //修改模式 0:不允许修改,1:允许修改
                Text.ModifyMode = (TagSet.GetValue(TagKey.KeypadPara_ModifyMode).ToInt == 0 ? 1 : 0);
                //保密模式
                Text.SecrecyMode = 0;
                //填空类型
                Text.ClozeType = 0;
                //长度
                Text.MaxLength = 16;
                //答案提示模式
                Text.PromptMode = 0;
                //正确答案
                Text.CorrectAnswer = "";

                //启动模式
                Text.StartMode = 1;
                Text.Start();
            }
            else if (GlobalInfo.GetSdkType() == 1)
            {

            }
        }

        public void Stop()
        {            
            if (GlobalInfo.GetSdkType() == 0)
            {
                Text.Stop();
            }
            else if (GlobalInfo.GetSdkType() == 1)
            {
                //FrmPvsServer.GetFrmPvs().VoteStop();
            }
        }
        /// <summary>
        /// 基站连接类
        /// </summary>
        public SunVote.BaseConnection BaseConnection { get; set; }
        /// <summary>
        /// 幻灯片Tag值
        /// </summary>
        public TagSet TagSet { get; set; }
        /// <summary>
        /// 反馈类型
        /// </summary>
        public ResponseType ResponseType { get; set; }

        #endregion
    }
}