Example #1
0
 private void UpdateDataSeriesList(DataTypeItem item)
 {
     this.Cursor = Cursors.WaitCursor;
     this.ltvDataSeries.BeginUpdate();
     this.ltvDataSeries.Items.Clear();
     this.ltvDataSeries.Groups.Clear();
     this.ltvDataSeries.ListViewItemSorter = (IComparer)null;
     if (item == null)
     {
         this.tabDataSeries.ResetText();
     }
     else
     {
         List <InstrumentDataSeries> list = this.seriesLists[item];
         foreach (InstrumentDataSeries series in list)
         {
             ListViewItem listViewItem = (ListViewItem) new InstrumentDataSeriesViewItem(series);
             this.ltvDataSeries.Items.Add(listViewItem);
             ListViewGroup group = this.ltvDataSeries.Groups[series.Instrument.Type.ToString()];
             if (group == null)
             {
                 group = new ListViewGroup(series.Instrument.Type.ToString(), series.Instrument.Type.ToString());
                 this.ltvDataSeries.Groups.Add(group);
             }
             listViewItem.Group = group;
         }
         this.tabDataSeries.Text = string.Format("{0} - {1:n0} instruments", (object)item, (object)list.Count);
     }
     this.ltvDataSeries.ListViewItemSorter = (IComparer)this.itemComparer;
     this.ltvDataSeries.EndUpdate();
     this.Cursor = Cursors.Default;
 }
 public InstrumentDataSeries(Instrument instrument, DataSeries dataSeries, DataTypeItem dataTypeItem)
 {
   this.Instrument = instrument;
   this.DataSeries = dataSeries;
   this.DataTypeItem = dataTypeItem;
 }
Example #3
0
 private void UpdateDataSeriesList(DataTypeItem item)
 {
   this.Cursor = Cursors.WaitCursor;
   this.ltvDataSeries.BeginUpdate();
   this.ltvDataSeries.Items.Clear();
   this.ltvDataSeries.Groups.Clear();
   this.ltvDataSeries.ListViewItemSorter = (IComparer) null;
   if (item == null)
   {
     this.tabDataSeries.ResetText();
   }
   else
   {
     List<InstrumentDataSeries> list = this.seriesLists[item];
     foreach (InstrumentDataSeries series in list)
     {
       ListViewItem listViewItem = (ListViewItem) new InstrumentDataSeriesViewItem(series);
       this.ltvDataSeries.Items.Add(listViewItem);
       ListViewGroup group = this.ltvDataSeries.Groups[series.Instrument.Type.ToString()];
       if (group == null)
       {
         group = new ListViewGroup(series.Instrument.Type.ToString(), series.Instrument.Type.ToString());
         this.ltvDataSeries.Groups.Add(group);
       }
       listViewItem.Group = group;
     }
     this.tabDataSeries.Text = string.Format("{0} - {1:n0} instruments", (object) item, (object) list.Count);
   }
   this.ltvDataSeries.ListViewItemSorter = (IComparer) this.itemComparer;
   this.ltvDataSeries.EndUpdate();
   this.Cursor = Cursors.Default;
 }
Example #4
0
 private void Init()
 {
   this.seriesLists.Clear();
   foreach (Instrument instrument in this.framework.InstrumentManager.Instruments)
   {
     foreach (DataSeries dataSeries in this.framework.DataManager.GetDataSeriesList(instrument, (string) null))
     {
       byte dataType = DataSeriesNameHelper.GetDataType(dataSeries);
       DataTypeItem dataTypeItem = (DataTypeItem) null;
       if ((int) dataType == 6)
       {
         BarType barType;
         long barSize;
         if (DataSeriesNameHelper.TryGetBarTypeSize(dataSeries, out barType, out barSize))
           dataTypeItem = new DataTypeItem(dataType, new BarType?(barType), new long?(barSize));
       }
       else
         dataTypeItem = new DataTypeItem(dataType, new BarType?(), new long?());
       if (dataTypeItem != null)
       {
         List<InstrumentDataSeries> list;
         if (!this.seriesLists.TryGetValue(dataTypeItem, out list))
         {
           list = new List<InstrumentDataSeries>();
           this.seriesLists.Add(dataTypeItem, list);
         }
         list.Add(new InstrumentDataSeries(instrument, dataSeries, dataTypeItem));
       }
     }
   }
   string str = this.trvDataTypes.SelectedNode == null ? (string) null : this.trvDataTypes.SelectedNode.Text;
   HashSet<string> hashSet = new HashSet<string>();
   foreach (ListViewItem listViewItem in this.ltvDataSeries.SelectedItems)
     hashSet.Add(listViewItem.Text);
   this.trvDataTypes.BeginUpdate();
   this.trvDataTypes.Nodes.Clear();
   foreach (DataTypeItem dataTypeItem in (IEnumerable<DataTypeItem>) this.seriesLists.Keys)
     this.trvDataTypes.Nodes.Add((TreeNode) new DataTypeNode(dataTypeItem));
   this.trvDataTypes.EndUpdate();
   this.UpdateDataSeriesList((DataTypeItem) null);
   if (str == null)
     return;
   foreach (TreeNode treeNode in this.trvDataTypes.Nodes)
   {
     if (treeNode.Text == str)
     {
       this.trvDataTypes.SelectedNode = treeNode;
       if (hashSet.Count <= 0)
         break;
       IEnumerator enumerator = this.ltvDataSeries.Items.GetEnumerator();
       try
       {
         while (enumerator.MoveNext())
         {
           ListViewItem listViewItem = (ListViewItem) enumerator.Current;
           if (hashSet.Contains(listViewItem.Text))
             listViewItem.Selected = true;
         }
         break;
       }
       finally
       {
         IDisposable disposable = enumerator as IDisposable;
         if (disposable != null)
           disposable.Dispose();
       }
     }
   }
 }
