Esempio n. 1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="MoneyTrackerViewModel"/> class.
 /// </summary>
 public MoneyTrackerViewModel(
     IAccountsViewModel accountsVM,
     ICategoriesViewModel categoriesVM,
     ITransactionsViewModel transactionsVM,
     ITransactionDetailsViewModel transactionDetailsVM,
     ITransferViewModel transferViewModel)
 {
     Accounts     = accountsVM;
     Categories   = categoriesVM;
     Transactions = transactionsVM;
     AddNew       = transactionDetailsVM;
     Transfer     = transferViewModel;
 }
Esempio n. 2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="TransactionsViewModel"/> class.
        /// </summary>
        /// <param name="validator">Validator for view model data.</param>
        /// <param name="accountsVM">Accounts view model.</param>
        public TransactionsViewModel(IValidator validator, IAccountsViewModel accountsVM, ITransactionDetailsViewModel transactionDetailsVM, ITransferViewModel transferVM)
            : base(validator)
        {
            TransactionRecords        = new BindableCollection <TransactionRecord>();
            this.accountsVM           = accountsVM;
            this.transactionDetailsVM = transactionDetailsVM;
            this.transferVM           = transferVM;

            this.accountsVM.Accounts.CurrentChanged += (o, eventArgs) =>
            {
                if (!this.accountsVM.Accounts.IsEmpty)
                {
                    CurrentAccount = this.accountsVM.Accounts.CurrentItem as AccountDTO;
                }
            };
        }