StephaneLenclud@191
|
1 |
//
|
StephaneLenclud@191
|
2 |
// Copyright (C) 2014-2015 Stéphane Lenclud.
|
StephaneLenclud@191
|
3 |
//
|
StephaneLenclud@191
|
4 |
// This file is part of SharpDisplayManager.
|
StephaneLenclud@191
|
5 |
//
|
StephaneLenclud@191
|
6 |
// SharpDisplayManager is free software: you can redistribute it and/or modify
|
StephaneLenclud@191
|
7 |
// it under the terms of the GNU General Public License as published by
|
StephaneLenclud@191
|
8 |
// the Free Software Foundation, either version 3 of the License, or
|
StephaneLenclud@191
|
9 |
// (at your option) any later version.
|
StephaneLenclud@191
|
10 |
//
|
StephaneLenclud@191
|
11 |
// SharpDisplayManager is distributed in the hope that it will be useful,
|
StephaneLenclud@191
|
12 |
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
StephaneLenclud@191
|
13 |
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
StephaneLenclud@191
|
14 |
// GNU General Public License for more details.
|
StephaneLenclud@191
|
15 |
//
|
StephaneLenclud@191
|
16 |
// You should have received a copy of the GNU General Public License
|
StephaneLenclud@191
|
17 |
// along with SharpDisplayManager. If not, see <http://www.gnu.org/licenses/>.
|
StephaneLenclud@191
|
18 |
//
|
StephaneLenclud@191
|
19 |
|
StephaneLenclud@191
|
20 |
using System;
|
StephaneLenclud@191
|
21 |
using System.Collections.Generic;
|
StephaneLenclud@191
|
22 |
using System.ComponentModel;
|
StephaneLenclud@191
|
23 |
using System.Data;
|
StephaneLenclud@191
|
24 |
using System.Drawing;
|
StephaneLenclud@191
|
25 |
using System.Linq;
|
StephaneLenclud@191
|
26 |
using System.Text;
|
StephaneLenclud@191
|
27 |
using System.Threading.Tasks;
|
StephaneLenclud@191
|
28 |
using System.Windows.Forms;
|
StephaneLenclud@191
|
29 |
using System.ServiceModel;
|
StephaneLenclud@191
|
30 |
using System.ServiceModel.Channels;
|
StephaneLenclud@191
|
31 |
using System.Diagnostics;
|
StephaneLenclud@191
|
32 |
using SharpLib.Display;
|
StephaneLenclud@191
|
33 |
|
StephaneLenclud@191
|
34 |
|
StephaneLenclud@191
|
35 |
namespace SharpDisplayClient
|
StephaneLenclud@191
|
36 |
{
|
StephaneLenclud@191
|
37 |
public partial class FormClientTest : Form
|
StephaneLenclud@191
|
38 |
{
|
StephaneLenclud@191
|
39 |
public StartParams Params { get; set; }
|
StephaneLenclud@191
|
40 |
|
StephaneLenclud@191
|
41 |
//
|
StephaneLenclud@191
|
42 |
Client iClient;
|
StephaneLenclud@191
|
43 |
//
|
StephaneLenclud@191
|
44 |
ContentAlignment Alignment;
|
StephaneLenclud@191
|
45 |
TextField iTextFieldTop;
|
StephaneLenclud@191
|
46 |
|
StephaneLenclud@191
|
47 |
|
StephaneLenclud@191
|
48 |
/// <summary>
|
StephaneLenclud@191
|
49 |
/// Constructor
|
StephaneLenclud@191
|
50 |
/// </summary>
|
StephaneLenclud@191
|
51 |
public FormClientTest()
|
StephaneLenclud@191
|
52 |
{
|
StephaneLenclud@191
|
53 |
InitializeComponent();
|
StephaneLenclud@191
|
54 |
Alignment = ContentAlignment.MiddleLeft;
|
StephaneLenclud@191
|
55 |
iTextFieldTop = new TextField();
|
StephaneLenclud@191
|
56 |
}
|
StephaneLenclud@191
|
57 |
|
StephaneLenclud@191
|
58 |
public void OnCloseOrder()
|
StephaneLenclud@191
|
59 |
{
|
StephaneLenclud@191
|
60 |
CloseThreadSafe();
|
StephaneLenclud@191
|
61 |
}
|
StephaneLenclud@191
|
62 |
|
StephaneLenclud@191
|
63 |
/// <summary>
|
StephaneLenclud@191
|
64 |
///
|
StephaneLenclud@191
|
65 |
/// </summary>
|
StephaneLenclud@191
|
66 |
/// <param name="sender"></param>
|
StephaneLenclud@191
|
67 |
/// <param name="e"></param>
|
StephaneLenclud@191
|
68 |
private void MainForm_Load(object sender, EventArgs e)
|
StephaneLenclud@191
|
69 |
{
|
StephaneLenclud@191
|
70 |
iClient = new Client();
|
StephaneLenclud@191
|
71 |
iClient.CloseOrderEvent += OnCloseOrder;
|
StephaneLenclud@191
|
72 |
iClient.Open();
|
StephaneLenclud@191
|
73 |
|
StephaneLenclud@191
|
74 |
//Connect using unique name
|
StephaneLenclud@191
|
75 |
//string name = DateTime.Now.ToString("MM/dd/yyyy hh:mm:ss.fff tt");
|
StephaneLenclud@191
|
76 |
string name = "Client-" + (iClient.ClientCount() - 1);
|
StephaneLenclud@191
|
77 |
iClient.SetName(name);
|
StephaneLenclud@191
|
78 |
//Text = Text + ": " + name;
|
StephaneLenclud@191
|
79 |
Text = "[[" + name + "]] " + iClient.SessionId;
|
StephaneLenclud@191
|
80 |
|
StephaneLenclud@191
|
81 |
//
|
StephaneLenclud@191
|
82 |
textBoxTop.Text = iClient.Name;
|
StephaneLenclud@191
|
83 |
textBoxBottom.Text = iClient.SessionId;
|
StephaneLenclud@191
|
84 |
|
StephaneLenclud@191
|
85 |
if (Params != null)
|
StephaneLenclud@191
|
86 |
{
|
StephaneLenclud@191
|
87 |
//Parameters where specified use them
|
StephaneLenclud@191
|
88 |
if (Params.TopText != "")
|
StephaneLenclud@191
|
89 |
{
|
StephaneLenclud@191
|
90 |
textBoxTop.Text = Params.TopText;
|
StephaneLenclud@191
|
91 |
}
|
StephaneLenclud@191
|
92 |
|
StephaneLenclud@191
|
93 |
if (Params.BottomText != "")
|
StephaneLenclud@191
|
94 |
{
|
StephaneLenclud@191
|
95 |
textBoxBottom.Text = Params.BottomText;
|
StephaneLenclud@191
|
96 |
}
|
StephaneLenclud@191
|
97 |
|
StephaneLenclud@191
|
98 |
Location = Params.Location;
|
StephaneLenclud@191
|
99 |
//
|
StephaneLenclud@191
|
100 |
SetBasicLayoutAndText();
|
StephaneLenclud@191
|
101 |
}
|
StephaneLenclud@191
|
102 |
|
StephaneLenclud@191
|
103 |
}
|
StephaneLenclud@191
|
104 |
|
StephaneLenclud@191
|
105 |
|
StephaneLenclud@191
|
106 |
|
StephaneLenclud@191
|
107 |
public delegate void CloseConnectionDelegate();
|
StephaneLenclud@191
|
108 |
public delegate void CloseDelegate();
|
StephaneLenclud@191
|
109 |
|
StephaneLenclud@191
|
110 |
/// <summary>
|
StephaneLenclud@191
|
111 |
///
|
StephaneLenclud@191
|
112 |
/// </summary>
|
StephaneLenclud@191
|
113 |
public void CloseConnectionThreadSafe()
|
StephaneLenclud@191
|
114 |
{
|
StephaneLenclud@191
|
115 |
if (this.InvokeRequired)
|
StephaneLenclud@191
|
116 |
{
|
StephaneLenclud@191
|
117 |
//Not in the proper thread, invoke ourselves
|
StephaneLenclud@191
|
118 |
CloseConnectionDelegate d = new CloseConnectionDelegate(CloseConnectionThreadSafe);
|
StephaneLenclud@191
|
119 |
this.Invoke(d, new object[] { });
|
StephaneLenclud@191
|
120 |
}
|
StephaneLenclud@191
|
121 |
else
|
StephaneLenclud@191
|
122 |
{
|
StephaneLenclud@191
|
123 |
//We are in the proper thread
|
StephaneLenclud@191
|
124 |
if (IsClientReady())
|
StephaneLenclud@191
|
125 |
{
|
StephaneLenclud@191
|
126 |
string sessionId = iClient.SessionId;
|
StephaneLenclud@191
|
127 |
Trace.TraceInformation("Closing client: " + sessionId);
|
StephaneLenclud@191
|
128 |
iClient.Close();
|
StephaneLenclud@191
|
129 |
Trace.TraceInformation("Closed client: " + sessionId);
|
StephaneLenclud@191
|
130 |
}
|
StephaneLenclud@191
|
131 |
|
StephaneLenclud@191
|
132 |
iClient = null;
|
StephaneLenclud@191
|
133 |
}
|
StephaneLenclud@191
|
134 |
}
|
StephaneLenclud@191
|
135 |
|
StephaneLenclud@191
|
136 |
/// <summary>
|
StephaneLenclud@191
|
137 |
///
|
StephaneLenclud@191
|
138 |
/// </summary>
|
StephaneLenclud@191
|
139 |
public void CloseThreadSafe()
|
StephaneLenclud@191
|
140 |
{
|
StephaneLenclud@191
|
141 |
if (this.InvokeRequired)
|
StephaneLenclud@191
|
142 |
{
|
StephaneLenclud@191
|
143 |
//Not in the proper thread, invoke ourselves
|
StephaneLenclud@191
|
144 |
CloseDelegate d = new CloseDelegate(CloseThreadSafe);
|
StephaneLenclud@191
|
145 |
this.Invoke(d, new object[] { });
|
StephaneLenclud@191
|
146 |
}
|
StephaneLenclud@191
|
147 |
else
|
StephaneLenclud@191
|
148 |
{
|
StephaneLenclud@191
|
149 |
//We are in the proper thread
|
StephaneLenclud@191
|
150 |
Close();
|
StephaneLenclud@191
|
151 |
}
|
StephaneLenclud@191
|
152 |
}
|
StephaneLenclud@191
|
153 |
|
StephaneLenclud@191
|
154 |
|
StephaneLenclud@191
|
155 |
private void MainForm_FormClosing(object sender, FormClosingEventArgs e)
|
StephaneLenclud@191
|
156 |
{
|
StephaneLenclud@191
|
157 |
CloseConnectionThreadSafe();
|
StephaneLenclud@191
|
158 |
}
|
StephaneLenclud@191
|
159 |
|
StephaneLenclud@191
|
160 |
public bool IsClientReady()
|
StephaneLenclud@191
|
161 |
{
|
StephaneLenclud@191
|
162 |
return (iClient != null && iClient.IsReady());
|
StephaneLenclud@191
|
163 |
}
|
StephaneLenclud@191
|
164 |
|
StephaneLenclud@191
|
165 |
private void buttonAlignLeft_Click(object sender, EventArgs e)
|
StephaneLenclud@191
|
166 |
{
|
StephaneLenclud@191
|
167 |
Alignment = ContentAlignment.MiddleLeft;
|
StephaneLenclud@191
|
168 |
textBoxTop.TextAlign = HorizontalAlignment.Left;
|
StephaneLenclud@191
|
169 |
textBoxBottom.TextAlign = HorizontalAlignment.Left;
|
StephaneLenclud@191
|
170 |
}
|
StephaneLenclud@191
|
171 |
|
StephaneLenclud@191
|
172 |
private void buttonAlignCenter_Click(object sender, EventArgs e)
|
StephaneLenclud@191
|
173 |
{
|
StephaneLenclud@191
|
174 |
Alignment = ContentAlignment.MiddleCenter;
|
StephaneLenclud@191
|
175 |
textBoxTop.TextAlign = HorizontalAlignment.Center;
|
StephaneLenclud@191
|
176 |
textBoxBottom.TextAlign = HorizontalAlignment.Center;
|
StephaneLenclud@191
|
177 |
}
|
StephaneLenclud@191
|
178 |
|
StephaneLenclud@191
|
179 |
private void buttonAlignRight_Click(object sender, EventArgs e)
|
StephaneLenclud@191
|
180 |
{
|
StephaneLenclud@191
|
181 |
Alignment = ContentAlignment.MiddleRight;
|
StephaneLenclud@191
|
182 |
textBoxTop.TextAlign = HorizontalAlignment.Right;
|
StephaneLenclud@191
|
183 |
textBoxBottom.TextAlign = HorizontalAlignment.Right;
|
StephaneLenclud@191
|
184 |
}
|
StephaneLenclud@191
|
185 |
|
StephaneLenclud@191
|
186 |
private void buttonSetTopText_Click(object sender, EventArgs e)
|
StephaneLenclud@191
|
187 |
{
|
StephaneLenclud@191
|
188 |
//TextField top = new TextField(0, textBoxTop.Text, ContentAlignment.MiddleLeft);
|
StephaneLenclud@191
|
189 |
iTextFieldTop.Text = textBoxTop.Text;
|
StephaneLenclud@191
|
190 |
iTextFieldTop.Alignment = Alignment;
|
StephaneLenclud@191
|
191 |
bool res = iClient.SetField(iTextFieldTop);
|
StephaneLenclud@191
|
192 |
|
StephaneLenclud@191
|
193 |
if (!res)
|
StephaneLenclud@191
|
194 |
{
|
StephaneLenclud@191
|
195 |
MessageBox.Show("Create you fields first", "Field update error", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
StephaneLenclud@191
|
196 |
}
|
StephaneLenclud@191
|
197 |
|
StephaneLenclud@191
|
198 |
|
StephaneLenclud@191
|
199 |
}
|
StephaneLenclud@191
|
200 |
|
StephaneLenclud@191
|
201 |
private void buttonSetText_Click(object sender, EventArgs e)
|
StephaneLenclud@191
|
202 |
{
|
StephaneLenclud@191
|
203 |
SetBasicLayoutAndText();
|
StephaneLenclud@191
|
204 |
}
|
StephaneLenclud@191
|
205 |
|
StephaneLenclud@191
|
206 |
void SetBasicLayoutAndText()
|
StephaneLenclud@191
|
207 |
{
|
StephaneLenclud@191
|
208 |
//Set one column two lines layout
|
StephaneLenclud@191
|
209 |
TableLayout layout = new TableLayout(1, 2);
|
StephaneLenclud@191
|
210 |
iClient.SetLayout(layout);
|
StephaneLenclud@191
|
211 |
|
StephaneLenclud@191
|
212 |
//Set our fields
|
StephaneLenclud@191
|
213 |
iClient.CreateFields(new DataField[]
|
StephaneLenclud@191
|
214 |
{
|
StephaneLenclud@191
|
215 |
new TextField(textBoxTop.Text, Alignment, 0, 0),
|
StephaneLenclud@191
|
216 |
new TextField(textBoxBottom.Text, Alignment, 0, 1)
|
StephaneLenclud@191
|
217 |
});
|
StephaneLenclud@191
|
218 |
|
StephaneLenclud@191
|
219 |
}
|
StephaneLenclud@191
|
220 |
|
StephaneLenclud@191
|
221 |
private void buttonLayoutUpdate_Click(object sender, EventArgs e)
|
StephaneLenclud@191
|
222 |
{
|
StephaneLenclud@191
|
223 |
//Define a 2 by 2 layout
|
StephaneLenclud@191
|
224 |
TableLayout layout = new TableLayout(2,2);
|
StephaneLenclud@191
|
225 |
//Second column only takes up 25%
|
StephaneLenclud@191
|
226 |
layout.Columns[1].Width = 25F;
|
StephaneLenclud@191
|
227 |
//Send layout to server
|
StephaneLenclud@191
|
228 |
iClient.SetLayout(layout);
|
StephaneLenclud@191
|
229 |
|
StephaneLenclud@191
|
230 |
//
|
StephaneLenclud@191
|
231 |
RecordingField recording = new RecordingField();
|
StephaneLenclud@191
|
232 |
recording.IsActive = true;
|
StephaneLenclud@191
|
233 |
recording.Text = "Recording Tame of Gone until 22:05";
|
StephaneLenclud@191
|
234 |
//Set texts
|
StephaneLenclud@191
|
235 |
iClient.CreateFields(new DataField[]
|
StephaneLenclud@191
|
236 |
{
|
StephaneLenclud@191
|
237 |
new TextField(textBoxTop.Text, Alignment, 0, 0),
|
StephaneLenclud@191
|
238 |
new TextField(textBoxBottom.Text, Alignment, 0, 1),
|
StephaneLenclud@191
|
239 |
new TextField("Third text field", Alignment, 1, 0),
|
StephaneLenclud@191
|
240 |
new TextField("Forth text field", Alignment, 1, 1),
|
StephaneLenclud@191
|
241 |
recording
|
StephaneLenclud@191
|
242 |
});
|
StephaneLenclud@191
|
243 |
|
StephaneLenclud@191
|
244 |
}
|
StephaneLenclud@191
|
245 |
|
StephaneLenclud@191
|
246 |
private void buttonSetBitmap_Click(object sender, EventArgs e)
|
StephaneLenclud@191
|
247 |
{
|
StephaneLenclud@191
|
248 |
int x1 = 0;
|
StephaneLenclud@191
|
249 |
int y1 = 0;
|
StephaneLenclud@191
|
250 |
int x2 = 256;
|
StephaneLenclud@191
|
251 |
int y2 = 32;
|
StephaneLenclud@191
|
252 |
|
StephaneLenclud@191
|
253 |
Bitmap bitmap = new Bitmap(x2,y2);
|
StephaneLenclud@191
|
254 |
Pen blackPen = new Pen(Color.Black, 3);
|
StephaneLenclud@191
|
255 |
|
StephaneLenclud@191
|
256 |
// Draw line to screen.
|
StephaneLenclud@191
|
257 |
using (var graphics = Graphics.FromImage(bitmap))
|
StephaneLenclud@191
|
258 |
{
|
StephaneLenclud@191
|
259 |
graphics.DrawLine(blackPen, x1, y1, x2, y2);
|
StephaneLenclud@191
|
260 |
graphics.DrawLine(blackPen, x1, y2, x2, y1);
|
StephaneLenclud@191
|
261 |
}
|
StephaneLenclud@191
|
262 |
|
StephaneLenclud@191
|
263 |
DataField field = new BitmapField(bitmap);
|
StephaneLenclud@191
|
264 |
//field.ColumnSpan = 2;
|
StephaneLenclud@191
|
265 |
iClient.SetField(field);
|
StephaneLenclud@191
|
266 |
}
|
StephaneLenclud@191
|
267 |
|
StephaneLenclud@191
|
268 |
private void buttonBitmapLayout_Click(object sender, EventArgs e)
|
StephaneLenclud@191
|
269 |
{
|
StephaneLenclud@191
|
270 |
SetLayoutWithBitmap();
|
StephaneLenclud@191
|
271 |
}
|
StephaneLenclud@191
|
272 |
|
StephaneLenclud@191
|
273 |
/// <summary>
|
StephaneLenclud@191
|
274 |
/// Define a layout with a bitmap field on the left and two lines of text on the right.
|
StephaneLenclud@191
|
275 |
/// </summary>
|
StephaneLenclud@191
|
276 |
private void SetLayoutWithBitmap()
|
StephaneLenclud@191
|
277 |
{
|
StephaneLenclud@191
|
278 |
//Define a 2 by 2 layout
|
StephaneLenclud@191
|
279 |
TableLayout layout = new TableLayout(2, 2);
|
StephaneLenclud@191
|
280 |
//First column only takes 25%
|
StephaneLenclud@191
|
281 |
layout.Columns[0].Width = 25F;
|
StephaneLenclud@191
|
282 |
//Second column takes up 75%
|
StephaneLenclud@191
|
283 |
layout.Columns[1].Width = 75F;
|
StephaneLenclud@191
|
284 |
//Send layout to server
|
StephaneLenclud@191
|
285 |
iClient.SetLayout(layout);
|
StephaneLenclud@191
|
286 |
|
StephaneLenclud@191
|
287 |
//Set a bitmap for our first field
|
StephaneLenclud@191
|
288 |
int x1 = 0;
|
StephaneLenclud@191
|
289 |
int y1 = 0;
|
StephaneLenclud@191
|
290 |
int x2 = 64;
|
StephaneLenclud@191
|
291 |
int y2 = 64;
|
StephaneLenclud@191
|
292 |
|
StephaneLenclud@191
|
293 |
Bitmap bitmap = new Bitmap(x2, y2);
|
StephaneLenclud@191
|
294 |
Pen blackPen = new Pen(Color.Black, 3);
|
StephaneLenclud@191
|
295 |
|
StephaneLenclud@191
|
296 |
// Draw line to screen.
|
StephaneLenclud@191
|
297 |
using (var graphics = Graphics.FromImage(bitmap))
|
StephaneLenclud@191
|
298 |
{
|
StephaneLenclud@191
|
299 |
graphics.DrawLine(blackPen, x1, y1, x2, y2);
|
StephaneLenclud@191
|
300 |
graphics.DrawLine(blackPen, x1, y2, x2, y1);
|
StephaneLenclud@191
|
301 |
}
|
StephaneLenclud@191
|
302 |
|
StephaneLenclud@191
|
303 |
//Create a bitmap field from the bitmap we just created
|
StephaneLenclud@191
|
304 |
//We want our bitmap field to span across two rows
|
StephaneLenclud@191
|
305 |
BitmapField bitmapField = new BitmapField(bitmap, 0, 0, 1, 2);
|
StephaneLenclud@191
|
306 |
|
StephaneLenclud@191
|
307 |
//Set texts
|
StephaneLenclud@191
|
308 |
iClient.CreateFields(new DataField[]
|
StephaneLenclud@191
|
309 |
{
|
StephaneLenclud@191
|
310 |
bitmapField,
|
StephaneLenclud@191
|
311 |
new TextField(textBoxTop.Text, Alignment, 1, 0),
|
StephaneLenclud@191
|
312 |
new TextField(textBoxBottom.Text, Alignment, 1, 1)
|
StephaneLenclud@191
|
313 |
});
|
StephaneLenclud@191
|
314 |
|
StephaneLenclud@191
|
315 |
}
|
StephaneLenclud@191
|
316 |
|
StephaneLenclud@191
|
317 |
private void buttonIndicatorsLayout_Click(object sender, EventArgs e)
|
StephaneLenclud@191
|
318 |
{
|
StephaneLenclud@191
|
319 |
//Define a 2 by 4 layout
|
StephaneLenclud@191
|
320 |
TableLayout layout = new TableLayout(2, 4);
|
StephaneLenclud@191
|
321 |
//First column
|
StephaneLenclud@191
|
322 |
layout.Columns[0].Width = 87.5F;
|
StephaneLenclud@191
|
323 |
//Second column
|
StephaneLenclud@191
|
324 |
layout.Columns[1].Width = 12.5F;
|
StephaneLenclud@191
|
325 |
//Send layout to server
|
StephaneLenclud@191
|
326 |
iClient.SetLayout(layout);
|
StephaneLenclud@191
|
327 |
|
StephaneLenclud@191
|
328 |
//Create a bitmap for our indicators field
|
StephaneLenclud@191
|
329 |
int x1 = 0;
|
StephaneLenclud@191
|
330 |
int y1 = 0;
|
StephaneLenclud@191
|
331 |
int x2 = 32;
|
StephaneLenclud@191
|
332 |
int y2 = 16;
|
StephaneLenclud@191
|
333 |
|
StephaneLenclud@191
|
334 |
Bitmap bitmap = new Bitmap(x2, y2);
|
StephaneLenclud@191
|
335 |
Pen blackPen = new Pen(Color.Black, 3);
|
StephaneLenclud@191
|
336 |
|
StephaneLenclud@191
|
337 |
// Draw line to screen.
|
StephaneLenclud@191
|
338 |
using (var graphics = Graphics.FromImage(bitmap))
|
StephaneLenclud@191
|
339 |
{
|
StephaneLenclud@191
|
340 |
graphics.DrawLine(blackPen, x1, y1, x2, y2);
|
StephaneLenclud@191
|
341 |
graphics.DrawLine(blackPen, x1, y2, x2, y1);
|
StephaneLenclud@191
|
342 |
}
|
StephaneLenclud@191
|
343 |
|
StephaneLenclud@191
|
344 |
//Create a bitmap field from the bitmap we just created
|
StephaneLenclud@191
|
345 |
DataField indicator1 = new BitmapField(bitmap, 1, 0);
|
StephaneLenclud@191
|
346 |
//Create a bitmap field from the bitmap we just created
|
StephaneLenclud@191
|
347 |
DataField indicator2 = new BitmapField(bitmap, 1, 1);
|
StephaneLenclud@191
|
348 |
//Create a bitmap field from the bitmap we just created
|
StephaneLenclud@191
|
349 |
DataField indicator3 = new BitmapField(bitmap, 1, 2);
|
StephaneLenclud@191
|
350 |
//Create a bitmap field from the bitmap we just created
|
StephaneLenclud@191
|
351 |
DataField indicator4 = new BitmapField(bitmap, 1, 3);
|
StephaneLenclud@191
|
352 |
|
StephaneLenclud@191
|
353 |
//
|
StephaneLenclud@191
|
354 |
TextField textFieldTop = new TextField(textBoxTop.Text, Alignment, 0, 0, 1, 2);
|
StephaneLenclud@191
|
355 |
TextField textFieldBottom = new TextField(textBoxBottom.Text, Alignment, 0, 2, 1, 2);
|
StephaneLenclud@191
|
356 |
|
StephaneLenclud@191
|
357 |
//Set texts
|
StephaneLenclud@191
|
358 |
iClient.CreateFields(new DataField[]
|
StephaneLenclud@191
|
359 |
{
|
StephaneLenclud@191
|
360 |
textFieldTop,
|
StephaneLenclud@191
|
361 |
textFieldBottom,
|
StephaneLenclud@191
|
362 |
indicator1,
|
StephaneLenclud@191
|
363 |
indicator2,
|
StephaneLenclud@191
|
364 |
indicator3,
|
StephaneLenclud@191
|
365 |
indicator4
|
StephaneLenclud@191
|
366 |
});
|
StephaneLenclud@191
|
367 |
|
StephaneLenclud@191
|
368 |
}
|
StephaneLenclud@191
|
369 |
|
StephaneLenclud@191
|
370 |
private void buttonUpdateTexts_Click(object sender, EventArgs e)
|
StephaneLenclud@191
|
371 |
{
|
StephaneLenclud@191
|
372 |
|
StephaneLenclud@191
|
373 |
bool res = iClient.SetFields(new DataField[]
|
StephaneLenclud@191
|
374 |
{
|
StephaneLenclud@191
|
375 |
new TextField(textBoxTop.Text, Alignment,0,0),
|
StephaneLenclud@191
|
376 |
new TextField(textBoxBottom.Text, Alignment,0,1)
|
StephaneLenclud@191
|
377 |
});
|
StephaneLenclud@191
|
378 |
|
StephaneLenclud@191
|
379 |
if (!res)
|
StephaneLenclud@191
|
380 |
{
|
StephaneLenclud@191
|
381 |
MessageBox.Show("Create you fields first", "Field update error", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
StephaneLenclud@191
|
382 |
}
|
StephaneLenclud@191
|
383 |
|
StephaneLenclud@191
|
384 |
}
|
StephaneLenclud@191
|
385 |
|
StephaneLenclud@191
|
386 |
private void buttonLayoutOneTextField_Click(object sender, EventArgs e)
|
StephaneLenclud@191
|
387 |
{
|
StephaneLenclud@191
|
388 |
//Set one column one line layout
|
StephaneLenclud@191
|
389 |
TableLayout layout = new TableLayout(1, 1);
|
StephaneLenclud@191
|
390 |
iClient.SetLayout(layout);
|
StephaneLenclud@191
|
391 |
|
StephaneLenclud@191
|
392 |
//Set our fields
|
StephaneLenclud@191
|
393 |
iClient.CreateFields(new DataField[]
|
StephaneLenclud@191
|
394 |
{
|
StephaneLenclud@191
|
395 |
new TextField(textBoxTop.Text, Alignment)
|
StephaneLenclud@191
|
396 |
});
|
StephaneLenclud@191
|
397 |
}
|
StephaneLenclud@191
|
398 |
|
StephaneLenclud@191
|
399 |
private void numericUpDownPriority_ValueChanged(object sender, EventArgs e)
|
StephaneLenclud@191
|
400 |
{
|
StephaneLenclud@191
|
401 |
iClient.SetPriority((uint)numericUpDownPriority.Value);
|
StephaneLenclud@191
|
402 |
}
|
StephaneLenclud@261
|
403 |
|
StephaneLenclud@261
|
404 |
private void buttonTriggerEvents_Click(object sender, EventArgs e)
|
StephaneLenclud@261
|
405 |
{
|
StephaneLenclud@261
|
406 |
iClient.TriggerEventsByName(textBoxEventName.Text);
|
StephaneLenclud@261
|
407 |
}
|
StephaneLenclud@191
|
408 |
}
|
StephaneLenclud@191
|
409 |
}
|