public TransactionViewModel(IDialogCoordinator dialogCoordinator) { this.dialogCoordinator = dialogCoordinator; TransactionRecordRepository = new TransactionRecordRepository(); Transactions = new ObservableCollection <Transaction>(TransactionRecordRepository.Transactions); ReorderTransactionList(); AddNewCommand = new RelayCommand <object>(AddNewTx); RemoveCommand = new RelayCommand <object>(RemoveTxAsync); EditCommand = new RelayCommand <object>(EditTx); }
private void OnListChanged(object sender, NotifyCollectionChangedEventArgs e) { switch (e.Action) { case NotifyCollectionChangedAction.Add: foreach (Transaction item in e.NewItems) { TransactionRecordRepository.Add(item); } break; case NotifyCollectionChangedAction.Remove: foreach (Transaction item in e.OldItems) { TransactionRecordRepository.Remove(item); } break; case NotifyCollectionChangedAction.Replace: break; } ReorderTransactionList(); }