public void Draw(bool full) { Rectangle rectangle; SilverlightHelper.Debug(">>> Draw"); if (full) { this.UpdateHeight(); } if (this.m_tgd.Markers.Count > 0) { this.m_stations.Clear(); this.m_tgd.Markers.Sort(new Comparison <MarkerData>(this.MySortFunction)); this.m_stations.AddRange(this.m_tgd.Markers); } this.DrawGetRectangle(this.m_stations, out rectangle); this.DrawActualTime(rectangle); if (((this.m_tgd != null) && (this.m_tgd.Markers != null)) && (this.m_tgd.Curves != null)) { if (full) { double num; double num2; this.CanvasRoot.get_Children().Clear(); this.DrawStations(this.m_stations, rectangle, out num, out num2); this.DrawScales(rectangle, this.m_stations, num, num2); this.DrawCurves(rectangle, full); this.DrawActualTime(rectangle); } else { this.DrawCurves(rectangle, full); } if (this.m_bAllowToUpdateScroll || full) { double num3 = this.DateTime2PointY(this.m_actualTime, rectangle) - (this.scrollViewer.get_ActualHeight() / 2.0); this.scrollViewer.UpdateLayout(); this.scrollViewer.ScrollToVerticalOffset(num3); } SilverlightHelper.Debug("<<< Draw"); } }
private void DrawCurves(Rectangle rc, bool full) { SilverlightHelper.Debug("DrawCurves started"); List <TrainCurveData> list = new List <TrainCurveData>(); List <TrainCurveData> list2 = new List <TrainCurveData>(); foreach (CurveData data in this.m_tgd.Curves) { TrainCurveData item = new TrainCurveData { CaptionHasDrawn = false, Caption = data.Caption, Name = data.Name, Points = data.Points, Regular = data.Regular }; if (item.Regular) { list.Add(item); } else { list2.Add(item); } } if (full) { SilverlightHelper.Debug("Regular curves draw started"); if (list.Count > 0) { this.m_regularCurves = list; } List <Line> rectangles = new List <Line>(); foreach (TrainCurveData data2 in this.m_regularCurves) { this.DrawCurve(data2, rc, rectangles, 0); } SilverlightHelper.Debug("Regular curves draw finished"); } SilverlightHelper.Debug("Realtime curves draw started"); Dictionary <string, int> dictionary = new Dictionary <string, int>(); foreach (TrainCurveData data2 in list2) { if (!this.m_name2RealtimeCurve.ContainsKey(data2.Name)) { this.m_name2RealtimeCurve[data2.Name] = new TrainCurveData(); } this.m_name2RealtimeCurve[data2.Name].Caption = data2.Caption; this.m_name2RealtimeCurve[data2.Name].Name = data2.Name; this.m_name2RealtimeCurve[data2.Name].Regular = data2.Regular; dictionary[data2.Name] = (this.m_name2RealtimeCurve[data2.Name].Points.Count > 0) ? (this.m_name2RealtimeCurve[data2.Name].Points.Count - 1) : 0; this.m_name2RealtimeCurve[data2.Name].Points.AddRange(data2.Points); } foreach (string str in dictionary.Keys) { int startIndex = dictionary[str]; this.DrawCurve(this.m_name2RealtimeCurve[str], rc, null, startIndex); } SilverlightHelper.Debug("Realtime curves draw finished"); SilverlightHelper.Debug("DrawCurves finished"); }