Example #1
0
 protected override void OnStateChange()
 {
     if (State == State.SetDefaults)
     {
         Name                     = "SampleDrawBitmap";
         Calculate                = Calculate.OnBarClose;
         IsOverlay                = true;
         ScaleJustification       = NinjaTrader.Gui.Chart.ScaleJustification.Right;
         IsSuspendedWhileInactive = true;
     }
     else if (State == State.Terminated)
     {
         if (myBitmap != null)
         {
             myBitmap.Dispose();
         }
         if (fileStream != null)
         {
             fileStream.Dispose();
         }
         if (bitmapDecoder != null)
         {
             bitmapDecoder.Dispose();
         }
         if (converter != null)
         {
             converter.Dispose();
         }
         if (frame != null)
         {
             frame.Dispose();
         }
     }
 }
        protected override void OnStateChange()
        {
            if (State == State.SetDefaults)
            {
                Name                     = "SampleDrawBitmapFun";
                Calculate                = Calculate.OnBarClose;
                IsOverlay                = true;
                ScaleJustification       = NinjaTrader.Gui.Chart.ScaleJustification.Right;
                IsSuspendedWhileInactive = true;
            }
            else if (State == State.DataLoaded)
            {
                if (ChartControl != null)
                {
                    ChartPanel.MouseMove += new System.Windows.Input.MouseEventHandler(ChartControl_MouseMove);
                }
            }
            else if (State == State.Terminated)
            {
                if (myBitmap != null)
                {
                    myBitmap.Dispose();
                }
                if (fileStream != null)
                {
                    fileStream.Dispose();
                }
                if (bitmapDecoder != null)
                {
                    bitmapDecoder.Dispose();
                }
                if (converter != null)
                {
                    converter.Dispose();
                }
                if (frame != null)
                {
                    frame.Dispose();
                }

                if (ChartControl != null)
                {
                    ChartPanel.MouseMove -= new System.Windows.Input.MouseEventHandler(ChartControl_MouseMove);
                }

                if (RenderTarget != null)
                {
                    RenderTarget.Transform = Matrix3x2.Identity;
                }
            }
        }