Пример #1
0
 public bool RemoveItem(ItemBase item)
 {
     if (dtItems == null)
     {
         dtItems = new List <ItemBase>();
     }
     if (item == null)
     {
         throw new Exception("参数不能为空.");
     }
     if (commandChangedEvent != null)
     {
         CommandChangedArgs args = new CommandChangedArgs(item, CommandChangedArgs.EnumChangeType.Remove, null);
         commandChangedEvent(null, args);
     }
     return(dtItems.Remove(item));
 }
Пример #2
0
 public void AddItem(ItemBase item)
 {
     if (dtItems == null)
     {
         dtItems = new List <ItemBase>();
     }
     if (item == null)
     {
         throw new Exception("参数不能为空.");
     }
     if (Contains(item.Name))
     {
         throw new Exception("名称已存在.");
     }
     dtItems.Add(item);
     if (commandChangedEvent != null)
     {
         CommandChangedArgs args = new CommandChangedArgs(item, CommandChangedArgs.EnumChangeType.Add, null);
         commandChangedEvent(null, args);
     }
 }
Пример #3
0
 public bool RemoveItem(ItemBase item)
 {
     if (dtItems == null)
     {
         dtItems = new List<ItemBase>();
     }
     if (item == null)
     {
         throw new Exception("参数不能为空.");
     }
     if (commandChangedEvent != null)
     {
         CommandChangedArgs args = new CommandChangedArgs(item, CommandChangedArgs.EnumChangeType.Remove, null);
         commandChangedEvent(null, args);
     }
     return dtItems.Remove(item);
 }
Пример #4
0
 public void AddItem(ItemBase item)
 {
     if (dtItems == null)
     {
         dtItems = new List<ItemBase>();
     }
     if (item == null)
     {
         throw new Exception("参数不能为空.");
     }
     if (Contains(item.Name))
     {
         throw new Exception("名称已存在.");
     }
     dtItems.Add(item);
     if (commandChangedEvent != null)
     {
         CommandChangedArgs args = new CommandChangedArgs(item, CommandChangedArgs.EnumChangeType.Add, null);
         commandChangedEvent(null,args);
     }
 }