public void SetMainSeries(ISeries mainSeries, bool showVolumePad, Color color) { lock (this.lockObject) { ISeries temp_5 = this.mainSeries; this.series = mainSeries; if (mainSeries is BarSeries) SetBarSeriesStyle(BarSeriesStyle, true); else { this.mainSeries = this.series; this.mainSeriesView = new DSView(this.pads[0], mainSeries as TimeSeries, color, SearchOption.ExactFirst, SmoothingMode.HighSpeed); this.pads[0].AddPrimitive(this.mainSeriesView); } this.pads[0].ScaleStyle = this.scaleStyle; if (showVolumePad) this.ShowVolumePad(); this.firstIndex = this.updateStyle != ChartUpdateStyle.WholeRange ? Math.Max(0, mainSeries.Count - this.minCountOfBars) : 0; this.lastIndex = mainSeries.Count - 1; if (mainSeries.Count == 0) this.firstIndex = -1; if (this.lastIndex >= 0) SetIndexInterval(this.firstIndex, this.lastIndex); this.contentUpdated = true; Invalidate(); } }
private bool SetBarSeriesStyle(BSStyle barSeriesStyle, bool force) { bool flag = true; if (barSeriesStyle == BSStyle.Candle || barSeriesStyle == BSStyle.Bar || barSeriesStyle == BSStyle.Line) { if (!(this.mainSeriesView is SimpleBSView) || force) { this.pads[0].RemovePrimitive(this.mainSeriesView); this.mainSeriesView = new SimpleBSView(this.pads[0], this.series as BarSeries); (this.mainSeriesView as SimpleBSView).UpColor = this.candleUpColor; (this.mainSeriesView as SimpleBSView).DownColor = this.candleDownColor; this.mainSeries = this.mainSeriesView.MainSeries; this.pads[0].AddPrimitive(this.mainSeriesView); } else flag = false; if (barSeriesStyle == BSStyle.Candle) (this.mainSeriesView as SimpleBSView).Style = SimpleBSStyle.Candle; if (barSeriesStyle == BSStyle.Bar) (this.mainSeriesView as SimpleBSView).Style = SimpleBSStyle.Bar; if (barSeriesStyle == BSStyle.Line) (this.mainSeriesView as SimpleBSView).Style = SimpleBSStyle.Line; } return flag; }