-
Notifications
You must be signed in to change notification settings - Fork 0
/
AdapterTabPanel.cs
359 lines (335 loc) · 18.2 KB
/
AdapterTabPanel.cs
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
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
// Type: Intel.Mobile.WiMAXCU.UI.Dashboard.AdapterTabPanel
// Assembly: WiMAXCU, Version=6.2.4357.25644, Culture=neutral, PublicKeyToken=null
// MVID: 3C622363-C72C-43B7-9311-DD8942A58F18
// Assembly location: E:\Extracted\program files\Intel\WiMAX\Bin\WiMAXCU.exe
using Intel.Mobile.WiMAXCU.BizTier;
using Intel.Mobile.WiMAXCU.Common;
using Intel.Mobile.WiMAXCU.SDKInterop;
using Intel.Mobile.WiMAXCU.UI.CustomControls;
using System;
using System.ComponentModel;
using System.Diagnostics;
using System.Drawing;
using System.Threading;
using System.Windows.Forms;
namespace Intel.Mobile.WiMAXCU.UI.Dashboard
{
public class AdapterTabPanel : UserControl
{
private Container components;
private CustomLabelSeparator AdapterTabPanel_SupportedAdaptersLabelSeparator;
private Label AdapterTabPanel_OverviewLbl;
private CustomLabelRoundedCorners AdapterTabPanel_ModelValueLbl;
private Label AdapterTabPanel_ModelLbl;
private CustomLabelRoundedCorners AdapterTabPanel_MACAddressValueLbl;
private CustomLabelRoundedCorners AdapterTabPanel_ManufacturerValueLbl;
private Label AdapterTabPanel_ManufacturerLbl;
private Label AdapterTabPanel_MACAddressLbl;
private Panel AdapterTabPanel_AdapterDetailsPanel;
private CustomLabelSeparator AdapterTabPanel_DeviceManagementSeparator;
private Label AdapterTabPanel_ResetLbl;
private CustomButtonPush AdapterTabPanel_ResetPushBtn;
private bool _timeoutOccurred;
private string _vendorName;
private string _hwName;
private string _macAddress;
private static int _iResult;
private AdvancedPanel _parentPanel;
private System.Windows.Forms.Timer _timeoutTimer;
private CustomMessageBox cmb1;
public AdvancedPanel ParentPanel
{
get
{
return this._parentPanel;
}
set
{
this._parentPanel = value;
}
}
public AdapterTabPanel()
{
this.InitializeComponent();
this.CustomInitializeComponents();
}
protected override void Dispose(bool disposing)
{
if (disposing && this.components != null)
this.components.Dispose();
base.Dispose(disposing);
}
private void InitializeComponent()
{
ComponentResourceManager componentResourceManager = new ComponentResourceManager(typeof (AdapterTabPanel));
this.AdapterTabPanel_SupportedAdaptersLabelSeparator = new CustomLabelSeparator();
this.AdapterTabPanel_OverviewLbl = new Label();
this.AdapterTabPanel_ModelValueLbl = new CustomLabelRoundedCorners();
this.AdapterTabPanel_ModelLbl = new Label();
this.AdapterTabPanel_MACAddressValueLbl = new CustomLabelRoundedCorners();
this.AdapterTabPanel_ManufacturerValueLbl = new CustomLabelRoundedCorners();
this.AdapterTabPanel_ManufacturerLbl = new Label();
this.AdapterTabPanel_MACAddressLbl = new Label();
this.AdapterTabPanel_AdapterDetailsPanel = new Panel();
this.AdapterTabPanel_DeviceManagementSeparator = new CustomLabelSeparator();
this.AdapterTabPanel_ResetLbl = new Label();
this.AdapterTabPanel_ResetPushBtn = new CustomButtonPush();
this.AdapterTabPanel_AdapterDetailsPanel.SuspendLayout();
this.SuspendLayout();
this.AdapterTabPanel_SupportedAdaptersLabelSeparator.BackColor = Color.White;
componentResourceManager.ApplyResources((object) this.AdapterTabPanel_SupportedAdaptersLabelSeparator, "AdapterTabPanel_SupportedAdaptersLabelSeparator");
this.AdapterTabPanel_SupportedAdaptersLabelSeparator.Name = "AdapterTabPanel_SupportedAdaptersLabelSeparator";
this.AdapterTabPanel_SupportedAdaptersLabelSeparator.TabStop = false;
componentResourceManager.ApplyResources((object) this.AdapterTabPanel_OverviewLbl, "AdapterTabPanel_OverviewLbl");
this.AdapterTabPanel_OverviewLbl.Name = "AdapterTabPanel_OverviewLbl";
this.AdapterTabPanel_ModelValueLbl.BackColor = Color.Transparent;
this.AdapterTabPanel_ModelValueLbl.BackgroundColor = Color.FromArgb(210, 234, 251);
this.AdapterTabPanel_ModelValueLbl.ControlType = ControlTypeEnum.TextBox;
componentResourceManager.ApplyResources((object) this.AdapterTabPanel_ModelValueLbl, "AdapterTabPanel_ModelValueLbl");
this.AdapterTabPanel_ModelValueLbl.Icon = (Bitmap) null;
this.AdapterTabPanel_ModelValueLbl.Name = "AdapterTabPanel_ModelValueLbl";
this.AdapterTabPanel_ModelValueLbl.TabStop = false;
this.AdapterTabPanel_ModelValueLbl.UniqueID = -1;
componentResourceManager.ApplyResources((object) this.AdapterTabPanel_ModelLbl, "AdapterTabPanel_ModelLbl");
this.AdapterTabPanel_ModelLbl.Name = "AdapterTabPanel_ModelLbl";
this.AdapterTabPanel_MACAddressValueLbl.BackColor = Color.Transparent;
this.AdapterTabPanel_MACAddressValueLbl.BackgroundColor = Color.FromArgb(210, 234, 251);
this.AdapterTabPanel_MACAddressValueLbl.ControlType = ControlTypeEnum.TextBox;
componentResourceManager.ApplyResources((object) this.AdapterTabPanel_MACAddressValueLbl, "AdapterTabPanel_MACAddressValueLbl");
this.AdapterTabPanel_MACAddressValueLbl.Icon = (Bitmap) null;
this.AdapterTabPanel_MACAddressValueLbl.Name = "AdapterTabPanel_MACAddressValueLbl";
this.AdapterTabPanel_MACAddressValueLbl.TabStop = false;
this.AdapterTabPanel_MACAddressValueLbl.UniqueID = -1;
this.AdapterTabPanel_ManufacturerValueLbl.BackColor = Color.Transparent;
this.AdapterTabPanel_ManufacturerValueLbl.BackgroundColor = Color.FromArgb(210, 234, 251);
this.AdapterTabPanel_ManufacturerValueLbl.ControlType = ControlTypeEnum.TextBox;
componentResourceManager.ApplyResources((object) this.AdapterTabPanel_ManufacturerValueLbl, "AdapterTabPanel_ManufacturerValueLbl");
this.AdapterTabPanel_ManufacturerValueLbl.Icon = (Bitmap) null;
this.AdapterTabPanel_ManufacturerValueLbl.Name = "AdapterTabPanel_ManufacturerValueLbl";
this.AdapterTabPanel_ManufacturerValueLbl.TabStop = false;
this.AdapterTabPanel_ManufacturerValueLbl.UniqueID = -1;
componentResourceManager.ApplyResources((object) this.AdapterTabPanel_ManufacturerLbl, "AdapterTabPanel_ManufacturerLbl");
this.AdapterTabPanel_ManufacturerLbl.Name = "AdapterTabPanel_ManufacturerLbl";
componentResourceManager.ApplyResources((object) this.AdapterTabPanel_MACAddressLbl, "AdapterTabPanel_MACAddressLbl");
this.AdapterTabPanel_MACAddressLbl.Name = "AdapterTabPanel_MACAddressLbl";
this.AdapterTabPanel_AdapterDetailsPanel.BackColor = Color.White;
this.AdapterTabPanel_AdapterDetailsPanel.Controls.Add((Control) this.AdapterTabPanel_ModelValueLbl);
this.AdapterTabPanel_AdapterDetailsPanel.Controls.Add((Control) this.AdapterTabPanel_MACAddressLbl);
this.AdapterTabPanel_AdapterDetailsPanel.Controls.Add((Control) this.AdapterTabPanel_ManufacturerLbl);
this.AdapterTabPanel_AdapterDetailsPanel.Controls.Add((Control) this.AdapterTabPanel_ManufacturerValueLbl);
this.AdapterTabPanel_AdapterDetailsPanel.Controls.Add((Control) this.AdapterTabPanel_ModelLbl);
this.AdapterTabPanel_AdapterDetailsPanel.Controls.Add((Control) this.AdapterTabPanel_MACAddressValueLbl);
componentResourceManager.ApplyResources((object) this.AdapterTabPanel_AdapterDetailsPanel, "AdapterTabPanel_AdapterDetailsPanel");
this.AdapterTabPanel_AdapterDetailsPanel.Name = "AdapterTabPanel_AdapterDetailsPanel";
this.AdapterTabPanel_DeviceManagementSeparator.BackColor = Color.White;
componentResourceManager.ApplyResources((object) this.AdapterTabPanel_DeviceManagementSeparator, "AdapterTabPanel_DeviceManagementSeparator");
this.AdapterTabPanel_DeviceManagementSeparator.Name = "AdapterTabPanel_DeviceManagementSeparator";
this.AdapterTabPanel_DeviceManagementSeparator.TabStop = false;
componentResourceManager.ApplyResources((object) this.AdapterTabPanel_ResetLbl, "AdapterTabPanel_ResetLbl");
this.AdapterTabPanel_ResetLbl.Name = "AdapterTabPanel_ResetLbl";
this.AdapterTabPanel_ResetPushBtn.BackColor = Color.White;
this.AdapterTabPanel_ResetPushBtn.BtnColor = PushButtonColorEnum.BlueGrey;
this.AdapterTabPanel_ResetPushBtn.BtnDoubleEndCaps = false;
this.AdapterTabPanel_ResetPushBtn.BtnEnabled = true;
componentResourceManager.ApplyResources((object) this.AdapterTabPanel_ResetPushBtn, "AdapterTabPanel_ResetPushBtn");
this.AdapterTabPanel_ResetPushBtn.Name = "AdapterTabPanel_ResetPushBtn";
this.BackColor = Color.White;
this.Controls.Add((Control) this.AdapterTabPanel_DeviceManagementSeparator);
this.Controls.Add((Control) this.AdapterTabPanel_ResetLbl);
this.Controls.Add((Control) this.AdapterTabPanel_ResetPushBtn);
this.Controls.Add((Control) this.AdapterTabPanel_AdapterDetailsPanel);
this.Controls.Add((Control) this.AdapterTabPanel_OverviewLbl);
this.Controls.Add((Control) this.AdapterTabPanel_SupportedAdaptersLabelSeparator);
componentResourceManager.ApplyResources((object) this, "$this");
this.Name = "AdapterTabPanel";
this.AdapterTabPanel_AdapterDetailsPanel.ResumeLayout(false);
this.ResumeLayout(false);
this.PerformLayout();
}
public void InitPanel()
{
this.UpdateButtonState();
this.UpdateUI();
this.RegisterForEvents();
}
public void CleanUp()
{
this.UnregisterForEvents();
}
public void UpdateButtonState()
{
if (this._parentPanel.Blocked)
this.Cursor = Cursors.WaitCursor;
else
this.Cursor = Cursors.Default;
if (!MediaHandler.IntelCUIsInControl)
{
if (this.cmb1 != null && this.cmb1.Visible)
this.cmb1.Close();
this.AdapterTabPanel_ResetPushBtn.BtnEnabled = false;
}
else if (this._parentPanel.Blocked)
this.AdapterTabPanel_ResetPushBtn.BtnEnabled = false;
else
this.AdapterTabPanel_ResetPushBtn.BtnEnabled = true;
}
private void OnAdapterListChanged(object sender, object[] eventArgs)
{
this.UpdateUI();
}
private void OnStateChanged(object sender, object[] eventArgs)
{
this.UpdateButtonState();
}
private void OnIntelCUControlChanged(object sender, object[] eventArgs)
{
this.UpdateButtonState();
}
private void OnResetWiMAXDeviceComplete(object sender, object[] eventArgs)
{
if (this._parentPanel == null || !this._parentPanel.Visible || this._timeoutOccurred)
return;
this.Unblock();
this.UpdateButtonState();
if (AdapterTabPanel._iResult != 0)
{
ErrorHelper.ShowErrorDialog((Control) this, ErrorStringsHelper.GetString("General_ResetWiMAXDeviceFailed"), ErrorHelper.TranslateErrorCodeToMessage(AdapterTabPanel._iResult), (string) null, "ResetWiMAXDeviceFailed");
}
else
{
CustomMessageBox customMessageBox = new CustomMessageBox(AdvancedDlgStringHelper.GetString("AdapterTabPanel_ResetWiMAXDeviceSucceded"), CustomMessageBoxStyle.Ok);
customMessageBox.AccessibleName = "ResetWiMAXDeviceSucceededMB";
int num = (int) customMessageBox.CustomShowDialog((IWin32Window) this, false);
}
}
private void OnTimeoutTimerTick(object sender, EventArgs e)
{
if (this._parentPanel == null || !this._parentPanel.Visible)
return;
this.Unblock();
this.UpdateButtonState();
this._timeoutOccurred = true;
ErrorHelper.ShowErrorDialog((Control) this, ErrorStringsHelper.GetString("General_ResetWiMAXDeviceFailed"), "", (string) null, "ResetWiMAXDeviceFailed");
}
private void OnDeviceResetPushBtnPressed(object sender, EventArgs e)
{
if (NetworkHandler.ConnectedNetworks.Count > 0)
{
if (this.cmb1 == null)
{
this.cmb1 = new CustomMessageBox(AdvancedDlgStringHelper.GetString("AdapterTabPanel_ConfirmOperationBecauseConnected"), CustomMessageBoxStyle.YesNo);
this.cmb1.AccessibleName = "ConfirmResetDeviceMB";
}
if (!this.cmb1.Visible && this.cmb1.CustomShowDialog((IWin32Window) this._parentPanel, false) != DialogResult.Yes)
return;
}
if (!this.PrerequisitesMet())
return;
Logging.LogEvent(TraceModule.SDK, TraceLevel.Info, (object) this, "--> The user pressed the 'Reset WiMAX Adapter' button.");
this.Block();
if (this._timeoutTimer == null)
{
this._timeoutTimer = new System.Windows.Forms.Timer();
this._timeoutTimer.Interval = TimerSettings.AdaptersTabPanel_TimeoutTimer_Interval;
this._timeoutTimer.Tick += new EventHandler(this.OnTimeoutTimerTick);
this._timeoutTimer.Start();
}
else
this._timeoutTimer.Start();
this._timeoutOccurred = false;
AdapterTabPanel._iResult = 0;
ThreadPool.QueueUserWorkItem(new WaitCallback(this.DoAsyncResetWiMAXDevice));
}
private void CustomInitializeComponents()
{
this.AccessibleName = "AdapterTabPanel";
this.AdapterTabPanel_AdapterDetailsPanel.AccessibleName = "AdapterTabPanel_AdapterDetailsPanel";
this.AdapterTabPanel_DeviceManagementSeparator.AccessibleName = "AdapterTabPanel_DeviceManagementSeparator";
this.AdapterTabPanel_MACAddressLbl.AccessibleName = "AdapterTabPanel_MACAddressLbl";
this.AdapterTabPanel_MACAddressValueLbl.AccessibleName = "AdapterTabPanel_MACAddressValueLbl";
this.AdapterTabPanel_ManufacturerLbl.AccessibleName = "AdapterTabPanel_ManufacturerLbl";
this.AdapterTabPanel_ManufacturerValueLbl.AccessibleName = "AdapterTabPanel_ManufacturerValueLbl";
this.AdapterTabPanel_ModelLbl.AccessibleName = "AdapterTabPanel_ModelLbl";
this.AdapterTabPanel_ModelValueLbl.AccessibleName = "AdapterTabPanel_ModelValueLbl";
this.AdapterTabPanel_OverviewLbl.AccessibleName = "AdapterTabPanel_OverviewLbl";
this.AdapterTabPanel_ResetLbl.AccessibleName = "AdapterTabPanel_ResetLbl";
this.AdapterTabPanel_ResetPushBtn.AccessibleName = "AdapterTabPanel_ResetPushBtn";
this.AdapterTabPanel_SupportedAdaptersLabelSeparator.AccessibleName = "AdapterTabPanel_SupportedAdaptersLabelSeparator";
this.AdapterTabPanel_SupportedAdaptersLabelSeparator.Text = AdvancedDlgStringHelper.GetString("AdapterTabPanel_SupportedAdaptersLabelSeparator");
this.AdapterTabPanel_OverviewLbl.Text = AdvancedDlgStringHelper.GetString("AdapterTabPanel_OverviewLbl");
this.AdapterTabPanel_ManufacturerLbl.Text = AdvancedDlgStringHelper.GetString("AdapterTabPanel_ManufacturerLbl");
this.AdapterTabPanel_ModelLbl.Text = AdvancedDlgStringHelper.GetString("AdapterTabPanel_ModelLbl");
this.AdapterTabPanel_MACAddressLbl.Text = AdvancedDlgStringHelper.GetString("AdapterTabPanel_MACAddressLbl");
this.AdapterTabPanel_DeviceManagementSeparator.Text = AdvancedDlgStringHelper.GetString("AdapterTabPanel_DeviceManagementSeparator");
this.AdapterTabPanel_ResetLbl.Text = AdvancedDlgStringHelper.GetString("AdapterTabPanel_ResetLbl");
this.AdapterTabPanel_ResetPushBtn.BtnText = AdvancedDlgStringHelper.GetString("AdapterTabPanel_ResetPushBtn");
this.AdapterTabPanel_ResetPushBtn.Pressed += new CustomButtonPush.PressedDelegate(this.OnDeviceResetPushBtnPressed);
SizeHelper.ResizeCustomControls(this.Controls);
}
private void RegisterForEvents()
{
Eventing.RegisterForUIEvent(new Eventing.EventDelegate(this.OnAdapterListChanged), (object) this, "WiMAXUI.OnAdapterListChanged");
Eventing.RegisterForUIEvent(new Eventing.EventDelegate(this.OnStateChanged), (object) this, "WiMAXUI.OnStateChange");
Eventing.RegisterForUIEvent(new Eventing.EventDelegate(this.OnIntelCUControlChanged), (object) this, "WiMAXUI.OnIntelCUControlChanged");
Eventing.RegisterForUIEvent(new Eventing.EventDelegate(this.OnResetWiMAXDeviceComplete), (object) this, "WiMAXSP.OnResetWiMAXDeviceComplete");
}
private void UnregisterForEvents()
{
Eventing.DeRegisterAllUIEvents((object) this);
}
private bool PrerequisitesMet()
{
return true;
}
private void Block()
{
this._parentPanel.Block();
}
private void Unblock()
{
if (this._timeoutTimer != null)
this._timeoutTimer.Stop();
this._parentPanel.Unblock();
}
private void UpdateUI()
{
this.UpdateForAdapter();
}
private void UpdateForAdapter()
{
this.AdapterTabPanel_ManufacturerValueLbl.Text = AdvancedDlgStringHelper.GetString("AdapterTabPanel_InformationNotAvailable");
this.AdapterTabPanel_ModelValueLbl.Text = AdvancedDlgStringHelper.GetString("AdapterTabPanel_InformationNotAvailable");
this.AdapterTabPanel_MACAddressValueLbl.Text = AdvancedDlgStringHelper.GetString("AdapterTabPanel_InformationNotAvailable");
if (!string.IsNullOrEmpty(AdapterHandler.TheAdapter.VendorName))
{
this._vendorName = AdapterHandler.TheAdapter.VendorName;
this.AdapterTabPanel_ManufacturerValueLbl.Text = AdapterHandler.TheAdapter.VendorName;
}
else if (!string.IsNullOrEmpty(this._vendorName))
this.AdapterTabPanel_ManufacturerValueLbl.Text = this._vendorName;
if (!string.IsNullOrEmpty(AdapterHandler.TheAdapter.HWName))
{
this._hwName = AdapterHandler.TheAdapter.HWName;
this.AdapterTabPanel_ModelValueLbl.Text = AdapterHandler.TheAdapter.HWName;
}
else if (!string.IsNullOrEmpty(this._hwName))
this.AdapterTabPanel_ModelValueLbl.Text = this._hwName;
if (!string.IsNullOrEmpty(AdapterHandler.TheAdapter.MACAddress))
{
this._macAddress = AdapterHandler.TheAdapter.MACAddress;
this.AdapterTabPanel_MACAddressValueLbl.Text = AdapterHandler.TheAdapter.MACAddress;
}
else
{
if (string.IsNullOrEmpty(this._macAddress))
return;
this.AdapterTabPanel_MACAddressValueLbl.Text = this._macAddress;
}
}
private void DoAsyncResetWiMAXDevice(object obj)
{
AdapterTabPanel._iResult = MiscHandler.Singleton.ResetWiMAXDevice();
Eventing.GenerateUIEvent("WiMAXSP.OnResetWiMAXDeviceComplete", (object) this, new object[0]);
}
}
}