예제 #1
0
        public MainWindow()
        {
            InitializeComponent();

            LoggerManager = LoggerManager.GetInstance();

            LoggerManager.AddLogger("MainLogger", this.Logger);

            Logger.PrintText(new Run("Iniciando aplicação..."), new Run(" --> "), new DateOptions(TextDecorationOptions.BOLD));

            CheckDbConnection();

            ServiceStatusUC.ChangeStatus(false);
        }
예제 #2
0
        private async void StartService()
        {
            try
            {
                Logger.PrintText(new Run("Iniciando serviço da API Web..."), new Run(" --> "), new DateOptions(TextDecorationOptions.BOLD));
                bool status = OwinService.Start();
                await ServiceStatusUC.ChangeStatus(status);

                Logger.PrintText(new Run("Serviço da API Web inicializado..."), new Run(" --> "), new DateOptions(TextDecorationOptions.BOLD));
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString(), "Erro ao iniciar serviço", MessageBoxButton.OK, MessageBoxImage.Error);
                Logger.PrintText(new Run("Erro na inicialização serviço da API Web..."), new Run(" --> "), new DateOptions(TextDecorationOptions.BOLD));
            }
        }
예제 #3
0
 private async void StopService(bool logerror = true)
 {
     try
     {
         Logger.PrintText(new Run("Finalizando serviço..."), new Run(" --> "), new DateOptions(TextDecorationOptions.BOLD));
         bool status = OwinService.Stop();
         await ServiceStatusUC.ChangeStatus(!status);
     }
     catch (Exception ex)
     {
         if (logerror)
         {
             MessageBox.Show(ex.ToString(), "Erro ao finalizar serviço", MessageBoxButton.OK, MessageBoxImage.Error);
             Logger.PrintText(new Run("Erro na finalização do serviço..."), new Run(" --> "), new DateOptions(TextDecorationOptions.BOLD));
         }
     }
 }