Miscellaneous changes. Keep original end of line characters.
This commit is contained in:
@@ -1,116 +1,116 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Windows.Forms;
|
||||
using ServerExplorer.Code;
|
||||
using ServerExplorer.Controls;
|
||||
|
||||
namespace ServerExplorer.UI
|
||||
{
|
||||
public partial class FrmPrincipal : Form
|
||||
{
|
||||
#region Declarations
|
||||
|
||||
private static FrmPrincipal _currentInstance;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Creator
|
||||
|
||||
public FrmPrincipal()
|
||||
{
|
||||
_currentInstance = this;
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region WindowList
|
||||
|
||||
private List<Form> listChilds = new List<Form>();
|
||||
|
||||
public static void AddForm(Form frm)
|
||||
{
|
||||
frm.MdiParent = _currentInstance;
|
||||
frm.WindowState = FormWindowState.Maximized;
|
||||
frm.Show();
|
||||
_currentInstance.listChilds.Add(frm);
|
||||
frm.FormClosed += _currentInstance.FrmPrincipal_OnChildClose;
|
||||
_currentInstance.RefreshWindowButtons();
|
||||
}
|
||||
|
||||
protected void FrmPrincipal_OnChildClose(object sender, FormClosedEventArgs e)
|
||||
{
|
||||
listChilds.Remove((Form)sender);
|
||||
RefreshWindowButtons();
|
||||
}
|
||||
|
||||
private void FrmPrincipal_MdiChildActivate(object sender, EventArgs e)
|
||||
{
|
||||
RefreshWindowButtons();
|
||||
}
|
||||
|
||||
private void RefreshWindowButtons()
|
||||
{
|
||||
int childCount = listChilds.Count;
|
||||
int delta = childCount - flowpnlWindows.Controls.Count;
|
||||
if (delta < 0)
|
||||
{
|
||||
int dest = flowpnlWindows.Controls.Count + delta;
|
||||
for (int i = flowpnlWindows.Controls.Count - 1; i >= dest; i--)
|
||||
{
|
||||
flowpnlWindows.Controls.RemoveAt(i);
|
||||
}
|
||||
}
|
||||
else if (delta > 0)
|
||||
{
|
||||
for (int i = 0; i < delta; i++)
|
||||
{
|
||||
flowpnlWindows.Controls.Add(new WindowButton());
|
||||
}
|
||||
}
|
||||
for (int i = 0; i < childCount; i++)
|
||||
{
|
||||
WindowButton btn = (WindowButton)flowpnlWindows.Controls[i];
|
||||
Form frm = listChilds[i];
|
||||
btn.Text = frm.Text;
|
||||
btn.Window = frm;
|
||||
btn.Active = (frm == ActiveMdiChild);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Menus
|
||||
|
||||
private void menuConectarPRUEBAS_Click(object sender, EventArgs e)
|
||||
{
|
||||
// Crear ventana de la base de datos de pruebas
|
||||
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);
|
||||
}
|
||||
|
||||
private void menuBuscarServidor_Click(object sender, EventArgs e)
|
||||
{
|
||||
// Mostrar ventana de buscador de servidores
|
||||
var frm = new FrmServidores();
|
||||
FrmPrincipal.AddForm(frm);
|
||||
}
|
||||
|
||||
private void menuConectarA_Click(object sender, EventArgs e)
|
||||
{
|
||||
// Cargar configuracion
|
||||
var dialogo = new OpenFileDialog();
|
||||
if (dialogo.ShowDialog() != DialogResult.OK) return;
|
||||
|
||||
Config config = Config.Cargar(dialogo.FileName);
|
||||
|
||||
// Crear y mostrar ventana
|
||||
var frm = new FrmBaseDatos(config);
|
||||
FrmPrincipal.AddForm(frm);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Windows.Forms;
|
||||
using ServerExplorer.Code;
|
||||
using ServerExplorer.Controls;
|
||||
|
||||
namespace ServerExplorer.UI
|
||||
{
|
||||
public partial class FrmPrincipal : Form
|
||||
{
|
||||
#region Declarations
|
||||
|
||||
private static FrmPrincipal _currentInstance;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Creator
|
||||
|
||||
public FrmPrincipal()
|
||||
{
|
||||
_currentInstance = this;
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region WindowList
|
||||
|
||||
private List<Form> listChilds = new List<Form>();
|
||||
|
||||
public static void AddForm(Form frm)
|
||||
{
|
||||
frm.MdiParent = _currentInstance;
|
||||
frm.WindowState = FormWindowState.Maximized;
|
||||
frm.Show();
|
||||
_currentInstance.listChilds.Add(frm);
|
||||
frm.FormClosed += _currentInstance.FrmPrincipal_OnChildClose;
|
||||
_currentInstance.RefreshWindowButtons();
|
||||
}
|
||||
|
||||
protected void FrmPrincipal_OnChildClose(object sender, FormClosedEventArgs e)
|
||||
{
|
||||
listChilds.Remove((Form)sender);
|
||||
RefreshWindowButtons();
|
||||
}
|
||||
|
||||
private void FrmPrincipal_MdiChildActivate(object sender, EventArgs e)
|
||||
{
|
||||
RefreshWindowButtons();
|
||||
}
|
||||
|
||||
private void RefreshWindowButtons()
|
||||
{
|
||||
int childCount = listChilds.Count;
|
||||
int delta = childCount - flowpnlWindows.Controls.Count;
|
||||
if (delta < 0)
|
||||
{
|
||||
int dest = flowpnlWindows.Controls.Count + delta;
|
||||
for (int i = flowpnlWindows.Controls.Count - 1; i >= dest; i--)
|
||||
{
|
||||
flowpnlWindows.Controls.RemoveAt(i);
|
||||
}
|
||||
}
|
||||
else if (delta > 0)
|
||||
{
|
||||
for (int i = 0; i < delta; i++)
|
||||
{
|
||||
flowpnlWindows.Controls.Add(new WindowButton());
|
||||
}
|
||||
}
|
||||
for (int i = 0; i < childCount; i++)
|
||||
{
|
||||
WindowButton btn = (WindowButton)flowpnlWindows.Controls[i];
|
||||
Form frm = listChilds[i];
|
||||
btn.Text = frm.Text;
|
||||
btn.Window = frm;
|
||||
btn.Active = (frm == ActiveMdiChild);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Menus
|
||||
|
||||
private void menuConectarPRUEBAS_Click(object sender, EventArgs e)
|
||||
{
|
||||
// Crear ventana de la base de datos de pruebas
|
||||
var frm = new FrmBaseDatos("Data Source=localhost;Initial Catalog=Tests;Integrated Security=True");
|
||||
//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);
|
||||
}
|
||||
|
||||
private void menuBuscarServidor_Click(object sender, EventArgs e)
|
||||
{
|
||||
// Mostrar ventana de buscador de servidores
|
||||
var frm = new FrmServidores();
|
||||
FrmPrincipal.AddForm(frm);
|
||||
}
|
||||
|
||||
private void menuConectarA_Click(object sender, EventArgs e)
|
||||
{
|
||||
// Cargar configuracion
|
||||
var dialogo = new OpenFileDialog();
|
||||
if (dialogo.ShowDialog() != DialogResult.OK) return;
|
||||
|
||||
Config config = Config.Cargar(dialogo.FileName);
|
||||
|
||||
// Crear y mostrar ventana
|
||||
var frm = new FrmBaseDatos(config);
|
||||
FrmPrincipal.AddForm(frm);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user