protected virtual void OnSelection(LibraryEntry entity) { SelectionEventHandler handler = selection; if (handler != null) { handler(this, new SelectionEventArgs(entity)); } }
public SelectionEventArgs(LibraryEntry entity) { this.entity = entity; }
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; } }
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; }
public void UpdateEntry(int id, LibraryEntry updatedEntry) { entries[FindIndexOf(id)] = updatedEntry; Bestiary.changed = true; }