public RecordSettings()
 {
     InitializeComponent();
     MP = MPTemplate.Instance; //Pull Instance from MP Template - So we only have a single instance in all code
     for (int i=0; i < SampleRateList.Length;i++)
     {
         ID_SRATE.Items.Add(string.Format("{0} Hz",SampleRateList[i]));
     }
     ID_SRATE.SelectedIndex = Array.IndexOf(SampleRateList, MP.SampleRate);
     for (int i = 0; i < GainSettings.Length; i++)
     {
         ID_GAIN.Items.Add(string.Format("{0}", GainSettings[i]));
     }
     ID_GAIN.SelectedIndex = Array.IndexOf(GainSettings, MP.Gain);
     for (int i = 0; i < DisplayLengthSize.Length; i++)
     {
         ID_DWS.Items.Add(string.Format("{0} seconds",DisplayLengthSize[i]));
     }
     ID_DWS.SelectedIndex = Array.IndexOf(DisplayLengthSize, MP.DisplayLength);
     for (int i = 0; i < VoltageSettings.Length; i++)
     {
         if (VoltageSettings[i] < 1000)
             IDC_MINMAXV.Items.Add(string.Format("-{0} / {0} mV", VoltageSettings[i]));
         else
             IDC_MINMAXV.Items.Add(string.Format("-{0} / {0} V",VoltageSettings[i]/1000));
     }
     IDC_MINMAXV.SelectedIndex = Array.IndexOf(VoltageSettings, MP.Voltage);
 }
 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);
 }
 public VideoTemplate()
 {
     Contrast = new int[32];
     Brightness = new int[32];
     Hue = new int[32];
     Saturation = new int[32];
     CameraAssociation = new int[16];
     CapSDKStatus = false;
     EncSDKStatus = false;
     pDF = new IntPtr();
     MP = MPTemplate.Instance;
 }
Exemple #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();
        }