using Microsoft.VisualBasic.CompilerServices; using MuchInfo.Chart.Data.EnumTypes; using MuchInfo.Chart.Infrastructure.Helpers; using MuchInfo.Chart.WPF.Controls.Drawing; using MuchInfo.Chart.WPF.Helpers; using MuchInfo.Chart.WPF.Primitives.Interfaces; using System; using System.Collections.Generic; using System.Windows; using System.Windows.Media; namespace MuchInfo.Chart.WPF.Primitives.Drawing { public class DrawingTironeLevels : Drawing2PointLinkedBase { private ExtendableLine _extendableLine; private float drawingTironeLevels_1096; private float drawingTironeLevels_1097; public DrawingTironeLevels() { this.drawingTironeLevels_1096 = 0f; this.drawingTironeLevels_1097 = 0f; } public override DrawingToolType ToolType() { return DrawingToolType.Tirone; } public override bool CanPlotOnAllSymbols() { return true; } public override IDrawingTool Clone() { return new DrawingTironeLevels { mColor = Colors.Orange }; } protected override List GetDrawingPlots(Chart owner, ScaleLayer aScale, Rect aRect) { List list = new List(); bool flag = this._extendableLine == null; if (flag) { this._extendableLine = new ExtendableLine(this, owner); this._extendableLine.Stroke = new SolidColorBrush(this.mColor); this._extendableLine.StrokeThickness = 1.4; DoubleCollection doubleCollection = new DoubleCollection(); doubleCollection.Add(10.0); doubleCollection.Add(10.0); this._extendableLine.SetMainStrokeDash(doubleCollection); this._extendableLine.ChannelStroke = this._extendableLine.Stroke; this._extendableLine.ExtensionStroke = this._extendableLine.Stroke; } this.MoveDrawingToNewLocations(aRect); list.Add(this._extendableLine); return list; } public override string MenuDescription() { return LanguageManager.FindResource(LanguageConst.DrawingTool_Abbreviation_TironeLevels); } public override string Abbreviation() { return "Tirone"; } public override string Description() { return this.MenuDescription(); } protected override void ColorChanged() { bool flag = this._extendableLine != null; if (flag) { this._extendableLine.Stroke = new SolidColorBrush(this.mColor); this._extendableLine.ChannelStroke = this._extendableLine.Stroke; this._extendableLine.ExtensionStroke = this._extendableLine.Stroke; } } public override void CalculateValues() { this.CalcHighLowForPoints(this.P1Date, this.P2Date, ref this.drawingTironeLevels_1096, ref this.drawingTironeLevels_1097); this.mDrawP1.Y = ((double)this.mLastScale.GetmScaler().ScaledY(this.drawingTironeLevels_1097 + (this.drawingTironeLevels_1096 - this.drawingTironeLevels_1097) / 2f, this.mLastRect)); this.mDrawP2.Y = ((double)this.mLastScale.GetmScaler().ScaledY(this.drawingTironeLevels_1097 + (this.drawingTironeLevels_1096 - this.drawingTironeLevels_1097) / 2f, this.mLastRect)); } protected override void MoveDrawingToNewLocations(Rect aRect) { bool flag = this._extendableLine != null; if (flag) { this._extendableLine.SetPosition(this.mDrawP1, this.mDrawP2, this.ExtendLeft, this.ExtendRight, aRect); Point p = default(Point); Point p2 = default(Point); Point pointA = new Point(); Point pointB = new Point(); p.X = (this.mDrawP1.X); float num = this.drawingTironeLevels_1097 + 2f * (this.drawingTironeLevels_1096 - this.drawingTironeLevels_1097) / 3f; num = this.mLastScale.GetmScaler().ScaledY(num, this.mLastRect); p.Y = ((double)num); p2.X = (this.mDrawP2.X); num = this.drawingTironeLevels_1097 + 2f * (this.drawingTironeLevels_1096 - this.drawingTironeLevels_1097) / 3f; num = this.mLastScale.GetmScaler().ScaledY(num, this.mLastRect); p2.Y = ((double)num); PointOfLineAtRectangleCalculator(ref pointA, ref pointB, p, p2, aRect); this._extendableLine.SetTopPosition(pointA, pointB, this.ExtendLeft, this.ExtendRight, aRect); p.X = (this.mDrawP1.X); num = this.drawingTironeLevels_1097 + (this.drawingTironeLevels_1096 - this.drawingTironeLevels_1097) / 3f; num = this.mLastScale.GetmScaler().ScaledY(num, this.mLastRect); p.Y = ((double)num); p2.X = (this.mDrawP2.X); num = this.drawingTironeLevels_1097 + (this.drawingTironeLevels_1096 - this.drawingTironeLevels_1097) / 3f; num = this.mLastScale.GetmScaler().ScaledY(num, this.mLastRect); p2.Y = ((double)num); PointOfLineAtRectangleCalculator(ref pointA, ref pointB, p, p2, aRect); this._extendableLine.SetBotPosition(pointA, pointB, this.ExtendLeft, this.ExtendRight, aRect); } } public override ImageSource Icon() { ImageSource result; try { result = ImageHelper.GetImage("Tirone.png"); } catch (Exception expr_3A) { ProjectData.SetProjectError(expr_3A); result = null; ProjectData.ClearProjectError(); } return result; } protected override bool CanExtendLeft() { return true; } protected override bool CanExtendRight() { return true; } protected override bool AllowExtensionColorEdit() { return false; } public override string RootName { get { return "drawTIRN"; } } } }