| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146 |
- using Microsoft.VisualBasic.CompilerServices;
- using MuchInfo.Chart.Data.EnumTypes;
- using MuchInfo.Chart.Infrastructure.Helpers;
- using MuchInfo.Chart.Infrastructure.Utilities;
- using MuchInfo.Chart.WPF.Helpers;
- using MuchInfo.Chart.WPF.Primitives.Interfaces;
- using System;
- using System.Collections.Generic;
- using System.Windows;
- using System.Windows.Media;
- using System.Windows.Shapes;
- namespace MuchInfo.Chart.WPF.Primitives.Drawing
- {
- public class DrawingVerticalLine : Drawing1PointBase
- {
- #region Fields
- private Line _vLine;
- #endregion Fields
- #region Properties
- #region Public Properties
- public override string RootName
- {
- get { return "DrawVLine"; }
- }
- #endregion Public Properties
- #endregion Properties
- #region Methods
- #region Public Methods
- public override string Abbreviation()
- {
- return LanguageManager.FindResource(LanguageConst.DrawingTool_Abbreviation_VerticalLine);
- }
- public override List<ControlPair> AdditionalEditors()
- {
- return new List<ControlPair>();
- }
- public override bool CanPlotOnAllSymbols()
- {
- return true;
- }
- public override bool CanSaveByPercent()
- {
- return true;
- }
- public override IDrawingTool Clone()
- {
- return new DrawingVerticalLine
- {
- mColor = Colors.White
- };
- }
- public override string Description()
- {
- return this.MenuDescription();
- }
- public override ImageSource Icon()
- {
- ImageSource result;
- try
- {
- result = ImageHelper.GetImage("VLine.png");
- }
- catch (Exception expr_3A)
- {
- ProjectData.SetProjectError(expr_3A);
- result = null;
- ProjectData.ClearProjectError();
- }
- return result;
- }
- public override string MenuDescription()
- {
- return LanguageManager.FindResource(LanguageConst.DrawingTool_Edit_Description_VerticalLine);
- }
- public override DrawingToolType ToolType()
- {
- return DrawingToolType.VLine;
- }
- #endregion Public Methods
- #region Protected Methods
- protected override void ColorChanged()
- {
- bool flag = this._vLine != null;
- if (flag)
- {
- this._vLine.Stroke = (new SolidColorBrush(this.mColor));
- }
- }
- protected override List<FrameworkElement> GetDrawingPlots(Chart owner, ScaleLayer aScale, Rect aRect)
- {
- var list = new List<FrameworkElement>();
- this._vLine = new Line
- {
- Stroke = new SolidColorBrush(this.mColor),
- StrokeThickness = 1.4
- };
- this.MoveDrawingToNewLocations(aRect);
- list.Add(this._vLine);
- return list;
- }
- protected override void MoveDrawingToNewLocations(Rect aRect)
- {
- bool flag = this._vLine != null;
- if (flag)
- {
- this._vLine.X1 = (this.mLastX1);
- this._vLine.Y1 = (aRect.Top);
- this._vLine.X2 = (this.mLastX1);
- this._vLine.Y2 = (aRect.Bottom);
- }
- flag = (this.SelectionArea != null);
- if (flag)
- {
- this.SelectionArea.SetPosition(this.mLastX1, aRect.Top, this.mLastX1, aRect.Bottom);
- }
- }
- #endregion Protected Methods
- #endregion Methods
- }
- }
|