Beispiel #1
0
        private void ReloadUsedCount()
        {
            DataTable tbl = FormScan.GetDataTable("select *,(select count(*) from tbl_icon_item where icon.id=tbl_icon_item.iconid) as c from icon");

            for (int i = 0; i < tbl.Rows.Count; i++)
            {
                DataRow row       = tbl.Rows[i];
                int     id        = Convert.ToInt32(row["ID"]);
                int     usedcount = Convert.ToInt32(row["c"]);
                foreach (object o in m_iconsinfo)
                {
                    if (o is Info)
                    {
                        Info inf = o as Info;
                        if (inf.id == id)
                        {
                            inf.usedcount = usedcount;
                        }
                    }
                }
            }
        }
Beispiel #2
0
        private void FormSelector_Shown(object sender, EventArgs e)
        {
            Info SelectedInfo = null;

            foreach (object obj in m_iconsinfo)
            {
                Info info = (Info)obj;
                //ListViewItem item = listview.Items.Add(info.fielname, info.ImageIndex);
                //item.Tag = info;

                TreeNode node;
                if (!treeView.Nodes.ContainsKey(info.kind))
                {
                    node = treeView.Nodes.Add(info.kind, info.kind);
                }
                else
                {
                    node = treeView.Nodes[info.kind];
                }

                if (node.Tag == null)
                {
                    node.Tag = new ArrayList();
                }
                ArrayList arr = (ArrayList)node.Tag;

                arr.Add(info);
                m_allicons.Add(info);

                // ahpho
                // 在这里加入第二层的处理
                TreeNode _2ndNode      = null;
                TreeNode _undefineNode = null;
                if (!node.Nodes.ContainsKey(m_strUndefined))
                {
                    _undefineNode = node.Nodes.Add(m_strUndefined, m_strUndefined);
                }
                else
                {
                    _undefineNode = node.Nodes[m_strUndefined];
                }

                if (info.subKind == string.Empty)
                {
                    _2ndNode = _undefineNode;
                }
                else
                {
                    if (!node.Nodes.ContainsKey(info.subKind))
                    {
                        _2ndNode = node.Nodes.Add(info.subKind, info.subKind);
                    }
                    else
                    {
                        _2ndNode = node.Nodes[info.subKind];
                    }
                }

                if (_2ndNode.Tag == null)
                {
                    _2ndNode.Tag = new ArrayList();
                }
                ArrayList _2ndArr = _2ndNode.Tag as ArrayList;
                _2ndArr.Add(info);

                if (SelectedInfo == null && info.id == SelectedID)
                {
                    SelectedInfo = info;
                }
            }
            if (SelectedInfo != null)
            {
                TreeNode _node = FindTreeNodeWithInfo(SelectedInfo);
                treeView.SelectedNode = _node;


//                 TreeNode[] nodes = treeView.Nodes.Find(SelectedInfo.kind, true);
//                 if (nodes != null && nodes.Length > 0)
//                     treeView.SelectedNode = nodes[0];
            }
            listview.Select();

            DataTable tbl = FormScan.GetDataTable("select Tag1 from icon group by Tag1");

            foreach (DataRow row in tbl.Rows)
            {
                if (row[0].ToString() != string.Empty)
                {
                    txtTag1.Items.Add(row[0].ToString());
                }
            }
            tbl = FormScan.GetDataTable("select Tag2 from icon group by Tag2");
            foreach (DataRow row in tbl.Rows)
            {
                if (row[0].ToString() != string.Empty)
                {
                    txtTag2.Items.Add(row[0].ToString());
                }
            }
        }