Ejemplo n.º 1
0
        private void listView_FormatRow(object sender, FormatRowEventArgs e)
        {
            ExchangeBalance balance = (ExchangeBalance)e.Model;

            if (balance.IsFork)
            {
                e.Item.BackColor = PreferenceManager.preferences.Theme.Yellow;
            }
        }
Ejemplo n.º 2
0
        public object aspect_exchangeIcon(object rowObject)
        {
            try
            {
                ExchangeBalance balance = (ExchangeBalance)rowObject;

                if (balance != null)
                {
                    return(ContentManager.ResizeImage(ContentManager.GetExchangeIcon(balance.Exchange), listView.RowHeightEffective, listView.RowHeightEffective));
                }
                else
                {
                    return(ContentManager.ResizeImage(Properties.Resources.ConnectionStatus_DISABLED, listView.RowHeightEffective / 2, listView.RowHeightEffective / 2));
                }
            }
            catch (Exception ex)
            {
                LogManager.AddLogMessage(Name, "aspect_exchangeIcon", ex.Message, LogManager.LogMessageType.EXCEPTION);
                return(ContentManager.ResizeImage(Properties.Resources.ConnectionStatus_DISABLED, listView.RowHeightEffective / 2, listView.RowHeightEffective / 2));
            }
        }
Ejemplo n.º 3
0
        public void UpdateUI(bool resize = false)
        {
            if (InvokeRequired)
            {
                UpdateUICallback d = new UpdateUICallback(UpdateUI);
                Invoke(d, new object[] { resize });
            }
            else
            {
                try
                {
                    List <ExchangeBalance> list    = Balances.Where(item => item.Balance > 0).ToList();
                    List <ExchangeBalance> wallets = WalletManager.GetWalletBalances();
                    list.AddRange(wallets);

                    //var roots = list.Select(b => b.Symbol).Distinct();

                    foreach (ExchangeBalance balance in list)
                    {
                        ExchangeBalance listItem = BalanceList.FirstOrDefault(item => item.Exchange == balance.Exchange && item.Symbol == balance.Symbol);

                        if (listItem != null)
                        {
                            // update
                            listItem.Balance          = balance.Balance;
                            listItem.OnOrders         = balance.OnOrders;
                            listItem.TotalInBTC       = balance.TotalInBTC;
                            listItem.TotalInBTCOrders = balance.TotalInBTCOrders;
                            listItem.TotalInUSD       = balance.TotalInUSD;
                        }
                        else
                        {
                            BalanceList.Add(balance);
                        }
                    }
                    //listView.setO
                    //listView.DataSource = list;
                    listView.DataSource = BalanceList;
                    //toolStripLabel_totals.Text = roots.Count() + " Coins | " + list.Sum(b => b.TotalInBTC).ToString("N8") + " | " + list.Sum(b => b.TotalInUSD).ToString("C");
                    //toolStripLabel_CoinCount.Text = roots.Count() + " Coins | " + list.Sum(b => b.TotalInBTC).ToString("N8") + " | " + list.Sum(b => b.TotalInUSD).ToString("C");
                    //LogManager.AddLogMessage(Name, "UpdateUI", "LISTVIEW COUNT=" + listView.Items.Count, LogManager.LogMessageType.DEBUG);

                    /*
                     * if (listView.Items.Count > 0)
                     * {
                     *  listView.RefreshObjects(list);
                     *  //listView.Refresh();
                     *  //listView.Refresh();
                     *  //listView.RedrawItems(0, listView.Items.Count, true);
                     *  if (!initialized)
                     *  {
                     *      switch (view)
                     *      {
                     *          case BalanceViewType.symbol:
                     *              listView.Sort(column_Symbol, SortOrder.Ascending);
                     *              toolStripLabel_totals.Text = "";
                     *              break;
                     *
                     *          case BalanceViewType.exchange:
                     *              listView.Sort(column_Exchange, SortOrder.Ascending);
                     *              toolStripLabel_totals.Text = Exchanges.Count + " Exchanges";
                     *              break;
                     *
                     *          case BalanceViewType.balance:
                     *              listView.Sort(column_TotalInBTC, SortOrder.Descending);
                     *              toolStripLabel_totals.Text = "";
                     *              break;
                     *
                     *          default:
                     *
                     *              break;
                     *
                     *      }
                     *      listView.BuildList();
                     *      initialized = true;
                     *  }
                     *
                     *  UpdateGroups();
                     *  //LogManager.AddLogMessage(Name, "UpdateUI", "REFRESHED=" + listView.Items.Count, LogManager.LogMessageType.DEBUG);
                     * }
                     * else
                     * {
                     *  listView.SetObjects(list);
                     *  switch (view)
                     *  {
                     *      case BalanceViewType.symbol:
                     *          listView.Sort(column_Symbol, SortOrder.Ascending);
                     *          toolStripLabel_totals.Text = "";
                     *          break;
                     *
                     *      case BalanceViewType.exchange:
                     *          listView.Sort(column_Exchange, SortOrder.Ascending);
                     *          toolStripLabel_totals.Text = Exchanges.Count + " Exchanges";
                     *          break;
                     *
                     *      case BalanceViewType.balance:
                     *          listView.Sort(column_TotalInBTC, SortOrder.Descending);
                     *          toolStripLabel_totals.Text = "";
                     *          break;
                     *
                     *      default:
                     *
                     *          break;
                     *
                     *  }
                     *  //ResizeUI();
                     * }
                     */



                    if (resize)
                    {
                        ResizeUI();
                    }
                }
                catch (Exception ex)
                {
                    LogManager.AddLogMessage(Name, "UpdateUI", ex.Message, LogManager.LogMessageType.EXCEPTION);
                }
            }
        }