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)); }
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); } }
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); }
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); } }