private void button1_Click(object sender, EventArgs e) { DSDevice leftEyeDeviceSelected = (leftEyeDevice.SelectedItem == null) ? null : ((DSDeviceWrap)leftEyeDevice.SelectedItem).dev; DSDevice rightEyeDeviceSelected = (rightEyeDevice.SelectedItem == null) ? null : ((DSDeviceWrap)rightEyeDevice.SelectedItem).dev; leftEyeDevicePath = (leftEyeDeviceSelected != null) ? leftEyeDeviceSelected.DevicePath : ""; rightEyeDevicePath = (rightEyeDeviceSelected != null) ? rightEyeDeviceSelected.DevicePath : ""; fullScreen = checkBoxFullScreen.Checked; Display display = (Display)comboBoxDisplay.SelectedItem; displayDeviceInstance = (display == null) ? "" : display.instance; displayId = (display == null) ? 1000000000 : display.id; if (displayDeviceInstance == "") { MessageBox.Show("Display device must be selected. Please make a selection in the dropdown.", "Ocucam - Error"); } else if (leftEyeDevicePath == "") { MessageBox.Show("Left eye device must be selected. Please make a selection in the dropdown.", "Ocucam - Error"); } else if (rightEyeDevicePath == "") { MessageBox.Show("Right eye device must be selected. Please make a selection in the dropdown.", "Ocucam - Error"); } else if (leftEyeDevicePath == rightEyeDevicePath) { MessageBox.Show("Left and right eyes must be set to different devices. Please change your selections.", "Ocucam - Error"); } else { RegistryKey softwareKey = Registry.CurrentUser.OpenSubKey("Software", true); RegistryKey scottCutlerKey = softwareKey.CreateSubKey("Scott Cutler"); RegistryKey ocucamKey = scottCutlerKey.CreateSubKey("Ocucam"); ocucamKey.SetValue("leftEyeDevicePath", leftEyeDevicePath); ocucamKey.SetValue("rightEyeDevicePath", rightEyeDevicePath); ocucamKey.SetValue("displayDeviceInstance", displayDeviceInstance); ocucamKey.SetValue("fullScreen", fullScreen ? "True" : "False"); ocucamKey.Close(); scottCutlerKey.Close(); softwareKey.Close(); this.Close(); } }
public DSDeviceWrap(DSDevice d, int i) { dev = d; idx = i; }