using System;
using System.Collections.Specialized;
using System.Diagnostics;
using System.ServiceProcess;
using System.Text;

using Medivators.Common;
using Medivators.Common.Enums;
using Medivators.Common.Logging;
using Medivators.Common.Settings;
using Medivators.Parser;
using Medivators.SerialDevices;

namespace Medivators.Listener
{
	public partial class ListenerService : ServiceBase
	{
		private ILogProvider _pLog = null;
		private ILogProvider _sLog = null;
		private SerialDeviceCollection _devices = null;
		private ListenerServiceHelper _helper = new ListenerServiceHelper();


		public ListenerService()
		{
			InitializeComponent();
		}

		#region controlling methods

		protected override void OnStart(string[] args)
		{
			_helper.Start(ref _pLog, ref _sLog, ref _devices);
		}

		protected override void OnPause()
		{
			_helper.Pause();
			base.OnPause();
		}

		protected override void OnContinue()
		{
			_helper.Continue();
			base.OnContinue();
		}

		protected override void OnStop()
		{
			_helper.Stop(ref _devices);
			base.OnStop();
		}

		protected override void OnShutdown()
		{
			_helper.Shutdown(ref _devices);
			base.OnShutdown();
		}

		#endregion
	}
}
