B4A=true Group=Default Group ModulesStructureVersion=1 Type=StaticCode Version=11 @EndOfDesignText@ 'Code module 'Subs in this code module will be accessible from all modules. Sub Process_Globals 'These global variables will be declared once when the application starts. 'These variables can be accessed from all modules. Private su As StringUtils 'Usa la libreria StringUtils 'ignore End Sub 'Linea de prueba 5 'Convierte una fecha al formato yyMMddHHmmss Sub fechaKMT(fecha As String) As String 'ignore ' if starter.logger then Log(fecha) Dim OrigFormat As String = DateTime.DateFormat 'save orig date format DateTime.DateFormat="yyMMddHHmmss" Dim nuevaFecha As String=DateTime.Date(fecha) DateTime.DateFormat=OrigFormat 'return to orig date format ' if starter.logger then Log(nuevaFecha) Return nuevaFecha End Sub 'Regresa la fecha y hora de hoy a las 00:00 en el formato "yyMMddHHMMSS" Sub fechaInicioHoy As String 'ignore Dim OrigFormat As String = DateTime.DateFormat 'save orig date format DateTime.DateFormat="yyMMdd" Private h As String = DateTime.Date(DateTime.Now)&"000000" DateTime.DateFormat=OrigFormat 'return to orig date format ' If Starter.logger Then Log("Hoy="&h) Return h End Sub 'Regresa verdadero si ya pasaron XX minutos de la fecha dada Sub masDeXXMins(hora As Int, mins As Int) As Boolean 'ignore If (hora + mins * DateTime.TicksPerMinute) < DateTime.Now Then Return True Else Return False End If End Sub 'Regresa verdadero si ya pasaron XX minutos de la fechaKMT dada Sub masDeXXMinsKMT(hora As String, mins As Int) As Boolean 'ignore Try ' if starter.logger then LogColor($"Hora=${fechaKMT(fechaKMT2Ticks(hora) + mins * DateTime.TicksPerMinute)}, Mins=${mins}, Actual=${fechaKMT(DateTime.Now)}"$,Colors.red) If fechaKMT2Ticks(hora) + mins * DateTime.TicksPerMinute < DateTime.Now Then ' if starter.logger then Log("+++ +++ "&fechaKMT(fechaKMT2Ticks(hora) + mins * DateTime.TicksPerMinute) & " < " & fechaKMT(DateTime.Now)) Return True Else ' if starter.logger then Log("+++ +++ "&fechaKMT(fechaKMT2Ticks(hora) + mins * DateTime.TicksPerMinute) & " > " & fechaKMT(DateTime.Now)) Return False End If Catch Log(LastException) End Try End Sub 'Convierte una fecha en formato YYMMDDHHMMSS a Ticks Sub fechaKMT2Ticks(fKMT As String) As Long 'ignore Try If fKMT.Length = 12 Then Private parteFecha As String = fKMT.SubString2(0,6) Private parteHora As String = fKMT.SubString(6) Private OrigFormat As String = DateTime.DateFormat 'save original date format DateTime.DateFormat="yyMMdd" DateTime.TimeFormat="HHmmss" Private ticks As Long = DateTime.DateTimeParse(parteFecha,parteHora) ' Log(" +++ +++ pFecha:"&parteFecha&" | pHora:"&parteHora) DateTime.DateFormat=OrigFormat 'return to original date format Return ticks Else Log("Formato de fecha incorrecto, debe de ser 'yyMMddHHmmss', no '"&fKMT&"' largo="&fKMT.Length) Return 0 End If Catch Log(LastException) ' If Starter.logger Then LogColor($"Fecha dada: ${fKMT}, Parte Fecha: ${parteFecha}, Parte Hora: ${parteHora}"$, Colors.Red) Return 0 End Try End Sub 'Hace visible el panel con los parametros "Top" y "Left" dados Sub panelVisible(panel As Panel, top As Int, left As Int) 'ignore panel.BringToFront panel.Visible = True panel.Top = top panel.Left = left End Sub 'Oculta el panel especificado y lo manda al fondo Sub panelOculto(panel As Panel) 'ignore panel.SendToBack panel.Visible = False End Sub 'Centra una etiqueta dentro de un elemento superior Sub centraEtiqueta(elemento As Label, anchoElementoSuperior As Int) 'ignore elemento.Left = Round(anchoElementoSuperior/2)-(elemento.Width/2) End Sub 'Centra un panel dentro de un elemento superior Sub centraPanel(elemento As Panel, anchoElementoSuperior As Int) 'ignore elemento.Left = Round(anchoElementoSuperior/2)-(elemento.Width/2) End Sub Sub centraEditText(elemento As EditText, anchoElementoSuperior As Int) 'ignore elemento.Left = Round(anchoElementoSuperior/2)-(elemento.Width/2) End Sub 'Centra una barra de progreso dentro de un elemento superior Sub centraProgressBar(elemento As ProgressBar, anchoElementoSuperior As Int) 'ignore elemento.Left = Round(anchoElementoSuperior/2)-(elemento.Width/2) End Sub 'Modifica el ancho y alto de un panel dado con el ancho y alto proporcionados. Sub panelAnchoAlto(p As Panel, w As Int, h As Int) 'ignore ' If Starter.logger Then Log($"panel:${p}, alncho=${w}, alto=${h}"$) p.Top = 0 p.Left = 0 p.Width = w p.Height = h End Sub 'Regresa el dia de HOY como string, en español y mayusculas. Sub dameDiaSemana As String 'ignore Private ds As String = DateTime.GetDayOfWeek(DateTime.Now) If ds = "1" Then ds = "DOMINGO" else if ds = "2" Then ds = "LUNES" else if ds = "3" Then ds = "MARTES" else if ds = "4" Then ds = "MIERCOLES" else if ds = "5" Then ds = "JUEVES" else if ds = "6" Then ds = "VIERNES" Else ds = "SABADO" End If Return ds End Sub