public CardAttributeViewModel(ICardGameDataStore cardGameDataStore, IDialogService dialogService, Guid cardTypeId, CardAttribute original, Action cancelEdit, Action updated) { _dialogService = dialogService ?? throw new ArgumentNullException(nameof(dialogService)); _cardGameDataStore = cardGameDataStore ?? throw new ArgumentNullException(nameof(cardGameDataStore)); _original = original ?? throw new ArgumentNullException(nameof(original)); _cardTypeId = cardTypeId; _cancelEdit = cancelEdit; _existingAttributes = _cardGameDataStore.GetCardAttributes(_cardTypeId); _isDeleted = false; Name = _original.Name ?? String.Empty; PropertyChanged += (s, e) => { if (e.PropertyName == nameof(HasChanges)) { updated?.Invoke(); } }; }
private void LoadAttributes() { _attributes = _cardGameDataStore.GetCardAttributes(_original.Id).Select(ca => new CardAttributeViewModel(_cardGameDataStore, _dialogService, _original.Id, ca, RemoveDeleted, () => RaisePropertyChanged(nameof(IsEditingAttribute)))).ToList(); }