private void InitializeGrid(Account account)
        {
            if (_account != null && Rows != null)
            {
                Rows.Dispose();
            }
            _account = account;
            _account.Transactions.EnsureCollectionLoaded();
            Rows = new TransformingObservableCollection <Transaction, TransactionGridRowViewModel>(
                _account.Transactions,
                (transaction) =>
            {
                var row              = new TransactionGridRowViewModel(this.Columns, this.SubTransactionColumns, transaction, _model);
                row.PropertyChanged += Row_PropertyChanged;
                return(row);
            },
                (transformed) =>
            {
                transformed.Dispose();
                transformed.PropertyChanged -= Row_PropertyChanged;
            });

            Rows.ReturnEmptyOnEmuerate = true;

            SortRows();
        }
 private void RowUnSelected(TransactionGridRowViewModel row)
 {
     if (SelectedRows.Contains(row))
     {
         SelectedRows.Remove(row);
     }
 }
        private void RowSelected(TransactionGridRowViewModel row)
        {
            var selectedRows = SelectedRows.ToList();

            foreach (var selectedRow in selectedRows)
            {
                SelectedRows.Remove(selectedRow);
            }
            SelectedRows.Add(row);
        }
 public TransactionGridCellViewModel(
     TransactionGridColumnViewModel column,
     TransactionGridRowViewModel row,
     Transaction transaction)
 {
     _column = column;
     _row    = row;
     _row.PropertyChanged += Row_PropertyChanged;
     _transaction          = transaction;
     _isEditing            = row.IsEditing;
     CellType              = ColumnType.Transaction;
     _entity = transaction;
 }
        public SubTransactionRowViewModel(ObservableCollection <TransactionGridColumnViewModel> columns,
                                          Transaction transaction,
                                          TransactionGridRowViewModel row,
                                          SubTransaction subTransaction)
        {
            _columns        = columns;
            _transaction    = transaction;
            _parentRow      = row;
            _subTransaction = subTransaction;

            InitializeCommands();
            InitializeCells();
        }
 public abstract TransactionGridCellViewModel CreateCell(
     TransactionGridRowViewModel row,
     Transaction transaction,
     SubTransactionRowViewModel subTransactionRow,
     SubTransaction subTransaction);
        private void AddTransaction()
        {
            var addTransaction = new TransactionGridRowViewModel(Columns, this.SubTransactionColumns, this.Account, _model);

            CurrentAddingTransaction = addTransaction;
        }
 private void RowMultiSelected(TransactionGridRowViewModel row)
 {
     SelectedRows.Add(row);
 }
 private void OnTransactionAddFinished(object sender, EventArgs e)
 {
     CurrentAddingTransaction = null;
 }
 private void DisconnectAddingTransaction(TransactionGridRowViewModel transaction)
 {
     transaction.TransactionAddFinished -= OnTransactionAddFinished;
     transaction.Dispose();
 }
 private void ConnectAddingTransaction(TransactionGridRowViewModel transaction)
 {
     transaction.TransactionAddFinished += OnTransactionAddFinished;
     RowSelected(transaction);
 }