Exemple #1
0
        protected override void OnStart(string[] args)
        {
            var message = new MessageLog()
            {
                Message      = "Service Started",
                ErrorMessage = string.Empty,
                Received     = DateTime.Now
            };

            LogService(message);
            timeDelay.Enabled = true;
        }
Exemple #2
0
        protected override void OnStop()
        {
            var message = new MessageLog()
            {
                Message      = "Service Stopped",
                ErrorMessage = string.Empty,
                Received     = DateTime.Now
            };

            LogService(message);
            timeDelay.Enabled = false;
        }
Exemple #3
0
        public void WorkProcess(object sender, System.Timers.ElapsedEventArgs e)
        {
            string process = "Timer Tick " + count;
            var    message = new MessageLog()
            {
                Message      = process,
                ErrorMessage = string.Empty,
                Received     = DateTime.Now
            };

            LogService(message);
            count++;
        }
Exemple #4
0
        private void LogService(MessageLog messageLog)
        {
            var serializedMessage = JsonConvert.SerializeObject(messageLog);

            _logger.Debug(serializedMessage);
        }