Exemplo n.º 1
0
        private void InitTreeHandlers(SmartTreeView treeview)
        {
            List <SmartItem> itemList = FlattenTree(treeview.Items.GetFirstItem(SmartItemState.Any));

            foreach (SmartItem item in itemList)
            {
                item.Click += new SmartItemClickEventHandler(item_Click);
                if (item is TextBoxTool)
                {
                    TextBoxTool tb = (TextBoxTool)item;
                    tb.VirtualTextBox.TextChanged += new EventHandler(VirtualTextBox_TextChanged);
                }
            }
        }
Exemplo n.º 2
0
 /// <summary>
 /// 构造函数
 /// </summary>
 /// <param name="stv">SmartTreeView对象</param>
 public ExtendFunction(SmartTreeView stv)
 {
     this._stv = stv;
 }
Exemplo n.º 3
0
        public List <string> GetMetaDataFromTree(SmartTreeView treeview, out string quickName)
        {
            List <string>    metadata = new List <string>();
            StringWriter     b        = new StringWriter();
            List <SmartItem> itemList = FlattenTree(treeview.Items.GetFirstItem(SmartItemState.Any));

            string tagName  = "";
            string mainName = "";

            quickName = "";
            foreach (SmartItem item in itemList)
            {
                if (item is CheckedListBoxItem)
                {
                    if (((CheckedListBoxItem)item).Checked == true)
                    {
                        metadata.Add(item.Tag.ToString());
                    }
                }
                if (item is RadioButtonNode)
                {
                    if (((RadioButtonNode)item).Checked == true)
                    {
                        metadata.Add(item.Tag.ToString());
                        mainName = item.Tag.ToString();
                    }
                }
                if (item is TextBoxTool)
                {
                    if (((TextBoxTool)item).Text != "")
                    {
                        TextBoxTool tb = (TextBoxTool)item;

                        if (tb.VirtualTextBox.Text != "")
                        {
                            metadata.Add(tb.VirtualTextBox.Text.ToString());

                            if (tb.Text == "Tag")
                            {
                                tagName = tb.VirtualTextBox.Text;
                            }
                        }
                    }
                }
            }

            //build a quickname
            int names    = 0;
            int maxNames = 4;

            if (tagName != "")
            {
                quickName += tagName;
                names++;
            }
            if (mainName != "")
            {
                quickName += mainName;
                names++;
            }
            foreach (string s in metadata)
            {
                if (names <= maxNames && s != tagName && s != mainName)
                {
                    quickName += s;
                    names++;
                }
            }
            return(metadata);
        }
        /// <summary>
        /// 构造函数
        /// </summary>
        /// <param name="stv">SmartTreeView对象</param>
        public CascadeCheckboxFunction(SmartTreeView stv)
            : base(stv)
        {

        }