A user report these errors. Trace attached.
As I can see something bad happened with UI events handling inside the platform.
I use this code for attaching input events handlers to indicators
// indicator class
protected MouseEventHandler handlerOnMouseMove;
protected MouseButtonEventHandler handlerOnMouseDown;
protected MouseButtonEventHandler handlerOnMouseUp;
protected MouseButtonEventHandler handlerOnMouseDoubleClick;
protected KeyEventHandler handlerOnKeyDown;
protected KeyEventHandler handlerOnKeyUp;
public void AttachEventHandlers()
{
if (GetChartPanel() != null)
{
handlerOnMouseMove = new MouseEventHandler(IndicatorMVC.OnMouseMove);
GetChartPanel().MouseMove += handlerOnMouseMove;
handlerOnMouseDown = new MouseButtonEventHandler(IndicatorMVC.OnMouseDown);
GetChartPanel().MouseDown += handlerOnMouseDown;
handlerOnMouseUp = new MouseButtonEventHandler(IndicatorMVC.OnMouseUp);
GetChartPanel().MouseUp += handlerOnMouseUp;
handlerOnMouseDoubleClick = new MouseButtonEventHandler(IndicatorMVC.OnMouseDoubleClick);
GetChartPanel().MouseDoubleClick += handlerOnMouseDoubleClick;
handlerOnKeyDown = new KeyEventHandler(IndicatorMVC.OnKeyDown);
GetChartPanel().KeyDown += handlerOnKeyDown;
handlerOnKeyUp = new KeyEventHandler(IndicatorMVC.OnKeyUp);
GetChartPanel().KeyUp += handlerOnKeyUp;
}
}
public void DetachEventHandlers()
{
if (GetChartPanel() != null)
{
if (handlerOnMouseMove != null) { GetChartPanel().MouseMove -= handlerOnMouseMove; handlerOnMouseMove = null; }
if (handlerOnMouseDown != null) { GetChartPanel().MouseDown -= handlerOnMouseDown; handlerOnMouseDown = null; }
if (handlerOnMouseUp != null) { GetChartPanel().MouseUp -= handlerOnMouseUp; handlerOnMouseUp = null; }
if (handlerOnMouseDoubleClick != null) { GetChartPanel().MouseDoubleClick -= handlerOnMouseDoubleClick; handlerOnMouseDoubleClick = null; }
if (handlerOnKeyDown != null) { GetChartPanel().KeyDown -= handlerOnKeyDown; handlerOnKeyDown = null; }
if (handlerOnKeyUp != null) { GetChartPanel().KeyUp -= handlerOnKeyUp; handlerOnKeyUp = null; }
}
}
public ChartPanel GetChartPanel()
{
return (MasterIndicator == null) ? ChartPanel : MasterIndicator.ChartPanel;
}
protected override void OnStateChange()
{
...
else if (State == State.Historical)
{
AttachEventHandlers();
...
}
else if (State == State.Terminated)
{
DetachEventHandlers();
...
}
Comment