private void button5_Click(object sender, EventArgs e) { if (camButtons.removeCam(camButtons.firstActiveButton())) { if (button5.Enabled) { CameraRig.cameraRemove(CameraRig.drawCam); button5.Enabled = false; button5.BackColor = System.Drawing.SystemColors.Control; camButtons.activateFirstAvailableButton(); camButtonSetColours(); int tmpInt = camButtons.firstAvailableButton(); if (tmpInt != 999) { cameraSwitch(tmpInt, true); } } } }
private void button5_Click(object sender, EventArgs e) { if (button5.Enabled && CameraButtons.Where(x => x.id == currentlySelectedButton).First().CameraButtonState != CameraButtonGroup.ButtonState.NotConnected ) { var response = MessageBox.Show("Are you sure you want to remove this camera and all the associated information?" + Environment.NewLine + Environment.NewLine + "Once the camera is removed, if you require it again you will need to add the webcam again " + "together with all the camera specific settings associated with it.", "Remove camera and associated information?", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2); if (response == DialogResult.Yes) { CameraRig.cameraRemove(CameraRig.idxFromButton(currentlySelectedButton), true); int firstAvailableButton = CameraRig.ConnectedCameras.Where(x => x.displayButton > 0).First().displayButton; cameraSwitch(firstAvailableButton, false); camButtonSetColours(); button5.Enabled = false; button5.BackColor = System.Drawing.SystemColors.Control; saveChanges(); } } }