public void Unload()
 {
     updateTimer.Stop();
     updateTimer.Dispose();
     imageTexture.Dispose();
     imagePanel.Dispose();
     updateTimer      = null;
     imagePanel       = null;
     visualizerCanvas = null;
     imageTexture     = null;
     visualizerImage  = null;
 }
        public void Load(IServiceProvider provider)
        {
            visualizerCanvas = new VisualizerCanvas {
                Dock = DockStyle.Fill
            };
            visualizerCanvas.RenderFrame += (sender, e) => RenderFrame();
            visualizerCanvas.Load        += (sender, e) => imageTexture = new IplImageTexture();
            imagePanel = new Panel {
                Dock = DockStyle.Fill, Size = new Size(512, 512)
            };
            imagePanel.Controls.Add(visualizerCanvas);

            var visualizerService = (IDialogTypeVisualizerService)provider.GetService(typeof(IDialogTypeVisualizerService));

            if (visualizerService != null)
            {
                updateTimer          = new Timer();
                updateTimer.Interval = TargetInterval;
                updateTimer.Tick    += updateTimer_Tick;
                visualizerService.AddControl(imagePanel);
                updateTimer.Start();
            }
        }