Esempio n. 1
0
 internal void SetItem(int id, ListItem item)
 {
     int index = FindItem(id);
     if (index != -1)
         base.Items[index] = item.CloneData();
 }
Esempio n. 2
0
        //插入新项
        internal int InsertItem(int index, ListItem item, int method)
        {
            if (isUpdate) return 0;
            ListItem lit = item.CloneData();
            lit.Items = null;
            lit.level = item.level;
            int count = 0;
            if (item.Parent.GetType() == typeof(ListItem))
            {
                ListItem parent = (ListItem)item.Parent;
                foreach (ListItem lt1 in parent.Items)
                {
                    GetItemLocation(lt1.Items, lit, ref count);
                }
                lit.Parent = parent;
                int i = 0;
                for (; i < base.Items.Count; i++)
                {
                    if (GetItem(i).id == parent.id)
                    {
                        break;
                    }
                }

                base.Items.Insert(i + 1 + index + count, lit);
            }
            else
            {
                foreach (ListItem lt1 in ((EnforceLawComboBox)item.Parent).Items)
                {
                    GetItemLocation(lt1.Items, lit, ref count);
                }

                base.Items.Insert(index + count, lit);
            }
            return base.Items.Count - 1;
        }