Exemplo n.º 1
0
 private void btnConnection_Click(object sender, EventArgs e)
 {
     FormConfig frmConfig = new FormConfig();
     frmConfig.ShowDialog(this.ParentForm);
     string key = new DBToolConfig().Key;
     DBToolConfig config = ConfigManager.GetConfig(key) as DBToolConfig;
     foreach (DBToolConnection conn in config.Connections)
     {
         if (!treeView.Nodes.ContainsKey(conn.Name))
         {
             string text = string.Format("{0}({1})", conn.Name, conn.Type);
             TreeNode databaseNode = treeView.Nodes.Add(conn.Name, text, "database", "database");
             Database database = new Database(conn);
             databaseNode.Tag = database;
             databaseNode.Nodes.Add("TABLES", "TABLES", "table", "table").Tag = database;
         }
     }
     for (int i = 0; i < treeView.Nodes.Count; i++)
     {
         if (!config.Connections.Any(c => c.Name.Equals(treeView.Nodes[i].Name)))
         {
             treeView.Nodes.RemoveAt(i);
         }
     }
 }
Exemplo n.º 2
0
 private void btnConfig_Click(object sender, EventArgs e)
 {
     using (FormConfig form = new FormConfig())
     {
         form.ShowDialog(this);
     }
 }