-
Notifications
You must be signed in to change notification settings - Fork 0
/
ErrorHelper.cs
188 lines (180 loc) · 8.11 KB
/
ErrorHelper.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
// Type: Intel.Mobile.WiMAXCU.UI.Dashboard.ErrorHelper
// 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.Diagnostics;
using System.IO;
using System.Media;
using System.Windows.Forms;
namespace Intel.Mobile.WiMAXCU.UI.Dashboard
{
public static class ErrorHelper
{
public static string TranslateErrorCodeToMessage(int errorCode)
{
switch (errorCode)
{
case 49154:
return ErrorStringsHelper.GetString("BizTier_INVALID_RADIO_STATE");
case 49155:
return ErrorStringsHelper.GetString("BizTier_INVALID_NETWORK");
case 49156:
return ErrorStringsHelper.GetString("BizTier_ONLY_ONE_CONNECTED_NETWORK_SUPPORTED");
case 49157:
return ErrorStringsHelper.GetString("BizTier_NETWORK_NOT_CONNECTED");
case 53249:
return ErrorStringsHelper.GetString("APDO_GENERIC_FAILURE");
case 53250:
return ErrorStringsHelper.GetString("APDO_NETWORK_DISCONNECTED");
case 53251:
return ErrorStringsHelper.GetString("APDO_BAD_AUTHENTICATION");
case 53252:
return ErrorStringsHelper.GetString("APDO_INVALID_PROVISIONING");
case 53253:
return ErrorStringsHelper.GetString("APDO_INVALID_PACKAGE");
case 57345:
return ErrorStringsHelper.GetString("UI_PROVISIONING_OPERATION_IN_PROGRESS");
case 40961:
return ErrorStringsHelper.GetString("SDK_ALREADY_CONNECTED");
case 40962:
return ErrorStringsHelper.GetString("SDK_BUFFER_SIZE_TOO_SMALL");
case 40963:
return ErrorStringsHelper.GetString("SDK_CONNECTION_IN_PROGRESS");
case 40964:
return ErrorStringsHelper.GetString("SDK_DEVICE_MISSING");
case 40965:
return ErrorStringsHelper.GetString("SDK_FAILED");
case 40966:
return ErrorStringsHelper.GetString("SDK_FIRST_COMMON_ERROR");
case 40967:
return ErrorStringsHelper.GetString("SDK_INVALID_DEVICE");
case 40968:
return ErrorStringsHelper.GetString("SDK_INVALID_PARAMETER");
case 40969:
return ErrorStringsHelper.GetString("SDK_INVALID_PROFILE");
case 40970:
return ErrorStringsHelper.GetString("SDK_LAST_COMMON_ERROR");
case 40971:
return ErrorStringsHelper.GetString("SDK_LINK_NOT_CONNECTED");
case 40972:
return ErrorStringsHelper.GetString("SDK_NETWORK_PROHIBITED");
case 40973:
return ErrorStringsHelper.GetString("SDK_PERMISSON_DENIED");
case 40974:
return ErrorStringsHelper.GetString("SDK_ROAMING_NOT_ALLOWED");
case 40975:
return ErrorStringsHelper.GetString("SDK_INTEL_NO_RF");
case 40976:
return ErrorStringsHelper.GetString("SDK_Fail_to_connect_3_Way_Handshake");
case 40977:
return ErrorStringsHelper.GetString("SDK_Fail_to_connect_datapath");
case 40978:
return ErrorStringsHelper.GetString("SDK_Fail_to_connect_EAP_AUTH_Device");
case 40979:
return ErrorStringsHelper.GetString("SDK_Fail_to_connect_EAP_AUTH_user");
case 40980:
return ErrorStringsHelper.GetString("SDK_Fail_to_connect_Ranging");
case 40981:
return ErrorStringsHelper.GetString("SDK_Fail_to_connect_REG");
case 40982:
return ErrorStringsHelper.GetString("SDK_Fail_to_connect_SBC");
case 40983:
return ErrorStringsHelper.GetString("SDK_Fail_to_connect_to_NW");
case 40984:
return ErrorStringsHelper.GetString("SDK_UNKNOWN_ERROR_CODE");
case 45057:
return string.Format(ErrorStringsHelper.GetString("SP_UNHANDLED_EXCEPTION"), (object) ErrorHelper.GetStringForException(MediaHandler.LastUnhandledException));
default:
return string.Format(ErrorStringsHelper.GetString("ERROR_CODE"), (object) errorCode);
}
}
private static string GetStringForException(Exception ex)
{
if (ex == null)
return "";
if (ex.InnerException != null)
return ErrorHelper.GetStringForException(ex.InnerException);
else
return (string) (object) ex.GetType() + (object) "\r\n" + ex.Message;
}
public static void ShowErrorDialog(Control parent, string errorMsg, string errorDetails, string helpTopic, string accessibleName)
{
if (parent.InvokeRequired)
return;
ErrorDialog errorDlg = new ErrorDialog(errorMsg, errorDetails, helpTopic, accessibleName);
ErrorHelper.ShowErrorDialog(parent, errorDlg, errorMsg, true);
}
public static void ShowErrorDialog(Control parent, string errorMsg, Exception ex, string helpTopic, string accessibleName)
{
if (parent.InvokeRequired)
return;
ErrorDialog errorDlg = new ErrorDialog(errorMsg, ex, helpTopic, accessibleName);
ErrorHelper.ShowErrorDialog(parent, errorDlg, errorMsg, true);
}
public static void ShowErrorDialogOnlyIfPrimaryCUAndSDKReady(Control parent, string errorMsg, string errorDetails, string helpTopic, string accessibleName)
{
if (parent.InvokeRequired)
return;
ErrorDialog errorDlg = new ErrorDialog(errorMsg, errorDetails, helpTopic, accessibleName);
ErrorHelper.ShowErrorDialog(parent, errorDlg, errorMsg, false);
}
public static void ShowErrorDialogOnlyIfPrimaryCUAndSDKReady(Control parent, string errorMsg, Exception ex, string helpTopic, string accessibleName)
{
if (parent.InvokeRequired)
return;
ErrorDialog errorDlg = new ErrorDialog(errorMsg, ex, helpTopic, accessibleName);
ErrorHelper.ShowErrorDialog(parent, errorDlg, errorMsg, false);
}
private static void ShowErrorDialog(Control parent, ErrorDialog errorDlg, string errorMsg, bool alwaysShowErrorMsg)
{
if (!alwaysShowErrorMsg && (!MediaHandler.IntelCUIsInControl || !MediaHandler.TheMedia.WiMAXIsReady))
return;
if (!alwaysShowErrorMsg)
{
if (!AdapterHandler.TheAdapter.RadioIsOn())
{
if (errorMsg != ErrorStringsHelper.GetString("General_RadioOnFailed"))
{
if (errorMsg != ErrorStringsHelper.GetString("General_RadioOffFailed"))
return;
}
}
}
try
{
if (File.Exists("C:\\Windows\\Media\\Windows XP Critical Stop.wav"))
new SoundPlayer("C:\\Windows\\Media\\Windows XP Critical Stop.wav").Play();
else if (File.Exists("C:\\Windows\\Media\\Windows Critical Stop.wav"))
new SoundPlayer("C:\\Windows\\Media\\Windows Critical Stop.wav").Play();
}
catch (Exception ex)
{
Logging.LogEvent(TraceModule.SDK, TraceLevel.Warning, typeof (ErrorDialog), Logging.GetMessageForException(ex));
}
if (AppFramework.TaskTray.ShowPopupInTaskTray())
{
errorDlg.FormType = FormTypeEnum.TaskTrayWithCloseBtn;
errorDlg.StartPosition = FormStartPosition.Manual;
errorDlg.Location = AppFramework.TaskTray.GetTaskTrayPopupLocation(DPIUtils.ScaleSize(errorDlg.Size));
UIHelper.ShowAsTopMostForm((Form) errorDlg);
}
else
{
if (AppFramework.Dashboard != null && AppFramework.Dashboard.WindowState == FormWindowState.Minimized)
AppFramework.Dashboard.WindowState = FormWindowState.Normal;
AppFramework.Dashboard.BringToFront();
errorDlg.FormType = FormTypeEnum.Dialog;
if (AppFramework.Dashboard != null && AppFramework.Dashboard.Visible)
errorDlg.StartPosition = FormStartPosition.CenterParent;
else
errorDlg.StartPosition = FormStartPosition.CenterScreen;
int num = (int) errorDlg.ShowDialog((IWin32Window) parent);
}
}
}
}