Ejemplo n.º 1
0
        private static void OnStop()
        {
            ILogger      logger = SillycoreApp.Instance.LoggerFactory.CreateLogger <ILogger>();
            ISillyDaemon daemon = SillycoreApp.Instance.ServiceProvider.GetService <ISillyDaemon>();

            try
            {
                daemon.Stop().Wait();
            }
            catch (Exception e)
            {
                logger.LogError(e, $"There was a problem while stopping service.");
                throw;
            }
        }
Ejemplo n.º 2
0
        private static void OnStart()
        {
            SillycoreApp.Instance.DataStore.Set(Constants.UseShutDownDelay, false);
            _logger = SillycoreApp.Instance.LoggerFactory.CreateLogger <ILogger>();
            _daemon = SillycoreApp.Instance.ServiceProvider.GetService <ISillyDaemon>();

            try
            {
                _daemon.Start().Wait();
            }
            catch (Exception e)
            {
                _logger.LogError(e, $"There was a problem while starting service.");
                throw;
            }
        }