private void cameraSwitch(int button, bool load) { currentlySelectedButton = button; //int camId = CameraRig.idFromButton(button); int camId = CameraRig.idxFromButton(button); if (load || !load && camClick(button)) { if (load || !load && CameraRig.cameraExists(camId)) { selectedWebcam = CameraRig.ConnectedCameras[camId].cameraName; CameraRig.ConfigCam = camId; CameraRig.getCam(camId).MotionDetector.Reset(); camName.Text = (string)CameraRig.rigInfoGet(bubble.profileInUse, selectedWebcam, CameraRig.infoEnum.friendlyName); drawModeOn.Checked = false; drawModeOff.Checked = true; txtMov.Text = Convert.ToString((double)(CameraRig.rigInfoGet(bubble.profileInUse, selectedWebcam, CameraRig.infoEnum.movementVal)) * 100); radioButton4.Checked = (bool)(CameraRig.rigInfoGet(bubble.profileInUse, selectedWebcam, CameraRig.infoEnum.areaDetection)); radioButton3.Checked = !radioButton4.Checked; areaOffAtMotion.Checked = (bool)(CameraRig.rigInfoGet(bubble.profileInUse, selectedWebcam, CameraRig.infoEnum.areaOffAtMotion)); radioButton8.Checked = false; radioButton7.Checked = true; radioButton1.Checked = (bool)(CameraRig.rigInfoGet(bubble.profileInUse, selectedWebcam, CameraRig.infoEnum.areaDetectionWithin)); radioButton2.Checked = !radioButton1.Checked; trkTimeSpike.Value = (int)(CameraRig.rigInfoGet(bubble.profileInUse, selectedWebcam, CameraRig.infoEnum.timeSpike)); trkToleranceSpike.Value = (int)(CameraRig.rigInfoGet(bubble.profileInUse, selectedWebcam, CameraRig.infoEnum.toleranceSpike)); rdSpikeOn.Checked = (bool)(CameraRig.rigInfoGet(bubble.profileInUse, selectedWebcam, CameraRig.infoEnum.lightSpike)); lblTimeSpike.Text = trkTimeSpike.Value.ToString(); lblToleranceSpike.Text = trkToleranceSpike.Value.ToString() + "%"; cameraWindow.Camera = null; cameraWindow.Camera = CameraRig.getCam(camId); //CameraRig.rig[0].cam; CameraRig.getCam(camId).motionLevelEvent -= new motionLevelEventHandler(drawLevel); CameraRig.getCam(camId).motionLevelEvent += new motionLevelEventHandler(drawLevel); camButtonSetColours(); //camControl(button); } } }
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(); } } }
private void cameraSwitch(int button, bool load) { //int camId = CameraRig.idFromButton(button); int camId = CameraRig.idxFromButton(button); if (load || !load && camButtons.camClick(button)) { if (load || !load && CameraRig.cameraExists(camId)) { selectedWebcam = CameraRig.rig[camId].cameraName; CameraRig.drawCam = camId; CameraRig.getCam(camId).MotionDetector.Reset(); camName.Text = (string)CameraRig.rigInfoGet(bubble.profileInUse, selectedWebcam, "friendlyName"); drawModeOn.Checked = false; drawModeOff.Checked = true; txtMov.Text = Convert.ToString((double)(CameraRig.rigInfoGet(bubble.profileInUse, selectedWebcam, "movementVal")) * 100); radioButton4.Checked = (bool)(CameraRig.rigInfoGet(bubble.profileInUse, selectedWebcam, "areaDetection")); radioButton3.Checked = !radioButton4.Checked; areaOffAtMotion.Checked = (bool)(CameraRig.rigInfoGet(bubble.profileInUse, selectedWebcam, "areaOffAtMotion")); radioButton8.Checked = false; radioButton7.Checked = true; radioButton1.Checked = (bool)(CameraRig.rigInfoGet(bubble.profileInUse, selectedWebcam, "areaDetectionWithin")); radioButton2.Checked = !radioButton1.Checked; cameraWindow.Camera = null; cameraWindow.Camera = CameraRig.getCam(camId); //CameraRig.rig[0].cam; CameraRig.getCam(camId).motionLevelEvent -= new motionLevelEventHandler(drawLevel); CameraRig.getCam(camId).motionLevelEvent += new motionLevelEventHandler(drawLevel); camButtonSetColours(); //camControl(button); } } }