-
Notifications
You must be signed in to change notification settings - Fork 0
/
AnimatedScanOrConnectImage.cs
131 lines (121 loc) · 5.28 KB
/
AnimatedScanOrConnectImage.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
// Type: Intel.Mobile.WiMAXCU.UI.Dashboard.AnimatedScanOrConnectImage
// 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.Collections.Generic;
using System.Diagnostics;
using System.Drawing;
using System.Threading;
namespace Intel.Mobile.WiMAXCU.UI.Dashboard
{
public abstract class AnimatedScanOrConnectImage
{
private Timer _timer;
public AnimatedScanOrConnectImage()
{
this.RegisterForEvents();
}
public virtual void AssignImage(Icon ico)
{
}
public virtual void AssignImage(Bitmap newImage)
{
}
private void OnTimerTick(object data)
{
if (this._timer == null)
return;
try
{
AnimatedImageInfo animatedImageInfo = (AnimatedImageInfo) data;
this.AssignImage(animatedImageInfo.Icons[animatedImageInfo.CurrentIconIndex]);
this.AssignImage(animatedImageInfo.Bitmaps[animatedImageInfo.CurrentBitmapIndex]);
++animatedImageInfo.CurrentIconIndex;
if (animatedImageInfo.CurrentIconIndex >= animatedImageInfo.Icons.Count)
animatedImageInfo.CurrentIconIndex = 0;
++animatedImageInfo.CurrentBitmapIndex;
if (animatedImageInfo.CurrentBitmapIndex < animatedImageInfo.Bitmaps.Count)
return;
animatedImageInfo.CurrentBitmapIndex = 0;
}
catch (Exception ex)
{
Logging.LogEvent(TraceModule.SDK, TraceLevel.Warning, (object) this, Logging.GetMessageForException(ex));
}
}
private void OnSomethingChanged(object sender, object[] eventArgs)
{
if (MediaHandler.TheMedia.WiMAXIsReady && MediaHandler.IntelCUIsInControl && AdapterHandler.TheAdapter.RadioIsOn() && (Intel.Mobile.WiMAXCU.BizTier.ApplicationState.Singleton.BlockedForConnect || Intel.Mobile.WiMAXCU.BizTier.ApplicationState.Singleton.BlockedForScan || (Intel.Mobile.WiMAXCU.BizTier.ApplicationState.Singleton.BlockedForStopScan || Intel.Mobile.WiMAXCU.BizTier.ApplicationState.Singleton.BlockedForStopConnect)))
this.StartAnimation();
else
this.StopAnimation();
}
private void RegisterForEvents()
{
Eventing.RegisterForUIEvent(new Eventing.EventDelegate(this.OnSomethingChanged), (object) this, "WiMAXUI.OnStateChange");
Eventing.RegisterForUIEvent(new Eventing.EventDelegate(this.OnSomethingChanged), (object) this, "WiMAXUI.OnIntelCUControlChanged");
Eventing.RegisterForUIEvent(new Eventing.EventDelegate(this.OnSomethingChanged), (object) this, "WiMAXUI.OnMediaStatusChanged");
Eventing.RegisterForUIEvent(new Eventing.EventDelegate(this.OnSomethingChanged), (object) this, "WiMAXUI.OnAdapterListChanged");
}
private void StartAnimation()
{
try
{
this.StopAnimation();
if (this._timer != null)
return;
int period = TimerSettings.AnimatedScanOrConnectImageDefault_Timer_Period;
AnimatedImageInfo animatedImageInfo = new AnimatedImageInfo();
if (Intel.Mobile.WiMAXCU.BizTier.ApplicationState.Singleton.BlockedForScan)
{
animatedImageInfo.Icons = ImageHelper.TraySearchingIcons;
animatedImageInfo.Bitmaps = ImageHelper.SearchingLargeIcons;
period = TimerSettings.AnimatedScanOrConnectImageScan_Timer_Period;
}
else if (Intel.Mobile.WiMAXCU.BizTier.ApplicationState.Singleton.BlockedForConnect)
{
animatedImageInfo.Icons = ImageHelper.TrayConnectingIcons;
animatedImageInfo.Bitmaps = ImageHelper.ConnectingLargeIcons;
period = TimerSettings.AnimatedScanOrConnectImageConnect_Timer_Period;
}
else if (Intel.Mobile.WiMAXCU.BizTier.ApplicationState.Singleton.BlockedForStopScan || Intel.Mobile.WiMAXCU.BizTier.ApplicationState.Singleton.BlockedForStopConnect)
{
List<Icon> list1 = new List<Icon>();
list1.Add(ImageHelper.TrayWiMAXAppIco);
List<Bitmap> list2 = new List<Bitmap>();
list2.Add(ImageHelper.WiMAXApplicationLargeIcon);
animatedImageInfo.Icons = list1;
animatedImageInfo.Bitmaps = list2;
period = TimerSettings.AnimatedScanOrConnectImageStopScan_Timer_Period;
}
this._timer = new Timer(new TimerCallback(this.OnTimerTick), (object) animatedImageInfo, TimerSettings.AnimatedScanOrConnectImage_Timer_DueTime, period);
}
catch (Exception ex)
{
Logging.LogEvent(TraceModule.SDK, TraceLevel.Warning, (object) this, Logging.GetMessageForException(ex));
}
}
private void StopAnimation()
{
try
{
if (this._timer != null)
{
this._timer.Change(-1, -1);
this._timer.Dispose();
this._timer = (Timer) null;
}
AppFramework.TaskTray.UpdateUI();
}
catch (Exception ex)
{
Logging.LogEvent(TraceModule.SDK, TraceLevel.Warning, (object) this, Logging.GetMessageForException(ex));
}
}
}
}