-
Notifications
You must be signed in to change notification settings - Fork 0
/
ConnectionBrandingPanel.cs
199 lines (181 loc) · 8.76 KB
/
ConnectionBrandingPanel.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
// Type: Intel.Mobile.WiMAXCU.UI.Dashboard.ConnectionBrandingPanel
// 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.Common;
using Intel.Mobile.WiMAXCU.UI.CustomControls;
using System;
using System.ComponentModel;
using System.Drawing;
using System.IO;
using System.Windows.Forms;
namespace Intel.Mobile.WiMAXCU.UI.Dashboard
{
public class ConnectionBrandingPanel : UserControl
{
private ToolTip _leftBrandingImageTooltip = new ToolTip();
private ToolTip _centerBrandingImageTooltip = new ToolTip();
private ToolTip _rightBrandingImageTooltip = new ToolTip();
private string _httpPrefix = BrandingStringHelper.GetString("HTTPPrefix");
private Container components;
private Bitmap _leftBrandingImageBitmap;
private string _leftBrandingImageURL;
private Bitmap _centerBrandingImageBitmap;
private string _centerBrandingImageURL;
private Bitmap _rightBrandingImageBitmap;
private string _rightBrandingImageURL;
public ConnectionBrandingPanel()
{
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 (ConnectionBrandingPanel));
this.SuspendLayout();
this.BackColor = Color.White;
componentResourceManager.ApplyResources((object) this, "$this");
this.Name = "ConnectionBrandingPanel";
this.ResumeLayout(false);
}
public void InitPanel()
{
this.SetLeftBrandingImage();
this.SetCenterBrandingImage();
this.SetRightBrandingImage();
}
private void OnBrandingImageMouseEnter(object sender, EventArgs e)
{
this.Cursor = Cursors.Hand;
}
private void OnBrandingImageMouseLeave(object sender, EventArgs e)
{
this.Cursor = Cursors.Default;
}
private void OnLeftBrandingImageMouseDown(object sender, MouseEventArgs e)
{
UIHelper.LaunchDefaultBrowser(this._leftBrandingImageURL.Trim());
}
private void OnCenterBrandingImageMouseDown(object sender, MouseEventArgs e)
{
UIHelper.LaunchDefaultBrowser(this._centerBrandingImageURL.Trim());
}
private void OnRightBrandingImageMouseDown(object sender, MouseEventArgs e)
{
UIHelper.LaunchDefaultBrowser(this._rightBrandingImageURL.Trim());
}
private void CustomInitializeComponents()
{
this._leftBrandingImageTooltip.ShowAlways = true;
this._centerBrandingImageTooltip.ShowAlways = true;
this._rightBrandingImageTooltip.ShowAlways = true;
}
private void SetLeftBrandingImage()
{
this.GetLeftBrandingInfo();
if (this._leftBrandingImageBitmap == null)
return;
TransparentPictureBox transparentPictureBox = new TransparentPictureBox();
transparentPictureBox.TheBitmap = this._leftBrandingImageBitmap;
transparentPictureBox.Size = new Size(transparentPictureBox.TheBitmap.Width, transparentPictureBox.TheBitmap.Height);
transparentPictureBox.Location = new Point(0, (this.Size.Height - transparentPictureBox.TheBitmap.Height) / 2);
transparentPictureBox.Name = "LeftBrandingImageBitmap";
transparentPictureBox.AccessibleName = "LeftBrandingImageBitmap";
transparentPictureBox.TabStop = false;
this.Controls.Add((Control) transparentPictureBox);
if (this._leftBrandingImageURL == null)
return;
transparentPictureBox.MouseEnter += new EventHandler(this.OnBrandingImageMouseEnter);
transparentPictureBox.MouseLeave += new EventHandler(this.OnBrandingImageMouseLeave);
transparentPictureBox.MouseDown += new MouseEventHandler(this.OnLeftBrandingImageMouseDown);
this._leftBrandingImageTooltip.SetToolTip((Control) transparentPictureBox, this._leftBrandingImageURL.Trim());
}
private void GetLeftBrandingInfo()
{
this._leftBrandingImageBitmap = (Bitmap) null;
this._leftBrandingImageURL = (string) null;
OEM oemInfo = OEMHelper.GetOEMInfo();
if (oemInfo == null)
return;
string filename = oemInfo.Branding.LeftImage.filename;
string url = oemInfo.Branding.LeftImage.url;
if (filename == null || filename.Length <= 0 || !File.Exists(filename))
return;
this._leftBrandingImageBitmap = ScalingUtils.ScaleBitmap(new Bitmap(filename));
if (url == null || url.Length <= 0 || !url.Trim().ToLower(Application.CurrentCulture).StartsWith(this._httpPrefix))
return;
this._leftBrandingImageURL = url;
}
private void SetCenterBrandingImage()
{
this.GetCenterBrandingInfo();
if (this._centerBrandingImageBitmap == null)
return;
TransparentPictureBox transparentPictureBox = new TransparentPictureBox();
transparentPictureBox.TheBitmap = this._centerBrandingImageBitmap;
transparentPictureBox.Size = new Size(transparentPictureBox.TheBitmap.Width, transparentPictureBox.TheBitmap.Height);
transparentPictureBox.Location = new Point((this.Size.Width - transparentPictureBox.TheBitmap.Width) / 2, (this.Size.Height - transparentPictureBox.TheBitmap.Height) / 2);
transparentPictureBox.Name = "CenterBrandingImageBitmap";
transparentPictureBox.AccessibleName = "CenterBrandingImageBitmap";
transparentPictureBox.TabStop = false;
this.Controls.Add((Control) transparentPictureBox);
if (this._centerBrandingImageURL == null)
return;
transparentPictureBox.MouseEnter += new EventHandler(this.OnBrandingImageMouseEnter);
transparentPictureBox.MouseLeave += new EventHandler(this.OnBrandingImageMouseLeave);
transparentPictureBox.MouseDown += new MouseEventHandler(this.OnCenterBrandingImageMouseDown);
this._centerBrandingImageTooltip.SetToolTip((Control) transparentPictureBox, this._centerBrandingImageURL.Trim());
}
private void GetCenterBrandingInfo()
{
this._centerBrandingImageBitmap = (Bitmap) null;
this._centerBrandingImageURL = (string) null;
OEM oemInfo = OEMHelper.GetOEMInfo();
if (oemInfo == null)
return;
string filename = oemInfo.Branding.CenterImage.filename;
string url = oemInfo.Branding.CenterImage.url;
if (filename == null || filename.Length <= 0 || !File.Exists(filename))
return;
this._centerBrandingImageBitmap = ScalingUtils.ScaleBitmap(new Bitmap(filename));
if (url == null || url.Length <= 0 || !url.Trim().ToLower(Application.CurrentCulture).StartsWith(this._httpPrefix))
return;
this._centerBrandingImageURL = url;
}
private void SetRightBrandingImage()
{
this.GetRightBrandingInfo();
if (this._rightBrandingImageBitmap == null)
return;
TransparentPictureBox transparentPictureBox = new TransparentPictureBox();
transparentPictureBox.TheBitmap = new Bitmap((Image) this._rightBrandingImageBitmap);
transparentPictureBox.Size = new Size(transparentPictureBox.TheBitmap.Width, DPIUtils.UnscaleY(transparentPictureBox.TheBitmap.Height));
transparentPictureBox.Location = new Point(this.Size.Width - transparentPictureBox.TheBitmap.Width, (this.Size.Height - DPIUtils.UnscaleY(transparentPictureBox.TheBitmap.Height)) / 2);
transparentPictureBox.Name = "RightBrandingImageBitmap";
transparentPictureBox.AccessibleName = "RightBrandingImageBitmap";
transparentPictureBox.TabStop = false;
this.Controls.Add((Control) transparentPictureBox);
if (this._rightBrandingImageURL == null)
return;
transparentPictureBox.MouseEnter += new EventHandler(this.OnBrandingImageMouseEnter);
transparentPictureBox.MouseLeave += new EventHandler(this.OnBrandingImageMouseLeave);
transparentPictureBox.MouseDown += new MouseEventHandler(this.OnRightBrandingImageMouseDown);
this._rightBrandingImageTooltip.SetToolTip((Control) transparentPictureBox, this._rightBrandingImageURL.Trim());
}
private void GetRightBrandingInfo()
{
this._rightBrandingImageBitmap = ImageHelper.IntelLogo;
this._rightBrandingImageURL = (string) null;
string @string = BrandingStringHelper.GetString("Branding_ImageIntelURL");
if (@string == null || @string.Length <= 0 || [email protected]().ToLower(Application.CurrentCulture).StartsWith(this._httpPrefix))
return;
this._rightBrandingImageURL = @string;
}
}
}