private void btnImport_Click(object sender, EventArgs e) { if (openFileDialog1.ShowDialog() != DialogResult.OK || String.IsNullOrEmpty(openFileDialog1.FileName)) return; try { List<IDataTable> list = DAL.Import(File.ReadAllText(openFileDialog1.FileName)); Engine = null; Engine.Tables = list; SetTables(list); gbTable.Enabled = true; 模型ToolStripMenuItem.Visible = true; 架构管理SToolStripMenuItem.Visible = false; MessageBox.Show("导入架构成功!共" + (list == null ? 0 : list.Count) + "张表!", "导入架构", MessageBoxButtons.OK); } catch (Exception ex) { MessageBox.Show(ex.Message, this.Text, MessageBoxButtons.OK, MessageBoxIcon.Error); return; } }
private void bt_Connection_Click(object sender, EventArgs e) { SaveConfig(); if (bt_Connection.Text == "连接") { Engine = null; try { Engine.Tables = DAL.Create(Config.ConnName).Tables; } catch (Exception ex) { MessageBox.Show(ex.ToString(), this.Text); return; } SetTables(Engine.Tables); SetTables(null); SetTables(Engine.Tables); gbConnect.Enabled = false; gbTable.Enabled = true; 模型ToolStripMenuItem.Visible = true; 架构管理SToolStripMenuItem.Visible = true; btnImport.Enabled = false; bt_Connection.Text = "断开"; } else { SetTables(null); gbConnect.Enabled = true; gbTable.Enabled = false; 模型ToolStripMenuItem.Visible = false; 架构管理SToolStripMenuItem.Visible = false; btnImport.Enabled = true; bt_Connection.Text = "连接"; Engine = null; } }
private void bt_Connection_Click(object sender, EventArgs e) { SaveConfig(); if (bt_Connection.Text == "连接") { Engine = null; Engine.Tables = DAL.Create(Config.ConnName).Tables; SetTables(Engine.Tables); SetTables(null); SetTables(Engine.Tables); gbConnect.Enabled = false; gbTable.Enabled = true; btnShowSchema.Enabled = true; btnImport.Enabled = false; bt_Connection.Text = "断开"; } else { SetTables(null); gbConnect.Enabled = true; gbTable.Enabled = false; btnShowSchema.Enabled = false; btnImport.Enabled = true; bt_Connection.Text = "连接"; Engine = null; } }