📄 mainform.cs
字号:
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
using System.Threading;
using System.Runtime.InteropServices;
using YariSoft.Utils;
namespace YariSoft.DBCommander
{
public class MainForm : System.Windows.Forms.Form
{
#region Private variables declaration
private const string applicationName = "Database Commander";
private const string optionsFileName = "Options.xml";
private YariSoft.DBCommander.Misc.OptionsInfo options
= null;
private YariSoft.DBCommander.Misc.ConfigInfo config
= null;
private DataPanel focusPanel = null;
private YariSoft.Utils.AgentManager
agent = new YariSoft.Utils.AgentManager();
private System.Windows.Forms.MainMenu mainMenu;
private System.Windows.Forms.MenuItem fileMenuItem;
private System.Windows.Forms.MenuItem aboutMenuItem;
private System.Windows.Forms.MenuItem operationMenuItem;
private System.Windows.Forms.MenuItem connectionMenuItem;
private System.Windows.Forms.MenuItem viewMenuItem;
private System.Windows.Forms.MenuItem editMenuItem;
private System.Windows.Forms.MenuItem copyMenuItem;
private System.Windows.Forms.MenuItem moveMenuItem;
private System.Windows.Forms.MenuItem createMenuItem;
private System.Windows.Forms.MenuItem deleteMenuItem;
private System.Windows.Forms.MenuItem downMenuItem;
private System.Windows.Forms.MenuItem upMenuItem;
private System.Windows.Forms.Splitter splitter;
private YariSoft.DBCommander.DataPanel leftDataPanel;
private YariSoft.DBCommander.DataPanel rightDataPanel;
private System.Windows.Forms.ToolBar operationBar;
private System.Windows.Forms.ToolBarButton botViewButton;
private System.Windows.Forms.ToolBarButton botEditButton;
private System.Windows.Forms.ToolBarButton botCopyButton;
private System.Windows.Forms.ToolBarButton botMoveButton;
private System.Windows.Forms.ToolBarButton botCreateButton;
private System.Windows.Forms.ToolBarButton botDeleteButton;
private System.Windows.Forms.ToolBarButton botConnectionButton;
private System.Windows.Forms.ToolBarButton botUpButton;
private System.Windows.Forms.ToolBarButton botDownButton;
private System.Windows.Forms.MenuItem menuItem7;
private System.Windows.Forms.MenuItem exitMenuItem;
private System.Windows.Forms.MenuItem newMenuItem;
private System.Windows.Forms.MenuItem openMenuItem;
private System.Windows.Forms.MenuItem menuSeparator0;
private System.Windows.Forms.MenuItem saveMenuItem;
private System.Windows.Forms.MenuItem saveAsmenuItem;
private System.Windows.Forms.MenuItem menuSeparator1;
private System.Windows.Forms.MenuItem optionsMenuItem;
private System.Windows.Forms.MenuItem menuSeparator2;
private System.Windows.Forms.ToolBar toolBar;
private System.Windows.Forms.ImageList imageList;
private System.Windows.Forms.ToolBarButton toolSep0;
private System.Windows.Forms.ToolBarButton toolNewButton;
private System.Windows.Forms.ToolBarButton toolOpenButton;
private System.Windows.Forms.ToolBarButton toolSaveButton;
private System.Windows.Forms.ToolBarButton toolSep1;
private System.Windows.Forms.ToolBarButton toolConnectionButton;
private System.Windows.Forms.ToolBarButton toolUpButton;
private System.Windows.Forms.ToolBarButton toolDownButton;
private System.Windows.Forms.ToolBarButton toolSep2;
private System.Windows.Forms.ToolBarButton toolOptionsButton;
private System.Windows.Forms.MenuItem helpMenuItem;
private System.Windows.Forms.MenuItem genaralMenuItem;
private System.Windows.Forms.MenuItem chanegPanelMenuItem;
private System.Windows.Forms.MenuItem selectMenuItem;
private System.Windows.Forms.MenuItem unselectMenuItem;
private System.Windows.Forms.MenuItem menuSeparator3;
private System.Windows.Forms.MenuItem menuSeparator4;
private System.Windows.Forms.MenuItem refreshMenuItem;
private System.Windows.Forms.ToolBarButton toolRefreshButton;
private System.Windows.Forms.MenuItem hideLeftPanelMenuItem;
private System.Windows.Forms.MenuItem hideRightPanelMenuItem;
private System.Windows.Forms.MenuItem menuSeparator5;
private System.Windows.Forms.MenuItem menuSeparator6;
private System.Windows.Forms.MenuItem filterMenuItem;
private System.Windows.Forms.MenuItem clearFilterMenuItem;
private System.ComponentModel.IContainer components = null;
#endregion
#region Constructor/destructor
[STAThread]
static void Main()
{
YariSoft.Exceptions.YSExceptionHandler exceptionHandler = new YariSoft.Exceptions.YSExceptionHandler();
Application.ThreadException += new ThreadExceptionEventHandler ( exceptionHandler.OnThreadException );
Application.Run(new MainForm());
}
public MainForm()
{
InitializeComponent();
this.leftDataPanel.OnGridClick += new DataPanel.OnGridClickEventHandler( this.OnPanelGridClick );
this.rightDataPanel.OnGridClick += new DataPanel.OnGridClickEventHandler( this.OnPanelGridClick );
}
protected override void Dispose( bool disposing )
{
if( disposing ){
if (components != null) {
components.Dispose();
}
}
base.Dispose( disposing );
}
#endregion
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(MainForm));
this.mainMenu = new System.Windows.Forms.MainMenu();
this.fileMenuItem = new System.Windows.Forms.MenuItem();
this.newMenuItem = new System.Windows.Forms.MenuItem();
this.openMenuItem = new System.Windows.Forms.MenuItem();
this.menuSeparator0 = new System.Windows.Forms.MenuItem();
this.saveMenuItem = new System.Windows.Forms.MenuItem();
this.saveAsmenuItem = new System.Windows.Forms.MenuItem();
this.menuSeparator1 = new System.Windows.Forms.MenuItem();
this.optionsMenuItem = new System.Windows.Forms.MenuItem();
this.menuSeparator2 = new System.Windows.Forms.MenuItem();
this.exitMenuItem = new System.Windows.Forms.MenuItem();
this.operationMenuItem = new System.Windows.Forms.MenuItem();
this.genaralMenuItem = new System.Windows.Forms.MenuItem();
this.connectionMenuItem = new System.Windows.Forms.MenuItem();
this.viewMenuItem = new System.Windows.Forms.MenuItem();
this.editMenuItem = new System.Windows.Forms.MenuItem();
this.copyMenuItem = new System.Windows.Forms.MenuItem();
this.moveMenuItem = new System.Windows.Forms.MenuItem();
this.createMenuItem = new System.Windows.Forms.MenuItem();
this.deleteMenuItem = new System.Windows.Forms.MenuItem();
this.downMenuItem = new System.Windows.Forms.MenuItem();
this.upMenuItem = new System.Windows.Forms.MenuItem();
this.chanegPanelMenuItem = new System.Windows.Forms.MenuItem();
this.menuSeparator3 = new System.Windows.Forms.MenuItem();
this.selectMenuItem = new System.Windows.Forms.MenuItem();
this.unselectMenuItem = new System.Windows.Forms.MenuItem();
this.menuSeparator6 = new System.Windows.Forms.MenuItem();
this.filterMenuItem = new System.Windows.Forms.MenuItem();
this.clearFilterMenuItem = new System.Windows.Forms.MenuItem();
this.menuSeparator4 = new System.Windows.Forms.MenuItem();
this.hideLeftPanelMenuItem = new System.Windows.Forms.MenuItem();
this.hideRightPanelMenuItem = new System.Windows.Forms.MenuItem();
this.menuSeparator5 = new System.Windows.Forms.MenuItem();
this.refreshMenuItem = new System.Windows.Forms.MenuItem();
this.helpMenuItem = new System.Windows.Forms.MenuItem();
this.aboutMenuItem = new System.Windows.Forms.MenuItem();
this.leftDataPanel = new YariSoft.DBCommander.DataPanel();
this.splitter = new System.Windows.Forms.Splitter();
this.rightDataPanel = new YariSoft.DBCommander.DataPanel();
this.operationBar = new System.Windows.Forms.ToolBar();
this.botConnectionButton = new System.Windows.Forms.ToolBarButton();
this.botViewButton = new System.Windows.Forms.ToolBarButton();
this.botEditButton = new System.Windows.Forms.ToolBarButton();
this.botCopyButton = new System.Windows.Forms.ToolBarButton();
this.botMoveButton = new System.Windows.Forms.ToolBarButton();
this.botCreateButton = new System.Windows.Forms.ToolBarButton();
this.botDeleteButton = new System.Windows.Forms.ToolBarButton();
this.botDownButton = new System.Windows.Forms.ToolBarButton();
this.botUpButton = new System.Windows.Forms.ToolBarButton();
this.menuItem7 = new System.Windows.Forms.MenuItem();
this.toolBar = new System.Windows.Forms.ToolBar();
this.toolSep0 = new System.Windows.Forms.ToolBarButton();
this.toolNewButton = new System.Windows.Forms.ToolBarButton();
this.toolOpenButton = new System.Windows.Forms.ToolBarButton();
this.toolSaveButton = new System.Windows.Forms.ToolBarButton();
this.toolSep1 = new System.Windows.Forms.ToolBarButton();
this.toolConnectionButton = new System.Windows.Forms.ToolBarButton();
this.toolDownButton = new System.Windows.Forms.ToolBarButton();
this.toolUpButton = new System.Windows.Forms.ToolBarButton();
this.toolRefreshButton = new System.Windows.Forms.ToolBarButton();
this.toolSep2 = new System.Windows.Forms.ToolBarButton();
this.toolOptionsButton = new System.Windows.Forms.ToolBarButton();
this.imageList = new System.Windows.Forms.ImageList(this.components);
this.SuspendLayout();
//
// mainMenu
//
this.mainMenu.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
this.fileMenuItem,
this.operationMenuItem,
this.helpMenuItem});
//
// fileMenuItem
//
this.fileMenuItem.Index = 0;
this.fileMenuItem.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
this.newMenuItem,
this.openMenuItem,
this.menuSeparator0,
this.saveMenuItem,
this.saveAsmenuItem,
this.menuSeparator1,
this.optionsMenuItem,
this.menuSeparator2,
this.exitMenuItem});
this.fileMenuItem.Text = "&File";
//
// newMenuItem
//
this.newMenuItem.Index = 0;
this.newMenuItem.Text = "&New";
this.newMenuItem.Click += new System.EventHandler(this.newMenuItem_Click);
//
// openMenuItem
//
this.openMenuItem.Index = 1;
this.openMenuItem.Text = "&Open";
this.openMenuItem.Click += new System.EventHandler(this.openMenuItem_Click);
//
// menuSeparator0
//
this.menuSeparator0.Index = 2;
this.menuSeparator0.Text = "-";
//
// saveMenuItem
//
this.saveMenuItem.Index = 3;
this.saveMenuItem.Text = "&Save";
this.saveMenuItem.Click += new System.EventHandler(this.saveMenuItem_Click);
//
// saveAsmenuItem
//
this.saveAsmenuItem.Index = 4;
this.saveAsmenuItem.Text = "Save &as...";
this.saveAsmenuItem.Click += new System.EventHandler(this.saveAsmenuItem_Click);
//
// menuSeparator1
//
this.menuSeparator1.Index = 5;
this.menuSeparator1.Text = "-";
//
// optionsMenuItem
//
this.optionsMenuItem.Index = 6;
this.optionsMenuItem.Text = "Op&tions";
this.optionsMenuItem.Click += new System.EventHandler(this.optionsMenuItem_Click);
//
// menuSeparator2
//
this.menuSeparator2.Index = 7;
this.menuSeparator2.Text = "-";
//
// exitMenuItem
//
this.exitMenuItem.Index = 8;
this.exitMenuItem.Shortcut = System.Windows.Forms.Shortcut.AltF4;
this.exitMenuItem.Text = "&Exit";
this.exitMenuItem.Click += new System.EventHandler(this.exitMenuItem_Click);
//
// operationMenuItem
//
this.operationMenuItem.Index = 1;
this.operationMenuItem.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
this.genaralMenuItem,
this.chanegPanelMenuItem,
this.menuSeparator3,
this.selectMenuItem,
this.unselectMenuItem,
this.menuSeparator6,
this.filterMenuItem,
this.clearFilterMenuItem,
this.menuSeparator4,
this.hideLeftPanelMenuItem,
this.hideRightPanelMenuItem,
this.menuSeparator5,
this.refreshMenuItem});
this.operationMenuItem.Text = "&Operations";
//
// genaralMenuItem
//
this.genaralMenuItem.Index = 0;
this.genaralMenuItem.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
this.connectionMenuItem,
this.viewMenuItem,
this.editMenuItem,
this.copyMenuItem,
this.moveMenuItem,
this.createMenuItem,
this.deleteMenuItem,
this.downMenuItem,
this.upMenuItem});
this.genaralMenuItem.Text = "&General";
//
// connectionMenuItem
//
this.connectionMenuItem.Index = 0;
this.connectionMenuItem.Shortcut = System.Windows.Forms.Shortcut.F2;
this.connectionMenuItem.Text = "Connection";
this.connectionMenuItem.Click += new System.EventHandler(this.connectionMenuItem_Click);
//
// viewMenuItem
//
this.viewMenuItem.Enabled = false;
this.viewMenuItem.Index = 1;
this.viewMenuItem.Shortcut = System.Windows.Forms.Shortcut.F3;
this.viewMenuItem.Text = "View";
this.viewMenuItem.Click += new System.EventHandler(this.viewMenuItem_Click);
//
// editMenuItem
//
this.editMenuItem.Enabled = false;
this.editMenuItem.Index = 2;
this.editMenuItem.Shortcut = System.Windows.Forms.Shortcut.F4;
this.editMenuItem.Text = "Edit";
this.editMenuItem.Click += new System.EventHandler(this.editMenuItem_Click);
//
// copyMenuItem
//
this.copyMenuItem.Index = 3;
this.copyMenuItem.Shortcut = System.Windows.Forms.Shortcut.F5;
this.copyMenuItem.Text = "Copy";
this.copyMenuItem.Click += new System.EventHandler(this.copyMenuItem_Click);
//
// moveMenuItem
//
this.moveMenuItem.Index = 4;
this.moveMenuItem.Shortcut = System.Windows.Forms.Shortcut.F6;
this.moveMenuItem.Text = "Move";
this.moveMenuItem.Click += new System.EventHandler(this.moveMenuItem_Click);
//
// createMenuItem
//
this.createMenuItem.Enabled = false;
this.createMenuItem.Index = 5;
this.createMenuItem.Shortcut = System.Windows.Forms.Shortcut.F7;
this.createMenuItem.Text = "Create";
this.createMenuItem.Click += new System.EventHandler(this.createMenuItem_Click);
//
// deleteMenuItem
//
this.deleteMenuItem.Index = 6;
this.deleteMenuItem.Shortcut = System.Windows.Forms.Shortcut.F8;
this.deleteMenuItem.Text = "Delete";
this.deleteMenuItem.Click += new System.EventHandler(this.deleteMenuItem_Click);
//
// downMenuItem
//
this.downMenuItem.Index = 7;
this.downMenuItem.Shortcut = System.Windows.Forms.Shortcut.F9;
this.downMenuItem.Text = "Down";
this.downMenuItem.Click += new System.EventHandler(this.downMenuItem_Click);
//
// upMenuItem
//
this.upMenuItem.Index = 8;
this.upMenuItem.Shortcut = System.Windows.Forms.Shortcut.F10;
this.upMenuItem.Text = "Up";
this.upMenuItem.Click += new System.EventHandler(this.upMenuItem_Click);
//
// chanegPanelMenuItem
//
this.chanegPanelMenuItem.Index = 1;
this.chanegPanelMenuItem.Text = "&Change panel Ctrl+Tab";
this.chanegPanelMenuItem.Click += new System.EventHandler(this.chanegPanelMenuItem_Click);
//
// menuSeparator3
//
this.menuSeparator3.Index = 2;
this.menuSeparator3.Text = "-";
//
// selectMenuItem
//
this.selectMenuItem.Index = 3;
this.selectMenuItem.Text = "&Select +";
this.selectMenuItem.Click += new System.EventHandler(this.selectMenuItem_Click);
//
// unselectMenuItem
//
this.unselectMenuItem.Index = 4;
this.unselectMenuItem.Text = "&Unselect -";
this.unselectMenuItem.Click += new System.EventHandler(this.unselectMenuItem_Click);
//
// menuSeparator6
//
this.menuSeparator6.Index = 5;
this.menuSeparator6.Text = "-";
//
// filterMenuItem
//
this.filterMenuItem.Index = 6;
this.filterMenuItem.Text = "&Filter *";
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -