public void InitBarSettings(string seriesName) { if (!DataSeriesHelper.TryGetBarTypeSize(seriesName, out this.barType, out this.barSize)) { throw new Exception("Cannot edit unknown bar."); } }
private void InitDataSources() { SortedList <BarDataSource, bool> sortedList = new SortedList <BarDataSource, bool>((IComparer <BarDataSource>) new BarDataSourceComparer()); bool flag1 = false; bool flag2 = false; foreach (IDataSeries idataSeries in this.seriesList) { switch (DataSeriesHelper.GetDataSeriesInfo(idataSeries.Name).DataType) { case DataType.Trade: flag1 = true; break; case DataType.Quote: flag2 = true; break; case DataType.Bar: BarType barType; long barSize; if (DataSeriesHelper.TryGetBarTypeSize(idataSeries.Name, out barType, out barSize) && (barType != BarType.Time || barSize != 86400L)) { sortedList[new BarDataSource(barType, barSize)] = true; break; } else { break; } } } this.cbxDataSources.BeginUpdate(); this.cbxDataSources.Items.Clear(); if (flag1) { this.cbxDataSources.Items.Add((object)new DataSource(DataSourceInput.Trade)); } if (flag2) { this.cbxDataSources.Items.Add((object)new DataSource(DataSourceInput.Bid)); this.cbxDataSources.Items.Add((object)new DataSource(DataSourceInput.Ask)); this.cbxDataSources.Items.Add((object)new DataSource(DataSourceInput.BidAsk)); this.cbxDataSources.Items.Add((object)new DataSource(DataSourceInput.Middle)); this.cbxDataSources.Items.Add((object)new DataSource(DataSourceInput.Spread)); } foreach (object obj in (IEnumerable <BarDataSource>)sortedList.Keys) { this.cbxDataSources.Items.Add(obj); } if (this.cbxDataSources.Items.Count > 0) { this.cbxDataSources.SelectedIndex = 0; } this.cbxDataSources.EndUpdate(); }
private void UpdateDataSeries() { this.ltvDataSeries.BeginUpdate(); this.ltvDataSeries.Items.Clear(); if (this.cbxDataSources.SelectedItem != null) { DataSource dataSource = (DataSource)this.cbxDataSources.SelectedItem; foreach (IDataSeries dataSeries in this.seriesList) { DataType dataType = DataSeriesHelper.GetDataSeriesInfo(dataSeries.Name).DataType; bool flag = false; switch (dataSource.Input) { case DataSourceInput.Trade: flag = dataType == DataType.Trade; break; case DataSourceInput.Bid: case DataSourceInput.Ask: case DataSourceInput.BidAsk: case DataSourceInput.Middle: case DataSourceInput.Spread: flag = dataType == DataType.Quote; break; case DataSourceInput.Bar: BarType barType; long barSize; if (dataType == DataType.Bar && DataSeriesHelper.TryGetBarTypeSize(dataSeries.Name, out barType, out barSize)) { BarDataSource barDataSource = (BarDataSource)dataSource; flag = barDataSource.BarType == barType && barDataSource.BarSize == barSize; break; } else { break; } } if (flag) { this.ltvDataSeries.Items.Add((ListViewItem) new DataSeriesViewItem(dataSeries)); } } } this.ltvDataSeries.EndUpdate(); if (!this.autoCheck) { return; } this.SetAllDataSeriesChecked(true); }