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
        private void tbRestartServico_Click(object sender, EventArgs e)
        {
            FormWait fw = new FormWait();

            fw.Show();
            try
            {
                fw.DisplayMessage("Reiniciando o serviço do UniNFe");
                ServiceProcess.RestartService(srvName, 40000);
                this.updateControleDoServico();
                fw.StopMarquee();
                MessageBox.Show("Serviço do UniNFe reiniciado com sucesso!", "Informação", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Erro", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            finally
            {
                fw.Dispose();
            }
        }