| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394 |
- using MuchInfo.Chart.WPF.Primitives.Interfaces;
- using System.Collections.Generic;
- using System.Linq;
- namespace MuchInfo.Chart.WPF.Primitives.Drawing
- {
- public class DrawingToolContainer
- {
- #region Fields
- private List<DrawingToolSpec> _list;
- private ScaleLayer _scaleLayer;
- #endregion Fields
- #region Constructors
- public DrawingToolContainer(ScaleLayer owner)
- {
- this._list = new List<DrawingToolSpec>();
- this._scaleLayer = owner;
- }
- #endregion Constructors
- #region Delegates
- public delegate void ReloadDrawingsEventHandler();
- #endregion Delegates
-
- #region Methods
- #region Public Methods
- public DrawingToolSpec AddDrawing(string symbol, IDrawingTool aDrawing)
- {
- var drawingToolSpec = new DrawingToolSpec(symbol, aDrawing) { DrawingToolContainer = this };
- this._list.Add(drawingToolSpec);
- return drawingToolSpec;
- }
- public void AddDrawing(DrawingToolSpec aSpec)
- {
- aSpec.DrawingToolContainer = this;
- this._list.Add(aSpec);
- }
- public List<DrawingToolSpec> AllDrawings()
- {
- return this._list;
- }
- public void Clear()
- {
- this._list.Clear();
- }
- public List<IDrawingTool> DrawingForSymbol(string symbol)
- {
- var list = new List<IDrawingTool>();
- if (string.IsNullOrWhiteSpace(symbol) || this._list == null) return list;
- list.AddRange(from current in _list
- let flag = current.AppliesToSymbol(symbol)
- where flag
- select current.GetTool());
- return list;
- }
- public ScaleLayer ScaleLayer()
- {
- return this._scaleLayer;
- }
- #endregion Public Methods
- #region Internal Methods
- internal void DrawingToolContainer_3724(DrawingToolSpec aSpec)
- {
- this._list.Remove(aSpec);
- bool flag = this._scaleLayer != null;
- if (flag)
- {
- this._scaleLayer.RefreshChart(true);
- }
- }
- #endregion Internal Methods
- #endregion Methods
- }
- }
|