mirror of
https://github.com/KeymonSoft/Monitor-Keymon.git
synced 2026-04-17 21:06:19 +00:00
Commit inicial.
This commit is contained in:
122
B4A/B4XMainPage.bas
Normal file
122
B4A/B4XMainPage.bas
Normal file
@@ -0,0 +1,122 @@
|
||||
B4A=true
|
||||
Group=Default Group
|
||||
ModulesStructureVersion=1
|
||||
Type=Class
|
||||
Version=9.85
|
||||
@EndOfDesignText@
|
||||
#Region Shared Files
|
||||
#CustomBuildAction: folders ready, %WINDIR%\System32\Robocopy.exe,"..\..\Shared Files" "..\Files"
|
||||
'Ctrl + click to sync files: ide://run?file=%WINDIR%\System32\Robocopy.exe&args=..\..\Shared+Files&args=..\Files&FilesSync=True
|
||||
'Ctrl + click to export as zip: ide://run?File=%B4X%\Zipper.jar&Args=Project.zip
|
||||
'###########################################################################################################
|
||||
'###################### PULL #############################################################
|
||||
'Ctrl + click ide://run?file=%WINDIR%\System32\cmd.exe&Args=/c&Args=..\..\gitpull.bat
|
||||
'###########################################################################################################
|
||||
'###################### PUSH #############################################################
|
||||
'Ctrl + click ide://run?file=%WINDIR%\System32\cmd.exe&Args=/c&Args=github&Args=..\..\
|
||||
'###########################################################################################################
|
||||
#End Region
|
||||
|
||||
Sub Class_Globals
|
||||
Private Root As B4XView
|
||||
Private xui As XUI
|
||||
Public login As B4XMainPage
|
||||
Dim s As C_Subs
|
||||
|
||||
Dim reqManager As DBRequestManager
|
||||
Dim ruta As String
|
||||
|
||||
Dim batterystatus(11) As Int
|
||||
Private bu As BatteryUtilities
|
||||
Private tb_monitorActivo As ToggleButton
|
||||
Private b_monitorActivo As Button
|
||||
Private p_bMonitor As Panel
|
||||
Private l_version As Label
|
||||
Dim l_status As Label
|
||||
Private p_estatus As Panel
|
||||
Dim cb_internet As CheckBox
|
||||
Dim cb_dbreqserver As CheckBox
|
||||
Dim cb_db As CheckBox
|
||||
End Sub
|
||||
|
||||
Public Sub Initialize
|
||||
' B4XPages.GetManager.LogEvents = True
|
||||
End Sub
|
||||
|
||||
'This event will be called once, before the page becomes visible.
|
||||
Private Sub B4XPage_Created (Root1 As B4XView)
|
||||
Root = Root1
|
||||
Root.LoadLayout("login")
|
||||
B4XPages.SetTitle(Me, "Tester")
|
||||
B4XPages.AddPage("Login", login)
|
||||
s.Initialize
|
||||
l_version.Text = Application.VersionName
|
||||
' ruta = Starter.ruta
|
||||
' If File.Exists(ruta, "kmt.db") = False Then
|
||||
' File.Copy(File.DirAssets, "kmt.db", ruta, "kmt.db")
|
||||
' Log(File.DirAssets)
|
||||
' LogColor("copiamos kmt.db de "&File.DirAssets & " a " & ruta,Colors.Green)
|
||||
' End If
|
||||
If Starter.logger Then Log(ruta)
|
||||
' skmt.Initialize(ruta,"kmt.db", True)
|
||||
' Subs.guardaAppInfo(skmt)
|
||||
End Sub
|
||||
|
||||
Sub B4XPage_Appear
|
||||
reqManager.Initialize(Me, Starter.server)
|
||||
bu.Initialize
|
||||
batterystatus = bu.BatteryInformation
|
||||
s.centraPanel(p_bMonitor, Root.Width)
|
||||
s.centraPanel(p_estatus, Root.Width)
|
||||
s.centraEtiqueta(l_status, Root.Width)
|
||||
End Sub
|
||||
|
||||
Sub JobDone(Job As HttpJob)
|
||||
If Starter.logger Then Log(Job.Success)
|
||||
If Job.Success = False Then
|
||||
' ToastMessageShow("Error: " & Job.ErrorMessage, True)
|
||||
Else
|
||||
If Starter.logger Then LogColor("JobDone: '" & reqManager.HandleJob(Job).tag & "' - Registros: " & reqManager.HandleJob(Job).Rows.Size, Colors.Green) 'Mod por CHV - 211027
|
||||
|
||||
If Job.JobName = "DBRequest" Then
|
||||
Dim result As DBResult = reqManager.HandleJob(Job)
|
||||
If result.Tag = "agencia" Then 'query tag
|
||||
For Each records() As Object In result.Rows
|
||||
Dim ID_ALMACEN As String = records(result.Columns.Get("ID_ALMACEN"))
|
||||
Next
|
||||
End If
|
||||
End If
|
||||
Job.Release
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Private Sub B4XPage_CloseRequest As ResumableSub
|
||||
If Starter.logger Then Log("closreq")
|
||||
Sleep(0)
|
||||
Return True
|
||||
End Sub
|
||||
|
||||
|
||||
Private Sub tb_monitorActivo_CheckedChange(Checked As Boolean)
|
||||
|
||||
End Sub
|
||||
|
||||
Private Sub b_monitorActivo_Click
|
||||
Private cd1 As ColorDrawable
|
||||
If Starter.monitorActivo Then
|
||||
cd1.Initialize(Colors.red, 10dip)
|
||||
b_monitorActivo.Background = cd1
|
||||
b_monitorActivo.Text = "Monitor Apagado"
|
||||
l_status.Text = "Monitor Apagado"
|
||||
Starter.monitorActivo = False
|
||||
Starter.notiHigh("Con internet", $"Monitor apagado!!"$, Starter.nid, Main)
|
||||
Else
|
||||
cd1.Initialize(Colors.RGB(16, 141, 0), 10dip)
|
||||
b_monitorActivo.Background = cd1
|
||||
b_monitorActivo.Text = "Monitor Activo"
|
||||
l_status.Text = "Monitor Activo"
|
||||
Starter.Timer1_Tick
|
||||
Starter.monitorActivo = False
|
||||
Starter.monitorActivo = True
|
||||
End If
|
||||
End Sub
|
||||
Reference in New Issue
Block a user