Inheritance: System.Windows.Forms.UserControl
Exemple #1
0
        private void AddAccountData(SmartQuant.AccountData data)
        {
            int key = (int)data.ProviderId * 256 + (int)data.Route;
            AccountDataViewer accountDataViewer;

            if (!this.viewers.TryGetValue(key, out accountDataViewer))
            {
                accountDataViewer      = new AccountDataViewer();
                accountDataViewer.Dock = DockStyle.Fill;
                this.viewers.Add(key, accountDataViewer);
                TabPage tabPage = new TabPage();
                try
                {
                    if ((int)data.ProviderId == (int)data.Route)
                    {
                        tabPage.Text = string.Format("{0}", (object)this.framework.ProviderManager.GetProvider((int)data.ProviderId).Name);
                    }
                    else
                    {
                        tabPage.Text = string.Format("{0} ({1})", (object)this.framework.ProviderManager.GetProvider((int)data.ProviderId).Name, (object)this.framework.ProviderManager.GetProvider((int)data.Route).Name);
                    }
                }
                catch (Exception ex)
                {
                    tabPage.Text = ex.Message;
                }
                tabPage.Controls.Add((Control)accountDataViewer);
                this.tabViewers.TabPages.Add(tabPage);
            }
            accountDataViewer.OnData(data);
        }
 private void UpdateListView(string account, AccountDataViewer.ListType type)
 {
     ListView listView = (ListView)null;
     Dictionary<string, ListViewItem> dictionary = (Dictionary<string, ListViewItem>)null;
     switch (type)
     {
         case AccountDataViewer.ListType.Accounts:
             listView = this.ltvDetails;
             dictionary = this.accounts[account];
             break;
         case AccountDataViewer.ListType.Positions:
             listView = this.ltvPositions;
             dictionary = this.positions[account];
             break;
         case AccountDataViewer.ListType.Orders:
             listView = this.ltvOrders;
             dictionary = this.orders[account];
             break;
     }
     listView.BeginUpdate();
     listView.Items.Clear();
     foreach (ListViewItem listViewItem in dictionary.Values)
         listView.Items.Add(listViewItem);
     listView.EndUpdate();
 }
 private void AddAccountData(SmartQuant.AccountData data)
 {
     int key = (int)data.ProviderId * 256 + (int)data.Route;
     AccountDataViewer accountDataViewer;
     if (!this.viewers.TryGetValue(key, out accountDataViewer))
     {
         accountDataViewer = new AccountDataViewer();
         accountDataViewer.Dock = DockStyle.Fill;
         this.viewers.Add(key, accountDataViewer);
         TabPage tabPage = new TabPage();
         try
         {
             if ((int)data.ProviderId == (int)data.Route)
                 tabPage.Text = string.Format("{0}", (object)this.framework.ProviderManager.GetProvider((int)data.ProviderId).Name);
             else
                 tabPage.Text = string.Format("{0} ({1})", (object)this.framework.ProviderManager.GetProvider((int)data.ProviderId).Name, (object)this.framework.ProviderManager.GetProvider((int)data.Route).Name);
         }
         catch (Exception ex)
         {
             tabPage.Text = ex.Message;
         }
         tabPage.Controls.Add((Control)accountDataViewer);
         this.tabViewers.TabPages.Add(tabPage);
     }
     accountDataViewer.OnData(data);
 }