Example #1
0
        private static void Main()
        {
            //// verificar red
            Process mapwindow;

            Config.Load();
            try
            {
                DBNotifyListeners.CheckBD();
            }
            catch (Exception e)
            {
                //MessageBox.Show("Ha ocurrido el siguiente error al intentar conectar con la base de datos:\n"+e.Message+"\nLa aplicación se cerrará.","Error de conexión", MessageBoxButtons.OK, MessageBoxIcon.Error);
                Log.ShowAndLog(e);
                return;
            }

            System.Windows.Forms.Application.EnableVisualStyles();
            System.Windows.Forms.Application.SetCompatibleTextRenderingDefault(false);
            System.Windows.Forms.Application.Run(new MainForm());
            //var fi = new FileInfo(System.Windows.Forms.Application.StartupPath + @"\MapWindow\MapWindow.exe");
            //if (fi.Exists)
            //{
            //ProcessStartInfo pi = new ProcessStartInfo(fi.FullName, fi.DirectoryName + @"\New.mwprj") { WorkingDirectory = fi.DirectoryName };
            //mapwindow = Process.Start(pi);
            //}
        }
Example #2
0
        private void btnProbar_Click(object sender, EventArgs e)
        {
            if (Validar())
            {
                string preHost = Config.Host, preBD = Config.Database;

                SetValues(textIP.Text, comboBD.Text);
                try
                {
                    DBNotifyListeners.CheckBD();
                    MessageBox.Show("La prueba de conexión fue correcta", "Conexión exitosa");
                }
                catch (Exception ex)
                {
                    SetValues(preHost, preBD);
                    MessageBox.Show(ex.Message, "Ha ocurrido un error");
                }
            }
        }