Example #5
0
 public DataTypeNode(DataTypeItem item)
     : base(item.ToString(), 0, 0)
 {
     this.Item = item;
 }
Example #6
0
 public InstrumentDataSeries(Instrument instrument, DataSeries dataSeries, DataTypeItem dataTypeItem)
 {
     this.Instrument   = instrument;
     this.DataSeries   = dataSeries;
     this.DataTypeItem = dataTypeItem;
 }
Example #7
0
        private void Init()
        {
            this.seriesLists.Clear();
            foreach (Instrument instrument in this.framework.InstrumentManager.Instruments)
            {
                foreach (DataSeries dataSeries in this.framework.DataManager.GetDataSeriesList(instrument, (string)null))
                {
                    byte         dataType     = DataSeriesNameHelper.GetDataType(dataSeries);
                    DataTypeItem dataTypeItem = (DataTypeItem)null;
                    if ((int)dataType == 6)
                    {
                        BarType barType;
                        long    barSize;
                        if (DataSeriesNameHelper.TryGetBarTypeSize(dataSeries, out barType, out barSize))
                        {
                            dataTypeItem = new DataTypeItem(dataType, new BarType?(barType), new long?(barSize));
                        }
                    }
                    else
                    {
                        dataTypeItem = new DataTypeItem(dataType, new BarType?(), new long?());
                    }
                    if (dataTypeItem != null)
                    {
                        List <InstrumentDataSeries> list;
                        if (!this.seriesLists.TryGetValue(dataTypeItem, out list))
                        {
                            list = new List <InstrumentDataSeries>();
                            this.seriesLists.Add(dataTypeItem, list);
                        }
                        list.Add(new InstrumentDataSeries(instrument, dataSeries, dataTypeItem));
                    }
                }
            }
            string           str     = this.trvDataTypes.SelectedNode == null ? (string)null : this.trvDataTypes.SelectedNode.Text;
            HashSet <string> hashSet = new HashSet <string>();

            foreach (ListViewItem listViewItem in this.ltvDataSeries.SelectedItems)
            {
                hashSet.Add(listViewItem.Text);
            }
            this.trvDataTypes.BeginUpdate();
            this.trvDataTypes.Nodes.Clear();
            foreach (DataTypeItem dataTypeItem in (IEnumerable <DataTypeItem>) this.seriesLists.Keys)
            {
                this.trvDataTypes.Nodes.Add((TreeNode) new DataTypeNode(dataTypeItem));
            }
            this.trvDataTypes.EndUpdate();
            this.UpdateDataSeriesList((DataTypeItem)null);
            if (str == null)
            {
                return;
            }
            foreach (TreeNode treeNode in this.trvDataTypes.Nodes)
            {
                if (treeNode.Text == str)
                {
                    this.trvDataTypes.SelectedNode = treeNode;
                    if (hashSet.Count <= 0)
                    {
                        break;
                    }
                    IEnumerator enumerator = this.ltvDataSeries.Items.GetEnumerator();
                    try
                    {
                        while (enumerator.MoveNext())
                        {
                            ListViewItem listViewItem = (ListViewItem)enumerator.Current;
                            if (hashSet.Contains(listViewItem.Text))
                            {
                                listViewItem.Selected = true;
                            }
                        }
                        break;
                    }
                    finally
                    {
                        IDisposable disposable = enumerator as IDisposable;
                        if (disposable != null)
                        {
                            disposable.Dispose();
                        }
                    }
                }
            }
        }
Example #8
0
 public DataTypeNode(DataTypeItem item)
   : base(item.ToString(), 0, 0)
 {
   this.Item = item;
 }