protected virtual void OnSelection(LibraryEntry entity)
 {
     SelectionEventHandler handler = selection;
     if (handler != null) { handler(this, new SelectionEventArgs(entity)); }
 }
 public SelectionEventArgs(LibraryEntry entity)
 {
     this.entity = entity;
 }
示例#3
0
 protected int AddEntry(LibraryEntry newEntry)
 {
     if (CountOf(newEntry.id) > 0)
     {
         Logger.Warn("Could not add " + newEntry.GetType().Name.ToLower() + " " + newEntry.ToString() + ": ID already exists for " + FindEntry(newEntry.id).ToString());
         throw new System.ArgumentException(GetType().ToString() + " library already contains ID " + newEntry.id, "newEntry");
     }
     else
     {
         entries.Add(newEntry);
         Logger.Info("Added new " + newEntry.GetType().Name.ToLower() + ": " + newEntry.ToString());
         Bestiary.changed = true;
         return newEntry.id;
     }
 }
示例#4
0
 protected bool RemoveEntry(LibraryEntry entry)
 {
     bool state = entries.Remove(entry);
     Logger.Info("Removed " + entry.GetType().Name.ToLower() + " " + entry.ToString());
     if (state) { Bestiary.changed = true; }
     return state;
 }
示例#5
0
 public void UpdateEntry(int id, LibraryEntry updatedEntry)
 {
     entries[FindIndexOf(id)] = updatedEntry;
     Bestiary.changed = true;
 }