private void frmMain_FormClosing(object sender, FormClosingEventArgs e) { if (MessageBox.Show(Constants.Exit_Confirm, Constants.Exit_Confirm_Title, MessageBoxButtons.YesNo) == DialogResult.Yes) { if (server != null) { server.Close(); } if (serverDB != null) { serverDB.Close(); } } else { e.Cancel = true; } }
public void Close() { socket.Close(); }
private void btnConnect_Click(object sender, EventArgs e) { if (btnConnect.Text == Constants.Connect) { btnConnect.Text = Constants.ReConnect; CanChooseServer(false); server = new ServerConnect { ServerName = txtServer.Text, Uid = txtUid.Text, Pwd = txtPwd.Text, Integreated = chkIntegrated.Checked }; var connection = server.Connection; ddlDatabase.BindingListControl(Data.ExecuteDataTable(connection, Constants.SQL_SelectDB), Constants.Name, Constants.ID); ddlType.BindingListControl( new Dictionary <string, string> { { "U", "Table" }, { "P", "Store Procedure" }, { "FN", "Function" }, { "TR", "Trigger" } }.ToList(), Constants.Value, Constants.Key); ddlParamType.BindingListControl( new Dictionary <string, string> { { "", "" }, { "SQL", "Sql Type" }, { "CSharp", "CSharp Type" }, { "Property", "Property" }, { "Set", "Set value" } }.ToList(), Constants.Value, Constants.Key); ddlGenerateType.BindingListControl( new Dictionary <string, string> { { "", "" }, { "StoreProcedure", "Store Procedure" }, { "StoreGetByPaging", "Store Get By Paging" }, { "Entity", "Entity" }, { "ADOIpl", "ADO Implement" }, { "Model", "Model" }, { "Controller", "Controller" }, { "JsController", "Javascript Controller" }, { "View", "View" }, { "Index", "View Index" }, { "Details", "View Details" }, { "AddOrEdit", "View Add/Edit" } }.ToList(), Constants.Value, Constants.Key); } else { if (server != null) { server.Close(); } btnConnect.Text = Constants.Connect; CanChooseServer(true); } }