예제 #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);
        }