public void Update(A_Card card) { Rank = card.Rank; Suit = card.Suit; if (ModelUpdatedEvent != null) { ModelUpdatedEvent.Invoke(); } }
public void Update(int itemId, TModel item, bool invokeEvent = true) { if (Disposed) { throw new Exception("Collection is disposed."); } if (itemId != item.Id) { if (modelMap.ContainsKey(item.Id)) { if (modelMap[item.Id].Equals(item)) { Remove(item.Id); } } } if (modelMap.ContainsKey(itemId)) { var old = modelMap[itemId]; modelMap[itemId] = item; if (invokeEvent) { ModelUpdatedEvent?.Invoke(this, new ModelUpdatedEventArgs() { OldModel = old, UpdatedModel = item, }); } } else { Add(item, itemId); } }
public Model(ModelUpdatedEvent onModelUpdated) { OnModelUpdated += onModelUpdated; MapperSwitchOffline(); }