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[((FIXInstrument)series.Instrument).SecurityType]; if (group == null) { group = new ListViewGroup(((FIXInstrument)series.Instrument).SecurityType, (APITypeConverter.InstrumentType.Convert(((FIXInstrument)series.Instrument).SecurityType)).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 DataTypeNode(DataTypeItem item) : base(item.ToString(), 0, 0) { this.item = item; }
private void Init() { this.seriesLists.Clear(); IEnumerator enumerator1 = DataManager.Server.GetDataSeries().GetEnumerator(); try { while (enumerator1.MoveNext()) { IDataSeries dataSeries = (IDataSeries)enumerator1.Current; DataSeriesInfo dataSeriesInfo = DataSeriesHelper.GetDataSeriesInfo(dataSeries.Name); Instrument instrument = InstrumentManager.Instruments[dataSeriesInfo.Symbol]; if (instrument != null) { DataTypeItem dataTypeItem = (DataTypeItem)null; switch (dataSeriesInfo.DataType) { case DataType.Trade: case DataType.Quote: case DataType.Daily: case DataType.MarketDepth: dataTypeItem = new DataTypeItem(dataSeriesInfo.DataType); break; case DataType.Bar: dataTypeItem = (DataTypeItem) new BarDataTypeItem(dataSeriesInfo.BarType, dataSeriesInfo.BarSize); break; } 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)); } } } } finally { IDisposable disposable = enumerator1 as IDisposable; if (disposable != null) { disposable.Dispose(); } } 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 enumerator2 = this.ltvDataSeries.Items.GetEnumerator(); try { while (enumerator2.MoveNext()) { ListViewItem listViewItem = (ListViewItem)enumerator2.Current; if (hashSet.Contains(listViewItem.Text)) { listViewItem.Selected = true; } } break; } finally { IDisposable disposable = enumerator2 as IDisposable; if (disposable != null) { disposable.Dispose(); } } } } }
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[((FIXInstrument) series.Instrument).SecurityType]; if (group == null) { group = new ListViewGroup(((FIXInstrument) series.Instrument).SecurityType, (APITypeConverter.InstrumentType.Convert(((FIXInstrument) series.Instrument).SecurityType)).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; }
private void Init() { this.seriesLists.Clear(); IEnumerator enumerator1 = DataManager.Server.GetDataSeries().GetEnumerator(); try { while (enumerator1.MoveNext()) { IDataSeries dataSeries = (IDataSeries) enumerator1.Current; DataSeriesInfo dataSeriesInfo = DataSeriesHelper.GetDataSeriesInfo(dataSeries.Name); Instrument instrument = InstrumentManager.Instruments[dataSeriesInfo.Symbol]; if (instrument != null) { DataTypeItem dataTypeItem = (DataTypeItem) null; switch (dataSeriesInfo.DataType) { case DataType.Trade: case DataType.Quote: case DataType.Daily: case DataType.MarketDepth: dataTypeItem = new DataTypeItem(dataSeriesInfo.DataType); break; case DataType.Bar: dataTypeItem = (DataTypeItem) new BarDataTypeItem(dataSeriesInfo.BarType, dataSeriesInfo.BarSize); break; } 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)); } } } } finally { IDisposable disposable = enumerator1 as IDisposable; if (disposable != null) disposable.Dispose(); } 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 enumerator2 = this.ltvDataSeries.Items.GetEnumerator(); try { while (enumerator2.MoveNext()) { ListViewItem listViewItem = (ListViewItem) enumerator2.Current; if (hashSet.Contains(listViewItem.Text)) listViewItem.Selected = true; } break; } finally { IDisposable disposable = enumerator2 as IDisposable; if (disposable != null) disposable.Dispose(); } } } }
public InstrumentDataSeries(Instrument instrument, IDataSeries dataSeries, DataTypeItem dataTypeItem) { this.Instrument = instrument; this.DataSeries = dataSeries; this.DataTypeItem = dataTypeItem; }