#Region Module Attributes
#FullScreen: False
#IncludeTitle: false
#ApplicationLabel: GeekBatWidget
#VersionCode: 1
#VersionName: 1.1
#CanInstallToExternalStorage: True
#End Region
'Activity module
Sub Process_Globals
'These global variables will be declared once when the application starts.
'These variables can be accessed from all modules.
Dim BatCheck As PhoneEvents
'CRLF - New Line
End Sub
Sub Globals
Dim imgBatLevel As ImageView
Dim ImgExit As ImageView
Dim lblBatLvl As Label
Dim LblPresent As Label
Dim LblTech As Label
Dim lblVoltage As Label
Dim lblStatus As Label
Dim lblTemp As Label
Dim lblPlugged As Label
Dim LblBatInfo As Label
Dim lblHealth As Label
End Sub
Sub Activity_Create(FirstTime As Boolean)
BatCheck.Initialize("BatCheck")
Activity.LoadLayout("BatLevel")
ImgExit.Bitmap = LoadBitmap(File.DirAssets, "geekbot-no2red.gif")
End Sub
Sub Activity_Resume
End Sub
Sub Activity_Pause (UserClosed As Boolean)
End Sub
Sub BatCheck_BatteryChanged (Level As Int, Scale As Int, Plugged As Boolean, Intent As Intent)
lblBatLvl.Text = Level & "%"
LblTech.text = "Technology - " & Intent.getextra("technology")
lblTemp.Text = "Temperature - " & Intent.GetExtra("temperature")
lblVoltage.Text = "Voltage - " & Intent.GetExtra("Voltage")
lblStatus.Text = "Status - " & Intent.GetExtra("Status")
lblHealth.text = "Health - " & Intent.GetExtra("Health")
If Plugged = True Then
imgBatLevel.Bitmap = LoadBitmap(File.DirAssets,"geekbatlogocharge.gif")
lblPlugged.Text = "Charghing " & Level & "%"
lblPlugged.TextColor = Colors.Blue
Else
lblPlugged.Text = "DisCharghing " & Level & "%"
If Level >50 Then
imgBatLevel.Bitmap = LoadBitmap(File.DirAssets,"geekbatlogofull.gif")
lblPlugged.TextColor = Colors.Green
Else If Level > 25 Then
imgBatLevel.Bitmap = LoadBitmap(File.DirAssets,"geekbatlogohalf.gif")
lblPlugged.TextColor = Colors.Yellow
Else If Level > 15 Then
imgBatLevel.Bitmap = LoadBitmap(File.DirAssets,"geekbatlogoquater.gif")
Else If Level > 0 Then
imgBatLevel.Bitmap = LoadBitmap(File.DirAssets,"geekbatlogoempty.gif")
lblPlugged.TextColor = Colors.Red
Else
'Do Nothing
End If
End If
End Sub
Sub ImgExit_Click
Dim result As Int
result = Msgbox2("Are you Sure You Want To Exit?", "Close Application", "Yes", "", "No", LoadBitmap(File.DirAssets,"PS-Geekbot-Logo-5.gif"))
If result = DialogResponse.Positive Then
Activity.Finish
Else
'Exit
End If
End Sub