private void Form_Database_Load(object sender, EventArgs e) { Form.CheckForIllegalCrossThreadCalls = false; var serverList = new Common.Config_Servers().GetAll(); foreach (var server in serverList) { Model.Servers ser = new Servers(); ser.DatabaseName = server.Database; ser.ID = server.Name; ser.Name = server.ServerName; ser.Password = server.Pwd; ser.Port = server.Port.IsInt() ? server.Port.ToInt() : -1; ser.Server = server.ServerName; Model.DatabaseType dbtype; ser.Type = Enum.TryParse(server.Type, out dbtype) ? dbtype : DatabaseType.Empty; ser.UserID = server.Uid; Common.Config.AddServerList(ser); TreeNode RootNode = new TreeNode(); RootNode.Name = server.ServerName; RootNode.Text = string.Format("{0}({1}{2})", server.ServerName, server.Type.ToString(), server.Uid.IsNullOrEmpty() ? "" : string.Format("-{0}", server.Uid)); RootNode.ImageIndex = 0; RootNode.SelectedImageIndex = 0; RootNode.Tag = new Model.TreeNodeTag() { Type = TreeNodeType.Server, Tag = ser }; treeView1.Nodes.Add(RootNode); } }
private void Form_AddDatabase_Sqlite_Load(object sender, EventArgs e) { var def = new Common.Config_Servers().GetDefault(dbType); if (def != null) { this.textBox_file.Text = def.file; this.textBox_pwd.Text = def.Pwd; } }
private void Form_AddDatabase_Load(object sender, EventArgs e) { //设定默认选择项 var server = new Common.Config_Servers().GetDefault(); if (server != null) { foreach (Control c in this.panel_selectdbtype.Controls) { if (c.GetType().Name=="RadioButton" && c.Text.Replace(" ", "") == server.Type) { ((RadioButton)c).Checked = true; } } } }
private void Form_AddDatabase_Load(object sender, EventArgs e) { //设定默认选择项 var server = new Common.Config_Servers().GetDefault(); if (server != null) { foreach (Control c in this.panel_selectdbtype.Controls) { if (c.GetType().Name == "RadioButton" && c.Text.Replace(" ", "") == server.Type) { ((RadioButton)c).Checked = true; } } } }
private void refresh() { this.listView1.Items.Clear(); var list = new Common.Config_Servers().GetAll(); foreach (var li in list) { this.listView1.Items.Add(new ListViewItem( new string[]{ li.Name, li.Type, li.ServerName, li.Uid } )); } }
private void refresh() { this.listView1.Items.Clear(); var list = new Common.Config_Servers().GetAll(); foreach (var li in list) { this.listView1.Items.Add(new ListViewItem( new string[] { li.Name, li.Type, li.ServerName, li.Uid } )); } }
private void Form_AddDatabase_MySql_Load(object sender, EventArgs e) { Common.Config_Servers CS = new Common.Config_Servers(); csList = CS.GetAll().Where(p => p.Type == this.dbType.ToString()); foreach (var li in csList) { this.comboBox_mysql_server.Items.Add(li.ServerName); } Model.ConfigServers cs = CS.GetDefault(this.dbType); if (cs != null) { this.comboBox_mysql_server.Text = cs.ServerName; this.textBox_mysql_pwd.Text = cs.Pwd; this.textBox_mysql_uid.Text = cs.Uid; this.checkBox1.Checked = !cs.Pwd.IsNullOrEmpty(); } }
private void Form_AddDatabase_SqlServer_Load(object sender, EventArgs e) { this.label8.Text = this.dbType.ToString(); Common.Config_Servers CS=new Common.Config_Servers(); csList = CS.GetAll().Where(p => p.Type == this.dbType.ToString()); foreach (var li in csList) { this.sqlserver_server.Items.Add(li.ServerName); } Model.ConfigServers cs = CS.GetDefault(this.dbType); if (cs != null) { this.sqlserver_server.Text = cs.ServerName; this.sqlserver_pwd.Text = cs.Pwd; this.sqlserver_uid.Text = cs.Uid; this.checkBox1.Checked = !cs.Pwd.IsNullOrEmpty(); } }