Limpieza usando recomendaciones de R#

This commit is contained in:
2014-09-09 12:47:52 +02:00
parent 00b1da5da7
commit 9d77bb552b
12 changed files with 222 additions and 313 deletions

View File

@@ -1,10 +1,5 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using ServerExplorer.Code;
using ServerExplorer.Controls;
@@ -15,7 +10,7 @@ namespace ServerExplorer.UI
{
#region Declarations
private static FrmPrincipal currentInstance;
private static FrmPrincipal _currentInstance;
#endregion
@@ -23,7 +18,7 @@ namespace ServerExplorer.UI
public FrmPrincipal()
{
currentInstance = this;
_currentInstance = this;
InitializeComponent();
}
@@ -35,12 +30,12 @@ namespace ServerExplorer.UI
public static void AddForm(Form frm)
{
frm.MdiParent = currentInstance;
frm.MdiParent = _currentInstance;
frm.WindowState = FormWindowState.Maximized;
frm.Show();
currentInstance.listChilds.Add(frm);
frm.FormClosed += currentInstance.FrmPrincipal_OnChildClose;
currentInstance.RefreshWindowButtons();
_currentInstance.listChilds.Add(frm);
frm.FormClosed += _currentInstance.FrmPrincipal_OnChildClose;
_currentInstance.RefreshWindowButtons();
}
protected void FrmPrincipal_OnChildClose(object sender, FormClosedEventArgs e)
@@ -90,7 +85,7 @@ namespace ServerExplorer.UI
private void menuConectarPRUEBAS_Click(object sender, EventArgs e)
{
// Crear ventana de la base de datos de pruebas
FrmBaseDatos frm = new FrmBaseDatos("Data Source=SSSRV3;Initial Catalog=PRUEBAS;User ID=sa;Password=SLsssrv3");
var frm = new FrmBaseDatos("Data Source=SSSRV3;Initial Catalog=PRUEBAS;User ID=sa;Password=SLsssrv3");
//frmBaseDatos frm = new frmBaseDatos("Data Source=DANTE;Initial Catalog=BD_AlfonsoRodriguez;Integrated Security=True");
//frmBaseDatos frm = new frmBaseDatos("Data Source=OSKURITO;Initial Catalog=BD_AlfonsoRodriguez;Integrated Security=True");
FrmPrincipal.AddForm(frm);
@@ -99,22 +94,21 @@ namespace ServerExplorer.UI
private void menuBuscarServidor_Click(object sender, EventArgs e)
{
// Mostrar ventana de buscador de servidores
FrmServidores frm = new FrmServidores();
var frm = new FrmServidores();
FrmPrincipal.AddForm(frm);
}
private void menuConectarA_Click(object sender, EventArgs e)
{
// Cargar configuracion
OpenFileDialog dialogo = new OpenFileDialog();
if (dialogo.ShowDialog() == DialogResult.OK)
{
Config config = Config.Cargar(dialogo.FileName);
var dialogo = new OpenFileDialog();
if (dialogo.ShowDialog() != DialogResult.OK) return;
// Crear y mostrar ventana
FrmBaseDatos frm = new FrmBaseDatos(config);
FrmPrincipal.AddForm(frm);
}
Config config = Config.Cargar(dialogo.FileName);
// Crear y mostrar ventana
var frm = new FrmBaseDatos(config);
FrmPrincipal.AddForm(frm);
}
#endregion