Advertisement
Advertisement
| 07.17.2008 at 05:53AM PDT, ID: 23572951 |
|
[x]
Attachment Details
|
||
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: |
'DATA AUTOR ID MODIFICACIO
'05/12/2007 EBD ++0001 Implementació d'un control per a DataTuner
'08/02/2008 EBD ++0002 Se cambian los tiempos de comprobación
Imports System.IO
'Imports System.Runtime.Serialization
''Imports ByteFX.Data.MySqlClient
Imports System.ServiceProcess
'Imports System
Imports System.Threading
'Sólo importado para pruebas, después eliminar.
'Imports System.Windows.Forms
Public Class GPRSTuner
Inherits System.ServiceProcess.ServiceBase
'Añadimos las variables para el control de memoria de DataTuner.
Private Shared timerID As System.Threading.Timer
Public Const MAXSIZE As Int64 = 100000000
#Region " Código generado por el Diseñador de componentes "
Public Sub New()
MyBase.New()
' El Diseñador de componentes requiere esta llamada.
InitializeComponent()
' Agregar cualquier inicialización después de la llamada a InitializeComponent()
Me.CanPauseAndContinue = False
Me.CanStop = True
Me.AutoLog = True
End Sub
'UserService reemplaza a Dispose para limpiar la lista de componentes.
Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing Then
If Not (components Is Nothing) Then
components.Dispose()
End If
End If
MyBase.Dispose(disposing)
End Sub
' El punto de entrada principal para el proceso
<MTAThread()> _
Shared Sub Main()
Dim ServicesToRun() As System.ServiceProcess.ServiceBase
' Se puede ejecutar en el mismo proceso más de un servicio NT. Para agregar
' otro servicio a este proceso, cambie la siguiente línea a fin de
' crear otro objeto de servicio. Por ejemplo,
'
' ServicesToRun = New System.ServiceProcess.ServiceBase () {New Service1, New MySecondUserService}
'
ServicesToRun = New System.ServiceProcess.ServiceBase() {New GPRSTuner}
System.ServiceProcess.ServiceBase.Run(ServicesToRun)
End Sub
'Requerido por el Diseñador de componentes
Private components As System.ComponentModel.IContainer
'NOTA: el Diseñador de componentes requiere el siguiente procedimiento
'Se puede modificar utilizando el Diseñador de componentes. No lo modifique
' con el editor de código.
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
'
'GPRSTuner
'
Me.ServiceName = "GPRSTuner"
End Sub
#End Region
Private Esdato As EstadoGPRS
'Private Configuracion As ConfiguracionGPRS
Dim config As ConfiguracionGPRS = Nothing
Private Activacion As ActivacionCL
Protected Overrides Sub OnStart(ByVal args() As String)
' Agregar código aquí para iniciar el servicio. Este método debería poner en movimiento
' los elementos para que el servicio pueda funcionar.
If args.Length = 1 Then
Try
config = New ConfiguracionGPRS
config.parse(args(0))
If config.IP_Local = "" Then Throw New Exception
Catch ex As Exception
config = Nothing
End Try
End If
Controlador.getInstance.iniciar(config, False)
timerID = New System.Threading.Timer(New Threading.TimerCallback(AddressOf Verifica), Nothing, 1800000, 1800000)
End Sub
|