using Narvaling.monitor.model;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Linq;
using System.ServiceProcess;
using System.Text;
using System.Threading.Tasks;
using System.Diagnostics;
using Narvaling.monitor.service;
namespace SoloEnLan
{
    public partial class SoloEnLan : ServiceBase
    {
        monitor m;
        monitorNavegacion mn;

        private string nombreService = "Narvaling.monitor";
        public SoloEnLan()
        {
            InitializeComponent();
            if(!EventLog.SourceExists(nombreService))
            {
                EventLog.CreateEventSource(nombreService,"Application");
            }
            logService.EventLog = eventLog1;
            eventLog1.Source = nombreService;
            eventLog1.Log = "Application";
            m =new monitor();
            mn= new monitorNavegacion();
        }
        public void inicia()
        {
            m.start();
            mn.start();
        }
        protected override void OnStart(string[] args)
        {
            logService.log("Se inicia " + nombreService);
            //eventLog1.WriteEntry("Se inicia " + nombreService);
            inicia();
            logService.log("Fin Inicio " + nombreService);
        }

        protected override void OnStop()
        {
            m.fin();
            mn.fin();
            logService.log("Finaliza" + nombreService);
        }
    }
}
