private void btnStart_Sensing_Click(object sender, EventArgs e) { if (!((DMP_Main_MDIParent)this.MdiParent).GetCTMconnection || !((DMP_Main_MDIParent)this.MdiParent).GetINSconnection) { CustomMsgBox.Show("Hardware is not connected.\nStart Sensing is currently not possible.\n\nConnect to Hardware via Program Control tab.", "Error", "OK"); } else { SetbtnStart_SensingEnable(false); new Thread(() => { ((DMP_Main_MDIParent)this.MdiParent).SetStreamingMode = 1; ((DMP_Main_MDIParent)this.MdiParent).SetDoing_sensing = true; ((DMP_Main_MDIParent)this.MdiParent).StartStreaming(((DMP_Main_MDIParent)this.MdiParent).GetStimMode, ((DMP_Main_MDIParent)this.MdiParent).GetStreamingMode, ((DMP_Main_MDIParent)this.MdiParent).CurrState); ((DMP_Main_MDIParent)this.MdiParent).SetDoing_sensing = false; }).Start(); } }
private void safeMode_Click(object sender, EventArgs e) { DialogResult dialogResult; if (((DMP_Main_MDIParent)this.MdiParent).TheSummit == null || (((DMP_Main_MDIParent)this.MdiParent).TheSummit.IsDisposed)) { CustomMsgBox.Show("Hardware is not connected.\nSafe mode is currently not possible.", "Error", "OK"); } else { // safe mode if (((DMP_Main_MDIParent)this.MdiParent).GetIsStiming == 1) { if (((DMP_Main_MDIParent)this.MdiParent).GetStimMode == 1) { if (safeMode.Text.Equals("Safe Mode")) { dialogResult = CustomMsgBox.Show("Stimulation settings will be changed to default.\n\n" + "Safe Mode sets Default stimulation parameters and disables stimulation changes.Use for patient safety reasons only." , "Safe Mode", "Default settings", "Cancel"); if (dialogResult == DialogResult.Yes) { safeMode.Text = "Cancel Safe Mode"; ((DMP_Main_MDIParent)this.MdiParent).SetSafeMode = true; ((DMP_Main_MDIParent)this.MdiParent).WriteStimulationSettingsFile(); Thread t = new Thread(() => { ((DMP_Main_MDIParent)this.MdiParent).SetDoing_stim = true; ((DMP_Main_MDIParent)this.MdiParent).StartStreaming(((DMP_Main_MDIParent)this.MdiParent).GetStimMode, ((DMP_Main_MDIParent)this.MdiParent).GetStreamingMode, "Default"); ((DMP_Main_MDIParent)this.MdiParent).SetDoing_stim = false; }); t.Start(); } } else { dialogResult = CustomMsgBox.Show("Confirm canceling Safe Mode.\n", "Safe Mode", "Confirm", "Cancel"); if (dialogResult == DialogResult.Yes) { safeMode.Text = "Safe Mode"; ((DMP_Main_MDIParent)this.MdiParent).SetSafeMode = false; ((DMP_Main_MDIParent)this.MdiParent).WriteStimulationSettingsFile(); Thread t = new Thread(() => { ((DMP_Main_MDIParent)this.MdiParent).SetDoing_stim = true; ((DMP_Main_MDIParent)this.MdiParent).StartStreaming(((DMP_Main_MDIParent)this.MdiParent).GetStimMode, ((DMP_Main_MDIParent)this.MdiParent).GetStreamingMode, "Default"); ((DMP_Main_MDIParent)this.MdiParent).SetDoing_stim = false; }); t.Start(); } } } else // STIMULATION IS ON BUT WE DONT WANT TO STIM { Console.WriteLine("We don't want to stim...\nStimulation is ON but stimMode is 0!\n"); new Thread(() => ((DMP_Main_MDIParent)this.MdiParent).StopStim(null)).Start(); } } else { // stimulation is off but we want to stim if (((DMP_Main_MDIParent)this.MdiParent).GetStimMode == 1) { Console.WriteLine("Stimulation is OFF but stimMode is 1!\n"); new Thread(() => ((DMP_Main_MDIParent)this.MdiParent).StartStim(null)).Start(); } else { dialogResult = CustomMsgBox.Show("Stimulation is currently off.\n", "", "OK"); } } } }