Blame view

SunVoteARSPPT/SDK/ARS/ARSSignIn.cs 4.03 KB
20c0108c   wutaian   xx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
  using System;
  using System.Collections.Generic;
  using System.Linq;
  using System.Text;
  
  namespace SunVoteARSPPT
  {
      public class ARSSignIn : IResponse
      {
          /// <summary>
          /// 签到类
          /// </summary>
          public SunVote.SignIn SignIn = null;
  
          private bool IsSignInCode = false;
  
          /// <summary>
          /// 签到构造函数
          /// 杨斌 2015-04-28
          /// </summary>
          public ARSSignIn(bool isSignInCode = false)
          {
              IsSignInCode = isSignInCode;
  
              SignIn = new SunVote.SignIn();
              SignIn.KeyStatus += new SunVote.ISignInEvents_KeyStatusEventHandler(SignIn_KeyStatus);
              //杨斌 2015-01-09
              SignIn.KeyStatusSN += new SunVote.ISignInEvents_KeyStatusSNEventHandler(SignIn_KeyStatusSN);
              
              //PVS事件。杨斌 2015-03-17
              FrmPvsServer.GetFrmPvs().OnKeyVote += myPVS_KeyVote;
  
              TagSet = new TagSet();
          }
  
          ////杨斌 2015-04-28
          //public ARSSignIn(bool isSignInCode)
          //    : this()
          //{
          //    IsSignInCode = isSignInCode;
          //}
  
          void SignIn_KeyStatusSN(string BaseTag, string KeySN, int ValueType, string KeyValue, double KeyTime)
          {
              ResponsePar ObjResponseValue = new ResponsePar();
              ObjResponseValue.BaseTag = BaseTag;
              ObjResponseValue.KeyID = KeySN;
              ObjResponseValue.KeyValue = KeyValue;
              ObjResponseValue.Speed = 0;
              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();
              ObjResponseValue.KeyValue = sInfo;
              ObjResponseValue.Speed = 0;
              if (ResponseEventHander != null)
                  ResponseEventHander(ObjResponseValue);
          }
  
          /// <summary>
          /// 键盘状态事件
          /// </summary>
          /// <param name="BaseTag"></param>
          /// <param name="KeyID"></param>
          /// <param name="ValueType"></param>
          /// <param name="KeyValue"></param>
          void SignIn_KeyStatus(string BaseTag, int KeyID, int ValueType, string KeyValue)
          {
              SignIn_KeyStatusSN(BaseTag, KeyID.ToString(), ValueType, KeyValue, 0);
          }
  
          #region IResponse 成员
          /// <summary>
          /// 反馈事件
          /// </summary>
          public event ResponseEventHander ResponseEventHander;
  
          /// <summary>
          /// 开始签到
          /// </summary>
          public void Start()
          {
              if (GlobalInfo.GetSdkType() == 0)
              {
                  //连接基站
                  SignIn.BaseConnection = BaseConnection;
                  //杨斌 2015-04-28
                  //SignIn.Mode = 0;
                  SignIn.Mode = IsSignInCode ? 1 : 0;
  
                  SignIn.StartMode = 1;
                  SignIn.BackgroundSignIn = false;
                  SignIn.Start();
              }
              else if (GlobalInfo.GetSdkType() == 1)
              {
                  int pvsVoteMode = 1;
                  string pvsVoteSetting = "1";
                  FrmPvsServer.GetFrmPvs().VoteStart(pvsVoteMode, pvsVoteSetting);
              }
          }
  
          /// <summary>
          /// 停止签到
          /// </summary>
          public void Stop()
          {
              if (GlobalInfo.GetSdkType() == 0)
                  SignIn.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
      }
  }