public LedgerTransaction(Transaction wrappedTransaction, ChangeCoordinator<Transaction> changeCoordinator, Account ownerAccount, Workbook workbook) { _wrappedTransaction = wrappedTransaction; _ownerAccount = ownerAccount; _workbook = workbook; _changeCoordinator = changeCoordinator; _wrappedTransaction.PropertyChanged += new PropertyChangedEventHandler(WrappedTransaction_PropertyChanged); _changeCoordinator.EditableItem.PropertyChanged += new PropertyChangedEventHandler(WrappedTransaction_PropertyChanged); }
/// <summary> /// Shows this dialog for a given account. /// </summary> /// <param name="editableAccount">An <see cref="T:ChangeCoordinator[T]"/> around a given account to show.</param> private static AccountDetailsDialog Show(Workbook workbook, ChangeCoordinator<Account> editableAccount, WizardPageReturnEventHandler returnEventHandler) { AccountDetailsDialog result = null; Account account = null; if (editableAccount != null) { account = editableAccount.OriginalItem; if (account == null) { account = editableAccount.EditableItem; } } if (editableAccount != null && _openWindows.ContainsKey(account)) { result = _openWindows[account]; result.Activate(); } else { WizardPage page = null; if (editableAccount != null) { AccountDetailsPage detailsPage = new AccountDetailsPage(); detailsPage.AccountChangeCoordinator = editableAccount; page = detailsPage; } else { page = new AccountTypePage(workbook); } result = new AccountDetailsDialog(page); if (returnEventHandler != null) { result.Return += returnEventHandler; } result.Show(); if (account != null) { _openWindows[account] = result; result.Closed += new EventHandler( delegate(object sender, EventArgs e) { _openWindows.Remove(account); }); } } return result; }
/// <summary> /// Shows this dialog for a given account. /// </summary> /// <param name="editableAccount">An <see cref="T:ChangeCoordinator[T]"/> around a given account to show.</param> public static AccountDetailsDialog Show(ChangeCoordinator<Account> editableAccount, WizardPageReturnEventHandler returnEventHandler) { return Show(null, editableAccount, returnEventHandler); }
/// <summary> /// Shows this dialog for a given account. /// </summary> /// <param name="editableAccount">An <see cref="T:ChangeCoordinator[T]"/> around a given account to show.</param> public static AccountDetailsDialog Show(ChangeCoordinator<Account> editableAccount) { return Show(null, editableAccount, null); }
public void EndEdit() { if (_changeCoordinator != null) { if (_changeCoordinator.EditableItem.IsDirty) { LedgerTransactionSavingEventArgs e = new LedgerTransactionSavingEventArgs(this); e.Cancel = false; OnSaving(e); if (e.Cancel == false) { _changeCoordinator.EditableItem.PropertyChanged -= new PropertyChangedEventHandler(WrappedTransaction_PropertyChanged); _changeCoordinator.PushChanges(); _changeCoordinator = null; } else { CancelEdit(); return; } } _changeCoordinator = null; } }
public void CancelEdit() { _changeCoordinator.EditableItem.PropertyChanged -= new PropertyChangedEventHandler(WrappedTransaction_PropertyChanged); _changeCoordinator = null; this.OnPropertyChanged(new PropertyChangedEventArgs("Date")); this.OnPropertyChanged(new PropertyChangedEventArgs("Particulars")); this.OnPropertyChanged(new PropertyChangedEventArgs("OwnerAccount")); this.OnPropertyChanged(new PropertyChangedEventArgs("AffectedAccount")); this.OnPropertyChanged(new PropertyChangedEventArgs("CreditBalance")); this.OnPropertyChanged(new PropertyChangedEventArgs("DebitBalance")); }
public void BeginEdit() { if (_changeCoordinator == null) { _changeCoordinator = _workbook.AcquireChangeCoordinator(_wrappedTransaction); _changeCoordinator.EditableItem.PropertyChanged += new PropertyChangedEventHandler(WrappedTransaction_PropertyChanged); } }