private void btnShowImageStats_Click(object sender, EventArgs e)
 {
     if (imageStatsForm == null || imageStatsForm.IsDisposed)
     {
         imageStatsForm = new ImageStatsForm();
         imageStatsForm.Show();
     }
     else
     {
         imageStatsForm.Focus();
     }
 }
        private void Form1_FormClosing(object sender, FormClosingEventArgs e)
        {
            lock (objSync)
            {
                if (imageStatsForm != null)
                {
                    imageStatsForm.Close();
                    imageStatsForm.Dispose();
                    imageStatsForm = null;
                }
            }

            avermediaTools.Close();
            KeyHookTool.UnHook();
        }
        private void btnStartStop_Click(object sender, EventArgs e)
        {
            if (avermediaTools.IsStartStreaming)
            {
                this.btnStartStop.BackgroundImage = AverMediaTestApp.Properties.Resources.start_video;
                lock (objSync)
                {
                    if (imageStatsForm != null)
                    {
                        imageStatsForm.Close();
                        imageStatsForm.Dispose();
                        imageStatsForm = null;
                    }
                }

                stopStreaming();
                SetDefaultColorAdjustments();
                this.btnCapture.Enabled        = false;
                this.btnShowImageStats.Enabled = false;
                this.tabControlFilter.Enabled  = false;


                //avermediaTools.UpdateDemoState(DEMOSTATE.DEMO_STATE_STOP, true);
            }
            else
            {
                this.btnStartStop.BackgroundImage = AverMediaTestApp.Properties.Resources.stop_video;
                startStreaming();
                InitColorAdjustments();
                if (avermediaTools.HasCaptureSupported())
                {
                    this.btnCapture.Enabled        = true;
                    this.btnShowImageStats.Enabled = true;
                }
                this.tabControlFilter.Enabled = true;
                //avermediaTools.UpdateDemoState(DEMOSTATE.DEMO_STATE_PREVIEW, true);
            }
        }
 private void Form1_Load(object sender, EventArgs e)
 {
     imageStatsForm = null;
     InitMainWindow();
 }