public void Dispose() { if (this.Book == null) { return; } this.Book.RemoveSavePoint(this); this.Book = null; }
private static void AddBookAccounts(TreeNode node, Book book, Account parent) { if (node.Checked) { var account = new Account(Guid.NewGuid(), (AccountType)node.Tag, null, parent, node.Text, null); book.AddAccount(account); foreach (TreeNode child in node.Nodes) { AddBookAccounts(child, book, account); } } }
internal ReadOnlyBook(Book book) { if (book == null) { throw new ArgumentNullException("book"); } this.book = book; this.book.AccountAdded += (o, e) => this.AccountAdded.SafeInvoke(this, e); this.book.AccountRemoved += (o, e) => this.AccountRemoved.SafeInvoke(this, e); this.book.PriceQuoteAdded += (o, e) => this.PriceQuoteAdded.SafeInvoke(this, e); this.book.PriceQuoteRemoved += (o, e) => this.PriceQuoteRemoved.SafeInvoke(this, e); this.book.SecurityAdded += (o, e) => this.SecurityAdded.SafeInvoke(this, e); this.book.SecurityRemoved += (o, e) => this.SecurityRemoved.SafeInvoke(this, e); this.book.TransactionAdded += (o, e) => this.TransactionAdded.SafeInvoke(this, e); this.book.TransactionRemoved += (o, e) => this.TransactionRemoved.SafeInvoke(this, e); }
private void OkButton_Click(object sender, EventArgs e) { var book = new Book(); foreach (ListViewItem item in this.currencyList.Items) { if (item.Checked) { var security = (Security)item.Tag; book.AddSecurity(security); } } foreach (TreeNode node in this.accountsTree.Nodes) { AddBookAccounts(node, book, null); } this.newBook = book; }
internal SavePoint(Book book) { this.Book = book; }
public BookCopier(Book bookToCopy) { this.bookToCopy = bookToCopy; }
public Book Load() { lock (this) { try { this.destinationBook = new Book(); this.bookToCopy.Replay(this, null); return this.destinationBook; } finally { this.destinationBook = null; } } }