Exemplo n.º 1
0
        /// <summary>
        /// Metodo responsável por iniciar os serviços do UniNFe em threads diferentes
        /// </summary>
        public void ExecutaServicos(bool updateOptions = true)
        {
            if (servicoInstaladoErodando)
            {
                Empresas.CarregaConfiguracao();

                switch (ServiceProcess.StatusService(srvName))
                {
                case System.ServiceProcess.ServiceControllerStatus.Stopped:
                    ServiceProcess.StartService(srvName, 40000);
                    break;

                case System.ServiceProcess.ServiceControllerStatus.Paused:
                    ServiceProcess.RestartService(srvName, 40000);
                    break;
                }
                if (updateOptions)
                {
                    this.updateControleDoServico();
                }
            }
            else
            {
                ThreadService.Start();
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Metodo responsável por iniciar os serviços do UniNFe em threads diferentes
        /// </summary>
        private void ExecutaServicos()
        {
            Empresa.CarregaConfiguracao();

            if (servicoInstaladoErodando)
            {
                if (restartServico)
                {
                    ServiceProcess.StopService(srvName, 40000);
                }

                restartServico = false;

                switch (ServiceProcess.StatusService(srvName))
                {
                case System.ServiceProcess.ServiceControllerStatus.Stopped:
                    ServiceProcess.StartService(srvName, 40000);
                    break;

                case System.ServiceProcess.ServiceControllerStatus.Paused:
                    ServiceProcess.RestartService(srvName, 40000);
                    break;
                }
                this.updateControleDoServico();
            }
            else
            {
                ThreadService.Start();
            }
        }
Exemplo n.º 3
0
 public void updateControleDoServico()
 {
     if (servicoInstaladoErodando)
     {
         this.tbPararServico.Enabled   = ServiceProcess.StatusService(srvName) == System.ServiceProcess.ServiceControllerStatus.Running;
         this.tbRestartServico.Enabled = ServiceProcess.StatusService(srvName) == System.ServiceProcess.ServiceControllerStatus.Stopped;
     }
 }