示例#1
0
        public Form1(Experiments.Experiments exp)
        {
            try
            {
                InitializeComponent();
                refreshTimer.Interval = 500;

                switch (exp)
                {
                case Experiments.Experiments.Exp1:
                    control = new Experiments.Experiment1();
                    break;

                case Experiments.Experiments.Exp2:
                    control = new Experiments.Experiment2();
                    break;

                case Experiments.Experiments.Exp3:
                    control = new Experiments.Experiment3();
                    break;

                case Experiments.Experiments.Exp4:
                    control = new Experiments.Experiment4();
                    break;

                case Experiments.Experiments.Exp5:
                    control = new Experiments.Experiment5();
                    break;
                }
                refreshTimer.Start();
            }
            catch (FormatNotRespectedException)
            {
                MessageBox.Show("The setting file doesn't respect the format, modify it and retry.", "Error", MessageBoxButtons.OK);
            }
            catch (NoCameraDetectedException e)
            {
                if (e.Source.Equals("Nikon"))
                {
                    MessageBox.Show("No Nikon camera detected. Check if it is on.", "Error", MessageBoxButtons.OK);
                }
                else if (e.Source.Equals("PointGrey"))
                {
                    MessageBox.Show("No Point Grey camera detected. Try force the IP in FlyCap2.", "Error", MessageBoxButtons.OK);
                }
                else
                {
                    MessageBox.Show("No camera detected.", "Error", MessageBoxButtons.OK);
                }
            }
            this.Name = exp.ToString();
            this.Text = exp.ToString();
        }
示例#2
0
 public Form1()
 {
     try
     {
         InitializeComponent();
         refreshTimer.Interval = 1000;
         refreshTimer.Start();
         control = new Experiments.Experiment2();
     }
     catch (FormatNotRespectedException)
     {
         MessageBox.Show("The setting file doesn't respect the format, modify it and retry.", "Error", MessageBoxButtons.OK);
     }
     catch (NoCameraDetectedException)
     {
         MessageBox.Show("No camera detected. Try force the IP in FlyCap2.", "Error", MessageBoxButtons.OK);
     }
 }