Esempio n. 1
0
        private void MetroWindow_Loaded(object sender, RoutedEventArgs e)
        {
            BoxMenu.Visibility = Visibility.Hidden;
            // Relogio
            UpdateRelogio();
            Relogio.Interval = new TimeSpan(0, 0, 59);
            Relogio.Tick    += (send, args) => UpdateRelogio();

            CmdSair.Visibility = Visibility.Collapsed;

            // Load Config
            if (!MyConfig.Carregar_Config())
            {
                Console.Write(@"Falha carregar arquivo configuracao");
            }
            else
            {
                MySqlService.DoWork += (o, args) =>
                {
                    CoreMySql.IsConnectMySql();
                };
                MySqlService.RunWorkerCompleted += (o, args) =>
                {
                    if (!CoreMySql.CoreMe.IsOnline)
                    {
                        //Console.Write(@"Falha iniciar servico MySql");
                        Erros.Output(@"Falha iniciar Servico MySql",
                                     @"MetroWindow_Loaded");
                        CmdEntra.Visibility = Visibility.Collapsed;
                    }
                    else if (CoreMySql.CoreMe.IsOnline)
                    {
                        Erros.Output(@"Sucesso iniciar Servico MySql");
                        if (Usuario.MUsuario.Usuario == null)
                        {
                            CmdEntra.Visibility = Visibility.Visible;
                        }
                    }

                    // Check - Usuario online - Servico Mysql Online
                    UpdateStatusBar(CoreMySql.CoreMe.IsOnline, CoreMySql.CoreMe.Servidor, Usuario.MUsuario.Usuario ?? null);
                };
                MySqlService.RunWorkerAsync();
                //if (!CoreMySql.IsConnectMySql())
                //{
                //    Console.Write(@"Falha iniciar servico MySql");
                //}
            }
        }