﻿using System.ServiceProcess;

namespace Quest.TSAPI
{
    public partial class TSAPIService : ServiceBase
    {
        TSAPIManager _manager;
        TSAPIParams _parameters;

        public TSAPIService(TSAPIParams parameters)
        {
            InitializeComponent();
            _parameters = parameters;
            _manager = new TSAPIManager(_parameters);
        }

        public void StartRunning()
        {
            _manager.Start();
        }

        public void StopRunning()
        {
            if (_manager != null)
                _manager.Stop();
        }

        protected override void OnStart(string[] args)
        {
            StartRunning();
        }

        protected override void OnStop()
        {
            StopRunning();
        }
    }
}
