public static void AddList(DbXmlInfo info)
        {
            lock (dbList)
            {
                var item = dbList.Find(p => p.Name == info.Name);
                if (item == null)
                {
                    dbList.Add(item);
                }
                else
                {
                    string name  = info.Name;
                    int    index = 1;
                    while (item != null)
                    {
                        info.Name = name + "_" + index;
                        item      = dbList.Find(p => p.Name == info.Name);
                    }

                    dbList.Add(info);
                }

                SaveXml();
            }
        }
        public static void EditList(DbXmlInfo info)
        {
            lock (dbList)
            {
                var item = dbList.Find(p => p.Guid == info.Guid);
                item = info;

                SaveXml();
            }
        }
Пример #3
0
        private void lstdb_MouseDoubleClick(object sender, MouseEventArgs e)
        {
            int index = this.lstdb.IndexFromPoint(e.Location);

            if (index != System.Windows.Forms.ListBox.NoMatches)
            {
                string name = lstdb.Items[index].ToString();

                this.xmlInfo = DbXmlHelper.GetItem(name);
                if (this.xmlInfo != null)
                {
                    var tableList = DbManager.ReadAllTables(this.xmlInfo.Path, this.xmlInfo.Pwd);
                    this.Invoke(new Action <ListBox>(p =>
                    {
                        foreach (var table in tableList)
                        {
                            p.Items.Add(table);
                        }
                    }), this.lstTables);
                }
            }
        }