| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170 |
- 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<FrameworkElement> GetDrawingPlots(Chart owner, ScaleLayer aScale, Rect aRect)
- {
- List<FrameworkElement> list = new List<FrameworkElement>();
- 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"; }
- }
- }
- }
|