private void PopulateTrigger(Trigger triggerToSet) { if (triggerToSet != null) { cbbTriggerDevice.SelectedItem = triggerToSet.OutputDevice.ToString(); nudTriggerValue.Value = triggerToSet.Value; nudTriggerSignalTime.Value = triggerToSet.SignalingTime; switch (triggerToSet.Signaling) { case TriggerSignaling.None: chbSendTrigger.Checked = false; break; case TriggerSignaling.Enabled: case TriggerSignaling.Override: chbSendTrigger.Checked = true; break; } txbPortAddress.Text = triggerToSet.PortAddress.ToString("X"); } }
private Trigger GetTrigger() { Trigger returnTrigger = new Trigger(); if (cbbTriggerDevice.SelectedItem != null) { returnTrigger.OutputDevice = (TriggerOutputDevices)Enum.Parse(typeof(TriggerOutputDevices), cbbTriggerDevice.SelectedItem.ToString()); } else { returnTrigger.OutputDevice = TriggerOutputDevices.LPT; } TriggerSignaling signaling = TriggerSignaling.None; if (chbSendTrigger.Checked) { signaling = TriggerSignaling.Enabled; } returnTrigger.Signaling = signaling; returnTrigger.SignalingTime = (int)nudTriggerSignalTime.Value; returnTrigger.Value = (int)nudTriggerValue.Value; returnTrigger.PortAddress = Convert.ToInt32(txbPortAddress.Text,16); return returnTrigger; }
/// <summary> /// This methods is used to initialize elements that are not /// initialized in the designer. /// </summary> protected override sealed void InitializeCustomElements() { base.InitializeCustomElements(); this.btnHelp.Click += this.btnHelp_Click; this.pnlCanvas.Resize += this.pnlCanvas_Resize; // Sets the counter value for updating mouse and gaze cursor. // Should give a frame rate of about 20 Hz // So if GazeSamping rate is 60 Hz to get 20 Hz it should be set to 3. this.xResolution = Document.ActiveDocument.ExperimentSettings.WidthStimulusScreen; this.yResolution = Document.ActiveDocument.ExperimentSettings.HeightStimulusScreen; this.xPosition = PresentationScreen.GetPresentationBounds().X; this.yPosition = PresentationScreen.GetPresentationBounds().Y; this.systemHasSecondaryScreen = SecondaryScreen.SystemHasSecondaryScreen(); this.delegateNewSlideAvailable = this.NewSlideAvailable; this.trialDataList = new List<TrialsData>(); this.trialEventList = new List<TrialEvent>(); this.slideCounter = 0; this.trialSequenceCounter = -1; this.recordingStarttime = -5; this.timeLock = new object(); this.lastTimeStamp = -1; this.recordTimerWatch = new Stopwatch(); ////this.watch.Start(); this.generalTrigger = new Trigger { OutputDevice = TriggerOutputDevices.LPT, Signaling = TriggerSignaling.None, SignalingTime = 10, Value = 255, PortAddress = 0x0378 }; // Take primary monitor int monitorIndex = 0; if (PresentationScreen.GetPresentationScreen() != Screen.PrimaryScreen) { // otherwise take the secondary sceen. monitorIndex = 1; } this.screenCaptureProperties = new ScreenCaptureProperties( "OgamaCapture", string.Empty, "Microsoft Video 1", string.Empty, 10, Document.ActiveDocument.PresentationSize, string.Empty, CaptureMode.Video, monitorIndex, this.recordPicture); this.rawDataLists = new List<RawData>[NUMWRITINGTHREADS]; for (int i = 0; i < NUMWRITINGTHREADS; i++) { this.rawDataLists[i] = new List<RawData>(); } if (SecondaryScreen.SystemHasSecondaryScreen()) { if (Settings.Default.PresentationScreenMonitor == "Primary") { this.btnPrimary.Checked = true; this.btnSecondary.Checked = false; } else { this.btnPrimary.Checked = false; this.btnSecondary.Checked = true; } } else { this.btnPrimary.Visible = false; this.btnSecondary.Visible = false; } this.trackerInterfaces = new Dictionary<HardwareTracker, Tracker>(); }
/// <summary> /// The <see cref="Control.Click"/> event handler for the /// <see cref="Button"/> <see cref="btnTriggerSettings"/>. /// Shows a <see cref="TriggerDialog"/> to specify a general trigger. /// </summary> /// <param name="sender"> /// Source of the event. /// </param> /// <param name="e"> /// An empty <see cref="EventArgs"/>. /// </param> private void BtnTriggerSettingsClick(object sender, EventArgs e) { using (var dlg = new TriggerDialog()) { dlg.TriggerSignal = this.generalTrigger; if (dlg.ShowDialog() == DialogResult.OK) { this.generalTrigger = dlg.TriggerSignal; } } }