Exemple #1
0
        public void Stop()
        {
            //SE ELIMINA DE LA MEMORIA LA INSTANCIA DEL RELOJ
            if (_timerProcess != null)
            {
                _timerProcess.Enabled = false;
                _timerProcess.Dispose();
                _timerProcess = null;
            }

            ISException.WriteInformationLog("Servicio detenido correctamente.");

            ISUtil.ClearMemory();
        }
Exemple #2
0
        protected void Stop(string strCause)
        {
            //SE ELIMINA DE LA MEMORIA LA INSTANCIA DEL RELOJ
            if (_timerProcess != null)
            {
                _timerProcess.Enabled = false;
                _timerProcess.Dispose();
                _timerProcess = null;
            }

            if (!string.IsNullOrEmpty(strCause))
            {
                strCause = " Motivo: " + strCause;
            }
            ISException.WriteInformationLog("Servicio detenido correctamente." + strCause);

            ISUtil.ClearMemory();
        }
Exemple #3
0
        public bool Start(double intervalSecons, object objState)
        {
            _interval = intervalSecons;
            _objState = objState;

            ISUtil.ClearMemory();

            //SE CREA LA INSTANCIA DEL RELOJ
            _interval = _interval * 1000;
            if (_interval < 1000)
            {
                string error =
                    "Error al inciar el servicio: El intervalo de ejecucción no puede ser inferior a 1 segundo.";
                ISException.RegisterExcepcion(error);
                Stop(error);
                return(false);
            }

            _timerProcess          = new Timer();
            _timerProcess.Elapsed += _timerProcess_Elapsed;

            try
            {
                _timerProcess.Interval = _interval;
                _timerProcess.Enabled  = true;

                ISException.WriteInformationLog("Servicio iniciado correctamente.");
                return(true);
            }
            catch (Exception ex)
            {
                ISException.RegisterExcepcion(ex);
                Stop(ex.Message);
                return(false);
            }
        }