bool AutoManual(int featureId, bool auto) { bool result = false; DS_U3Wrapper.SniFeatureState state = new DS_U3Wrapper.SniFeatureState(); DS_U3Wrapper.SniCamGetState(_camera.handle, featureId, out state); if (auto) { if ((state.bits & 0x02000000U) != 0) { state.bits |= (uint)NikonFeatureState.sniAutoState; SniCamResult res = DS_U3Wrapper.SniCamSetState(_camera.handle, featureId, state); if (res != SniCamResult.SNI_OK) { MessageBox.Show("Failed to set state, Error Code: " + res, "Error"); } else { result = true; } } } else { if ((state.bits & 0x01000000U) != 0) { state.bits &= ~((uint)NikonFeatureState.sniAutoState); SniCamResult res = DS_U3Wrapper.SniCamSetState(_camera.handle, featureId, state); if (res != SniCamResult.SNI_OK) { MessageBox.Show("Failed to set state, Error Code: " + res, "Error"); } else { result = true; } } } return(result); }
bool OnePush(int featureId) { bool result = false; DS_U3Wrapper.SniFeatureState state = new DS_U3Wrapper.SniFeatureState(); DS_U3Wrapper.SniCamGetState(_camera.handle, featureId, out state); if ((state.bits & 0x10000000U) != 0) { state.bits |= (uint)NikonFeatureState.sniOnePushState; SniCamResult res = DS_U3Wrapper.SniCamSetState(_camera.handle, featureId, state); if (res != SniCamResult.SNI_OK) { MessageBox.Show("Failed to set OnePush, Error Code: " + res, "Error"); } else { result = true; } } return(result); }