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
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace SunVoteARSPPT
{
public class ARSSequence : IResponse
{
/// <summary>
/// 排序类
/// </summary>
public SunVote.Sequence Sequence = null;
/// <summary>
/// 构造函数
/// </summary>
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);
}
/// <summary>
/// 键盘状态事件
/// </summary>
/// <param name="BaseTag"></param>
/// <param name="KeyID"></param>
/// <param name="KeyValue"></param>
/// <param name="KeyTime"></param>
void Sequence_KeyStatus(string BaseTag, int KeyID, string KeyValue, double KeyTime)
{
Sequence_KeyStatusSN(BaseTag, KeyID.ToString(), KeyValue, KeyTime);
}
#region IResponse 成员
/// <summary>
/// 反馈事件
/// </summary>
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();
}
}
/// <summary>
/// 基站连接
/// </summary>
public SunVote.BaseConnection BaseConnection { get; set; }
/// <summary>
/// 幻灯片Tag值
/// </summary>
public TagSet TagSet { get; set; }
/// <summary>
/// 反馈类型
/// </summary>
public ResponseType ResponseType { get; set; }
#endregion
}
}
|