public void RemoveMapNote(String mapId, Position position) { MapNoteCollection mapNotes = GetMapNotes(mapId); MapNote mapNote; if (mapNotes.TryGetValue(position, out mapNote) && mapNotes.Remove(position) && RemovedMapNote != null) { RemovedMapNote(this, new MapNoteEventArgs(mapId, mapNote)); } }
private void RemoveAllNotes(String mapId, MapNoteCollection collection) { MapNoteEventArgs mapNoteEventArgs = new MapNoteEventArgs(null, null); while (collection.Count > 0) { Dictionary <Position, MapNote> .Enumerator enumerator = collection.GetEnumerator(); if (enumerator.MoveNext()) { KeyValuePair <Position, MapNote> keyValuePair = enumerator.Current; collection.Remove(keyValuePair.Key); if (RemovedMapNote != null) { mapNoteEventArgs.MapID = mapId; MapNoteEventArgs mapNoteEventArgs2 = mapNoteEventArgs; KeyValuePair <Position, MapNote> keyValuePair2 = enumerator.Current; mapNoteEventArgs2.MapNote = keyValuePair2.Value; RemovedMapNote(this, mapNoteEventArgs); } } } collection.Clear(); }