void SelectTransaction() { if (this.transactions == null || !this.transactions.HasTransactions) { throw new Exception("Cannot select a transaction right now"); } selectedTransaction = this.transactions.Select(random.Next(0, this.transactions.Count)); this.editedValues = new TransactionDetails(); }
void AddNewTransaction() { if (this.transactions == null) { throw new Exception("Cannot edit a transaction right now"); } selectedTransaction = this.transactions.AddNew(); this.editedValues = new TransactionDetails(); selectedTransaction.Select(); }
void DeleteSelectedTransaction() { if (this.transactions == null || !this.transactions.HasTransactions) { throw new Exception("Cannot delete a transaction right now"); } this.transactions.Delete(random.Next(0, this.transactions.Count)); selectedTransaction = null; this.editedValues = null; }
private void AssertSelectedTransaction() { if (transactions == null) { FocusTransactionView(); } // caller is about to operate on this selection, so make sure it's up to date! if (this.selectedTransaction == null) { this.selectedTransaction = transactions.Selection; if (this.selectedTransaction == null) { throw new Exception("No selected transaction"); } if (this.editedValues == null) { this.editedValues = new TransactionDetails(); } } }
void FocusTransactionView() { window.CloseReport(); this.transactions = window.FindTransactionGrid(); window.WaitForInputIdle(200); var selection = this.transactions.Selection; if (selection == null && this.transactions.Count > 0) { this.transactions.Select(this.transactions.Count - 1); this.transactions.ScrollToEnd(); selection = this.transactions.Selection; } if (selection != null) { selection.Focus(); } this.selectedTransaction = selection; this.editedValues = new TransactionDetails(); }
void ClearTransactionViewState() { selectedTransaction = null; transactions = null; }
void NavigateTransfer() { AssertSelectedTransaction(); transactions.NavigateTransfer(); this.selectedTransaction = transactions.Selection; }