Example #1
0
        public void Dispose()
        {
            if (this.Book == null)
            {
                return;
            }

            this.Book.RemoveSavePoint(this);
            this.Book = null;
        }
Example #2
0
        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);
                }
            }
        }
Example #3
0
        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);
        }
Example #4
0
        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;
        }
Example #5
0
 internal SavePoint(Book book)
 {
     this.Book = book;
 }
Example #6
0
 public BookCopier(Book bookToCopy)
 {
     this.bookToCopy = bookToCopy;
 }
Example #7
0
        public Book Load()
        {
            lock (this)
            {
                try
                {
                    this.destinationBook = new Book();
                    this.bookToCopy.Replay(this, null);

                    return this.destinationBook;
                }
                finally
                {
                    this.destinationBook = null;
                }
            }
        }