示例#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();
         }
     }
 }
示例#2
0
        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;
                }
            }
        }
示例#3
0
 public void Dispose()
 {
     Direct2DResourceManager.OnResourceDestroy(this);
     if (Texture2D != null)
     {
         Texture2D.Dispose();
         Texture2D = null;
     }
     if (fConverter != null)
     {
         fConverter.Dispose();
         fConverter = null;
     }
     if (BFDecorde != null)
     {
         BFDecorde.Dispose();
         BFDecorde = null;
     }
     if (BitDecorder != null)
     {
         BitDecorder.Dispose();
         BitDecorder = null;
     }
     if (MemStream != null)
     {
         MemStream.Dispose();
         MemStream = null;
     }
 }