예제 #1
0
 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);
 }
예제 #2
0
        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();
        }