PanelRankMVP.cs
11 KB
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
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Microsoft.Office.Interop.PowerPoint;
using GeneralLib;
namespace SunVoteARSPPT
{
public partial class PanelRankMVP : UserControl, IPanel, IPanelChange
{
TagSet mTagSet = null;
public TagSet TagSet
{
get { return mTagSet; }
set
{
mTagSet = value;
//ucKeypadPara.TagSet = value;
}
}
private bool IsGroupRank = false;
private bool IsLoad = false;
public PanelRankMVP()
{
InitializeComponent();
//IsGroupRank = isGroup;
FrmSystemSet.LanguageSetEvent += new FrmSystemSet.LanguageSetEventHander(FrmSystemSet_LanguageSetEvent);
FrmVoteBar.PanelEnabledEvent += new FrmVoteBar.PanelEnabledEventHander(FrmVoteBar_PanelEnabledEvent);
gbxRankSet.Resize += gbxRankSet_Resize;
//设置控件大小
//this.Height = ucKeypadPara.Bottom;
GlobalInfo.SysLanguage.SetLanguage(this.Name, this);
}
void gbxRankSet_Resize(object sender, EventArgs e)
{
int pos = gbxRankSet.ClientSize.Width / 2;
int w = pos - 3;
cboGroupType.Left = pos;
cboGroupType.Width = w;
cboColShow.Left = pos;
cboColShow.Width = w;
cboRankCount.Left = pos;
cboRankCount.Width = w;
cboRankMode.Left = pos;
cboRankMode.Width = w;
}
private void InitType()
{
RosterList rost = new RosterList();
if (rost.RosterEnabled)
rost.LoadCloumn(GlobalInfo.DBOperation);
cboColShow.Items.Clear();
if (IsGroupRank)
{
gbxRankSet.Text = GlobalInfo.SysLanguage.LPT.ReadString("PanelRankMVP", "RankSetGroup", "分组排行设置");
if (rost.RosterEnabled)
{
for (int i = 1; i < rost.Columns.Count; i++)
{
cboColShow.Items.Add(rost.Columns[i].ColumnName);
}
}
Presentation pres = Globals.SunVoteARSAddIn.Application.ActivePresentation;
if (pres != null)
{
foreach (Slide sld in pres.Slides)
{
TagSet tagSet = new TagSet(sld.Tags);
ResponseType type = ResponseTypeName.GetEnum((tagSet.GetValue(TagKey.ResponseType).Value));
if (type == ResponseType.Group)
{
string groupName = tagSet.GetValue(TagKey.Slide_GroupName).Value;
//string title = PPTOper.GetSlideTitle(sld);
cboColShow.Items.Add(groupName);
}
}
}
}
else
{
gbxRankSet.Text = GlobalInfo.SysLanguage.LPT.ReadString("PanelRankMVP", "RankSetVoter", "人员排行设置");
if (rost.RosterEnabled)
{
for (int i = 0; i < rost.Columns.Count; i++)
{
cboColShow.Items.Add(rost.Columns[i].ColumnName);
}
}
else
{
cboColShow.Items.Add(GlobalInfo.SysLanguage.LPT.ReadString("FrmRankVoter", "KeypadID", "键盘编号"));
}
}
cboRankCount.Items.Clear();
for (int i = 1; i <= 10; i++)
{
cboRankCount.Items.Add(i.ToString());
}
cboRankMode.Items.Clear();
cboRankMode.Items.Add(GlobalInfo.SysLanguage.LPT.ReadString("PanelRankMVP", "RankSetMode1", "向前累计"));
cboRankMode.Items.Add(GlobalInfo.SysLanguage.LPT.ReadString("PanelRankMVP", "RankSetMode2", "上一张"));
cboRankMode.Items.Add(GlobalInfo.SysLanguage.LPT.ReadString("PanelRankMVP", "RankSetMode3", "自定义选择"));
}
void FrmVoteBar_PanelEnabledEvent(bool enabled)
{
this.Enabled = enabled;
}
void FrmSystemSet_LanguageSetEvent()
{
GlobalInfo.SysLanguage.SetLanguage(this.Name, this);
//LoadData();//屏蔽此行。杨斌 2014-11-05
}
public Color PanelColor
{
get
{
return this.BackColor;
}
set
{
this.BackColor = value;
//gbxChoise.BackColor = value;
}
}
/// <summary>
/// 加载参数面板数据
/// </summary>
public void LoadData()
{
return;
IsLoad = true;
InitType();
try
{
cboRankMode.SelectedIndex = TagSet.LoadValue(TagKey.RankChartRankMode, 0).ToInt;
}
catch
{
cboRankMode.SelectedIndex = 0;
}
string showName = TagSet.LoadValue(TagKey.RankChartColShow, "").Value;
if ((showName.Length < 1) && (cboColShow.Items.Count > 0))
{
if ((GlobalInfo.response.ShowNameCol.Length > 0) && (cboRankMode.SelectedIndex == 0))
{
if (cboColShow.Items.Contains(GlobalInfo.response.ShowNameCol))
showName = GlobalInfo.response.ShowNameCol;
else
showName = cboColShow.Items[0].ToString();
}
else
showName = cboColShow.Items[0].ToString();
}
ComboBoxOper.SetComboText(cboColShow, showName);
//切换名单导致选择项为-1,重新选择。杨斌 2015-03-06
if (cboColShow.SelectedIndex < 0)
{
if (cboColShow.Items.Count > 0)
{
if (GlobalInfo.response.EnableList)
{
if (cboColShow.Items.Count >= 2)
showName = cboColShow.Items[1].ToString();
}
else
showName = cboColShow.Items[0].ToString();
ComboBoxOper.SetComboText(cboColShow, showName);
}
}
//杨斌 2014-09-12
string setShow = TagSet.GetValue(TagKey.RankChartColShow).Value;
if (setShow != showName)
{
bool btemp = TagSet.ReadOnlyPPT;
TagSet.ReadOnlyPPT = false;
TagSet.SetValue(TagKey.RankChartColShow, showName);
TagSet.ReadOnlyPPT = btemp;
}
ComboBoxOper.SetComboText(cboRankCount, TagSet.LoadValue(TagKey.RankChartRankCount, "3").Value);
//ucKeypadPara.LoadData();
//ControlOper.TrySetNumericUpDownValue(nudOptionCount, TagSet.LoadValue(TagKey.Group_OptionCount, nudOptionCount.Value).ToInt);
IsLoad = false;
ShowRankChart(Globals.SunVoteARSAddIn.PPTEdit.SlideEdit, true);//beInit改成true。杨斌 2018-04-03
}
public void ChangeData(TagKey tagKey, object value)
{
//if (tagKey == TagKey.Group_OptionCount)
// ControlOper.TrySetNumericUpDownValue(nudOptionCount, TagSet.LoadValue(tagKey, nudOptionCount.Value).ToInt);
}
private void PanelRankChart_Load(object sender, EventArgs e)
{
//GlobalInfo.SysLanguage.SetLanguage(this.Name, this);
//InitType();
}
private void cboGroupType_SelectedIndexChanged(object sender, EventArgs e)
{
}
private void cboColShow_SelectedIndexChanged(object sender, EventArgs e)
{
//if (IsLoad) return;
////if (TagSet.ReadOnlyPPT) return;
//TagSet.SetValue(TagKey.RankChartColShow, cboColShow.Text);
//ShowRankChart(Globals.SunVoteARSAddIn.PPTEdit.SlideEdit, true);//杨斌 2014-09-04
}
private void cboRankCount_SelectedIndexChanged(object sender, EventArgs e)
{
//if (IsLoad) return;
////if (TagSet.ReadOnlyPPT) return;
//TagSet.SetValue(TagKey.RankChartRankCount, cboRankCount.Text);
//ShowRankChart(Globals.SunVoteARSAddIn.PPTEdit.SlideEdit, true);//杨斌 2014-09-04
}
private void cboRankMode_SelectedIndexChanged(object sender, EventArgs e)
{
//if (IsLoad) return;
////if (TagSet.ReadOnlyPPT) return;
//if (cboRankMode.SelectedIndex == 2)
//{
// FrmChartRankSet frmSet = new FrmChartRankSet();
// frmSet.ShowDialog();
// if (frmSet.DialogResult != DialogResult.OK)
// {
// try
// {
// cboRankMode.SelectedIndex = TagSet.LoadValue(TagKey.RankChartRankMode, 0).ToInt;
// }
// catch
// {
// cboRankMode.SelectedIndex = 0;
// }
// return;
// }
//}
//TagSet.SetValue(TagKey.RankChartRankMode, cboRankMode.SelectedIndex);
//ShowRankChart(Globals.SunVoteARSAddIn.PPTEdit.SlideEdit, true);//杨斌 2014-09-04
}
public void ShowRankChart(Slide sld, bool beInit)
{
return;
//杨斌 2014-11-05
if (FrmSystemSet.IsChangingLanguage)
return;
//int count = TagSet.GetValue(TagKey.RankChartRankCount).ToInt;
//string[] aryOpt = new string[count];
//double[] aryScore = new double[count];
//for (int i = 0; i < count; i++)
//{
// aryOpt[i] = "姓名" + (i + 1);
// aryScore[i] = 60 + i;
//}
//string optionText = PPTOper.FormatShapeOptionText(aryOpt);
////插入选项文本
//Shape sha = PPTOper.GetOptionTextLinkShape(sld);
//if (sha == null)
// PPTOper.AddShapeOptionText(sld, optionText, false);
//else
// PPTOper.SetShapeOptionText(sha, optionText, false);
//////2012-11-21 数据字体根据选项个数变化 赵丽
//PPTOper.SetFontSize(count, TagSet);
Shape shaCha = null;
//bool beInit = true;//传参。杨斌 2014-09-04
foreach (Shape s in sld.Shapes)
{
if (s.Name == "pic")
{
shaCha = s;
//shaCha.Delete();
//beInit = false;//传参。杨斌 2014-09-04
break;
}
}
Globals.SunVoteARSAddIn.PPTEdit.InitChart(beInit, sld);
}
}
}