Example #1
0
        void newClassItem_Click(object sender, EventArgs e)
        {
            int    index = 1;
            String str   = null;

            for (; ;)
            {
                str = String.Format("分类{0}", index);

                foreach (TreeNode item in treeView.Nodes)
                {
                    if (item.Text == str)
                    {
                        str = null;
                        break;
                    }
                }

                if (str == null)
                {
                    index++;
                }
                else
                {
                    break;
                }
            }

            var node = treeView.Nodes.Add(str);

            _pixmapManage.insertClass(str);
            saveIconInfo();
        }
Example #2
0
        /// <summary>
        /// 新建图元分类
        /// </summary>
        /// <param oldName="sender"></param>
        /// <param oldName="e"></param>
        public void NewClassItem_Click(object sender, RoutedEventArgs e)
        {
            BindingList <String> list = this.classlistView.ItemsSource as BindingList <String>;

            WPFNewIconClassDialog dialog = new WPFNewIconClassDialog();

            dialog.setNameData(list);
            if (dialog.ShowDialog() == true)
            {
                String name = dialog.textBox.Text;
                _picManager.insertClass(name);
                list.Add(name);
                saveIconInfo();
            }
        }