Пример #1
0
        // ----- ustawianie listview z informacjami o rachunkach -----

        private void UpdateAccountInfo(BosAccount account)
        {
            accountsView.BeginUpdate();
            try
            {
                var group = GetAccountGroup(account);
                foreach (var paper in account.Papers)
                {
                    AddAccountPaperItem(group, paper);
                }
                foreach (var order in account.Orders)
                {
                    if (order.IsActive)
                    {
                        AddAccountOrderItem(group, order);
                    }
                }
                AddAccountFundItem(group, "Total", account.PortfolioValue, null, null);
                AddAccountFundItem(group, "Deposit", account.DepositBlocked, "deficit", account.DepositDeficit);
                AddAccountFundItem(group, "Available", account.AvailableFunds, "cash", account.AvailableCash);
            }
            finally
            {
                accountsView.EndUpdate();
            }
        }
Пример #2
0
        private ListViewGroup GetAccountGroup(BosAccount account)
        {
            var group = accountsView.Groups[account.Number];

            if (group == null)
            {
                group = new ListViewGroup(account.Number, "Account: " + account.Number);
                accountsView.Groups.Add(group);
            }
            else
            {
                var oldItems = group.Items.OfType <ListViewItem>().ToArray();
                foreach (var item in oldItems)
                {
                    accountsView.Items.Remove(item);
                }
            }
            return(group);
        }