Пример #1
0
        bool ServiceHandle.Start(HostControl hostControl)
        {
            _hostControl = hostControl;
            var control = new AppDomainHostControl(this);

            return(_service.Start(control));
        }
Пример #2
0
        void RestartService(object state)
        {
            try
            {
                _log.InfoFormat("Restarting service: {0}", _settings.ServiceName);

                var control = new AppDomainHostControl(this);
                _service.Stop(control);

                UnloadServiceAppDomain();

                _log.DebugFormat("Service AppDomain unloaded: {0}", _settings.ServiceName);

                _service = CreateServiceInAppDomain();

                _log.DebugFormat("Service created in new AppDomain: {0}", _settings.ServiceName);

                _service.Start(control);

                _log.InfoFormat("The service has been restarted: {0}", _settings.ServiceName);
            }
            catch (Exception ex)
            {
                _log.Error("Failed to restart service", ex);
                _hostControl.Stop();
            }
        }
Пример #3
0
        bool ServiceHandle.Stop(HostControl hostControl)
        {
            var control = new AppDomainHostControl(this);

            return(_service.Stop(control));
        }
Пример #4
0
        public void CustomCommand(HostControl hostControl, int command)
        {
            var control = new AppDomainHostControl(this);

            _service.CustomCommand(control, command);
        }
Пример #5
0
        public void SessionChanged(HostControl hostControl, SessionChangedArguments arguments)
        {
            var control = new AppDomainHostControl(this);

            _service.SessionChanged(control, arguments);
        }
Пример #6
0
        public void Shutdown(HostControl hostControl)
        {
            var control = new AppDomainHostControl(this);

            _service.Shutdown(control);
        }