Example #1
0
 public VideoSettings()
 {
     InitializeComponent();
     Video = VideoTemplate.Instance;
     if (Video.XRes == 640)
     {
         V1.Checked = true;
     }
     else if (Video.XRes == 320)
     {
         V2.Checked = true;
     }
     else if (Video.XRes == 160)
     {
         V3.Checked = true;
     }
     if (Video.LengthWise == 4)
     {
         comboBox1.SelectedIndex = 0;
     }else
     {
         comboBox1.SelectedIndex = 1;
     }
     IDT_KEYINT.Text = Video.KeyFrames.ToString();
     IDT_QUANT.Text = Video.Quant.ToString();
 }
Example #2
0
 public FeederTester()
 {
     InitializeComponent();
     MP = MPTemplate.Instance;
     Video = VideoTemplate.Instance;
     Feeder = FeederTemplate.Instance;
     p = new Pen(Color.Red, 2);
     RoomImage = new Bitmap(Path.GetDirectoryName(Application.ExecutablePath) + "\\FeederTester.png");
     g = this.CreateGraphics();
     this.MouseDown += new System.Windows.Forms.MouseEventHandler(this.MouseDownHandler);
 }
Example #3
0
 public SensorControl()
 {
     InitializeComponent();
     Video = VideoTemplate.Instance;
     g = this.CreateGraphics();
     for (int i = 0; i < 32; i++)
     {
         ChanSelect.Items.Add("Camera " + i + 1.ToString());
     }
     ChanSelect.SelectedIndex = 0;
     IDS_CONTRAST.Value = Video.Contrast[Chan];
     IDS_BRIGHTNESS.Value = Video.Brightness[Chan];
     IDS_HUE.Value = Video.Hue[Chan];
     IDS_SATURATION.Value = Video.Saturation[Chan];
     IDT_HUE.Text = IDS_HUE.Value.ToString();
     IDT_CONTRAST.Text = IDS_CONTRAST.Value.ToString();
     IDT_BRIGHTNESS.Text = IDS_BRIGHTNESS.Value.ToString();
     IDT_SATURATION.Text = IDS_SATURATION.Value.ToString();
     ThreadDisplay = new Thread(new ThreadStart(DisplayThread));
     ThreadDisplay.Start();
 }
Example #4
0
        //Form Constructior
        public MainForm()
        {
            //********** INIT VARIABLES ****************
            InitializeComponent(); //Default code
            MP = MPTemplate.Instance; //Pull Instance from MP Template - So we only have a single instance in all code
            Video = VideoTemplate.Instance; //Same for Video
            Feeder = FeederTemplate.Instance; //Same for Feeders
            BoxPen = new Pen(Brushes.Black, 4);
            BioIni = new IniFile(Directory.GetCurrentDirectory() + "\\BioPacVideo.ini"); //Standard Ini Settings

            g = this.CreateGraphics();  //Plot window

            //***************** LOAD SETTINGS *****************
            SetStyle(ControlStyles.OptimizedDoubleBuffer, true);
            ReadINI(BioIni); //Read Presets from INI file

            //Start EEG and Video functions
            MP.InitializeDisplay(this.Width, this.Height);
            for (int i = 0; i < VoltageSettings.Length; i++)
            {
                if (VoltageSettings[i] < 1000)
                    VoltScale.Items.Add(string.Format("-{0} / {0} mV", VoltageSettings[i]));
                else
                    VoltScale.Items.Add(string.Format("-{0} / {0} V", VoltageSettings[i] / 1000));
            }
            for (int i = 0; i < DisplayLengthSize.Length; i++)
            {
                TimeScale.Items.Add(string.Format("{0} seconds", DisplayLengthSize[i]));
            }

            if (!File.Exists(@".\mpdev.dll"))
            {
                MessageBox.Show("mpdev.dll not found in " + Directory.GetCurrentDirectory() + "\nBioPac will not connect without this file!", "Missing DLL File",
                MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
            else if (MP.Enabled)
            {
                MP.isconnected = MP.Connect();
                if (!MP.isconnected)
                {
                    MessageBox.Show("BioPac failed to connect.\nError was " + MPTemplate.MPRET[(int)MP.MPReturn], "BioPac Comnmunication Error",

                        MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                else
                {
                    MP.StartRecording();
                    IDT_BIOPACSTAT.Text = "BioPac Connected";
                }
                IDT_MPLASTMESSAGE.Text = MPTemplate.MPRET[(int)MP.MPReturn];
            }
            Update_FreeSpace();
            bioPacEnabledToolStripMenuItem.Checked = MP.Enabled;
            //Still = new Bitmap("NoSignal.Bmp");
            MP.FileCount = 0;
            RecordingButton.BackColor = Color.Green;
            Video.initVideo();
            Video.FileStart = 0;
            IDT_DEVICECOUNT.Text = string.Format("Device Count ({0})", Video.Device_Count);
            IDT_VIDEOSTATUS.Text = Video.GetResText();
            Console.WriteLine(Video.GetResText());
            if (Video.Enabled & (Video.Res == (AdvantechCodes.tagRes.SUCCEEDED)))
            {
                Video.CapSDKStatus = true;
            }
            else
            {
                Video.Enabled = false;
            }
            videoCaptureEnabledToolStripMenuItem.Checked = Video.Enabled;
            ThreadDisplay = new Thread(new ThreadStart(DisplayThread));
            TimerThread = new Thread(new ThreadStart(TimerCheckThread));
            Video.UpdateCameraAssoc();
            RunDisplayThread = true;
            VoltScale.SelectedIndex = Array.IndexOf(VoltageSettings, MP.Voltage);
            TimeScale.SelectedIndex = Array.IndexOf(DisplayLengthSize, MP.DisplayLength);
            ThreadDisplay.Start();
            TimerThread.Start();
        }