public MainWindow(ref CameraController controller) { uint err = EDSDKLib.EDSDK.EDS_ERR_OK; // Get initial volume EDSDKLib.EDSDK.EdsVolumeInfo outVolumeInfo; formAs = this; InitializeComponent(); selectedDirLabel.Text = captureDirectoryPath; _controller = controller; err = EDSDKLib.EDSDK.EdsGetChildCount(_controller.GetModel().Camera, out _volume_count); if (_volume_count > 0) { err = EDSDKLib.EDSDK.EdsGetChildAtIndex(_controller.GetModel().Camera, 0, out _volumes[0]); err = EDSDKLib.EDSDK.EdsGetVolumeInfo(_volumes[0], out outVolumeInfo); if (outVolumeInfo.StorageType != (uint)EDSDKLib.EDSDK.EdsStorageType.Non) { this.button2.Enabled = true; this.button2.Text = "Memory Card 1 (" + outVolumeInfo.szVolumeLabel + ")"; this.button5.Enabled = true; this.button5.Text = "Memory Card 1 (" + outVolumeInfo.szVolumeLabel + ")"; } } _actionListenerList.Add((ActionListener)_controller); _actionListenerList.ForEach(actionListener => _actionSource.AddActionListener(ref actionListener)); }
private void RemoteCapture_FormClosing(object sender, FormClosingEventArgs e) { Application.DoEvents(); _actionSource.FireEvent(ActionEvent.Command.END_ROLLPITCH, IntPtr.Zero); _actionSource.FireEvent(ActionEvent.Command.END_EVF, IntPtr.Zero); if (!_controller.GetModel().isTypeDS) { _actionSource.FireEvent(ActionEvent.Command.REMOTESHOOTING_STOP, IntPtr.Zero); } _actionSource.FireEvent(ActionEvent.Command.PRESS_OFF, IntPtr.Zero); _actionSource.FireEvent(ActionEvent.Command.EVF_AF_OFF, IntPtr.Zero); _observerList.ForEach(observer => _controller.GetModel().Remove(ref observer)); }
private void Update(CameraEvent e) { if (this.InvokeRequired) { //The update processing can be executed from another thread. this.Invoke(new _Update(Update), new object[] { e }); return; } CameraEvent.Type eventType = e.GetEventType(); switch (eventType) { case CameraEvent.Type.SHUT_DOWN: CameraModel cameramodel = _controller.GetModel(); cameramodel._ExecuteStatus = CameraModel.Status.CANCELING; break; default: break; } }
public CameraSetting(ref CameraController controller, ref IntPtr[] volumes, ref int volume_count) { uint err = EDSDKLib.EDSDK.EDS_ERR_OK; EDSDKLib.EDSDK.EdsVolumeInfo outVolumeInfo; _controller = controller; _volumes = volumes; _volume_count = volume_count; InitializeComponent(); comboBox1.DrawMode = DrawMode.Normal; comboBox1.Items.AddRange(new object[] { "Change Owner Name", "Change Artist", "Change Copyright" }); comboBox1.SelectedIndex = 0; if (_volume_count > 0) { err = EDSDKLib.EDSDK.EdsGetChildAtIndex(_controller.GetModel().Camera, 0, out _volumes[0]); err = EDSDKLib.EDSDK.EdsGetVolumeInfo(_volumes[0], out outVolumeInfo); if (outVolumeInfo.StorageType != (uint)EDSDKLib.EDSDK.EdsStorageType.Non) { this.button1.Enabled = true; this.button1.Text = "Memory Card 1 (" + outVolumeInfo.szVolumeLabel + ")"; } if (_volume_count > 1) { err = EDSDKLib.EDSDK.EdsGetChildAtIndex(_controller.GetModel().Camera, 1, out _volumes[1]); err = EDSDKLib.EDSDK.EdsGetVolumeInfo(_volumes[1], out outVolumeInfo); if (outVolumeInfo.StorageType != (uint)EDSDKLib.EDSDK.EdsStorageType.Non) { this.button3.Enabled = true; this.button3.Text = "Memory Card 2 (" + outVolumeInfo.szVolumeLabel + ")"; } } } }
private uint UpdateItems(uint propertyID) { IntPtr camera = _controller.GetModel().Camera; uint err = EDSDKLib.EDSDK.EDS_ERR_OK; string stItem = string.Empty; switch (propertyID) { case EDSDKLib.EDSDK.PropID_OwnerName: err = EDSDKLib.EDSDK.EdsGetPropertyData(camera, EDSDKLib.EDSDK.PropID_OwnerName, 0, out stItem); if (err != EDSDKLib.EDSDK.EDS_ERR_OK) { return(err); } this.listView1.Items[3].SubItems[1].Text = stItem; break; case EDSDKLib.EDSDK.PropID_Artist: err = EDSDKLib.EDSDK.EdsGetPropertyData(camera, EDSDKLib.EDSDK.PropID_Artist, 0, out stItem); if (err != EDSDKLib.EDSDK.EDS_ERR_OK) { return(err); } this.listView1.Items[4].SubItems[1].Text = stItem; break; case EDSDKLib.EDSDK.PropID_Copyright: err = EDSDKLib.EDSDK.EdsGetPropertyData(camera, EDSDKLib.EDSDK.PropID_Copyright, 0, out stItem); if (err != EDSDKLib.EDSDK.EDS_ERR_OK) { return(err); } this.listView1.Items[5].SubItems[1].Text = stItem; break; } return(err); }
public DateTimeZoneSetting(ref CameraController controller) { map.Add(0x00000000, "None"); map.Add(0x00000001, "Chatham Islands"); map.Add(0x00000002, "Wellington"); map.Add(0x00000003, "Solomon Islands"); map.Add(0x00000004, "Sydney"); map.Add(0x00000005, "Adelaide"); map.Add(0x00000006, "Tokyo"); map.Add(0x00000007, "Hong Kong"); map.Add(0x00000008, "Bangkok"); map.Add(0x00000009, "Yangon"); map.Add(0x0000000A, "Dhaka"); map.Add(0x0000000B, "Kathmandu"); map.Add(0x0000000C, "Delhi"); map.Add(0x0000000D, "Karachi"); map.Add(0x0000000E, "Kabul"); map.Add(0x0000000F, "Dubai"); map.Add(0x00000010, "Tehran"); map.Add(0x00000011, "Moscow"); map.Add(0x00000012, "Cairo"); map.Add(0x00000013, "Paris"); map.Add(0x00000014, "London"); map.Add(0x00000015, "Azores"); map.Add(0x00000016, "Fernando"); map.Add(0x00000017, "Sao Paulo"); map.Add(0x00000018, "Newfoundland"); map.Add(0x00000019, "Santiago"); map.Add(0x0000001A, "Caracas"); map.Add(0x0000001B, "New York"); map.Add(0x0000001C, "Chicago"); map.Add(0x0000001D, "Denver"); map.Add(0x0000001E, "Los Angeles"); map.Add(0x0000001F, "Anchorage"); map.Add(0x00000020, "Honolulu"); map.Add(0x00000021, "Samoa"); map.Add(0x00000022, "Riyadh"); map.Add(0x00000023, "Manaus"); map.Add(0x00000100, "UTC"); map.Add(0xffffffff, "unknown"); _controller = controller; _camera = _controller.GetModel().Camera; InitializeComponent(); // Date / Time EDSDKLib.EDSDK.EdsTime utcTime; uint err = EDSDKLib.EDSDK.EdsGetPropertyData(_camera, EDSDKLib.EDSDK.PropID_UTCTime, 0, out utcTime); // Zone Setting err = EDSDKLib.EDSDK.EdsGetPropertyData(_camera, EDSDKLib.EDSDK.PropID_TimeZone, 0, out _timeZone); _desc = new EDSDKLib.EDSDK.EdsPropertyDesc(); err = EDSDKLib.EDSDK.EdsGetPropertyDesc(_camera, EDSDKLib.EDSDK.PropID_TimeZone, out _desc); this.comboBox1.Items.Clear(); for (int i = 0; i < _desc.NumElements; i++) { string outString; bool isGet = map.TryGetValue((uint)_desc.PropDesc[i] >> 16, out outString); if (isGet && !outString.Equals("unknown")) { // Create list of combo box comboBox1.Items.Add(outString); if (_timeZone == _desc.PropDesc[i]) { // Select item of combo box comboBox1.SelectedIndex = i; _timeZone = (uint)_desc.PropDesc[i]; _timeZonePrev = _timeZone; } } } // Daylight Saving Time uint summerTimeSetting; err = EDSDKLib.EDSDK.EdsGetPropertyData(_camera, EDSDKLib.EDSDK.PropID_SummerTimeSetting, 0, out summerTimeSetting); if (summerTimeSetting == 0x01) { this.checkBox1.Checked = true; } _summerTimeSetting = this.checkBox1.Checked; _summerTimeSettingPrev = _summerTimeSetting; // Time difference consideration DateTime dateTime = EdsTime2DateTime(utcTime); short timeDiff = (short)(_timeZone & 0x0000ffff); TimeSpan timeSpan = new TimeSpan(0, Convert.ToInt32(this.checkBox1.Checked), timeDiff, 0); dateTime = dateTime.Add(timeSpan); utcTime = DateTime2EdsTime(dateTime); _localTime = EdsTime2StrTime(utcTime); _localTimePrev = _localTime; this.textBox1.Text = _localTime; }
private void Update(CameraEvent e) { if (this.InvokeRequired) { //The update processing can be executed from another thread. this.Invoke(new _Update(Update), new object[] { e }); return; } CameraEvent.Type eventType = e.GetEventType(); switch (eventType) { case CameraEvent.Type.DOWNLOAD_START: _max = (int)e.GetArg(); _val = 0; frmProgress.progressBar1.Maximum = _max; frmProgress.progressBar1.Value = _val; frmProgress.label2.Text = "File Downloading ..."; _controller.GetModel()._ExecuteStatus = CameraModel.Status.DOWNLOADING; frmProgress.label1.Text = _val.ToString() + " / " + _max.ToString(); break; case CameraEvent.Type.DELETE_START: _max = (int)e.GetArg(); _val = 0; frmProgress.progressBar1.Maximum = _max; frmProgress.progressBar1.Value = _val; frmProgress.label2.Text = "File Deleting ..."; _controller.GetModel()._ExecuteStatus = CameraModel.Status.DELETEING; frmProgress.label1.Text = _val.ToString() + " / " + _max.ToString(); break; case CameraEvent.Type.PROGRESS_REPORT: _val++; frmProgress.progressBar1.Value = _val; frmProgress.progressBar1.Invalidate(); frmProgress.label1.Text = _val.ToString() + " / " + _max.ToString(); break; case CameraEvent.Type.DOWNLOAD_COMPLETE: case CameraEvent.Type.DELETE_COMPLETE: // Proceed the last progress. frmProgress.Refresh(); System.Threading.Thread.Sleep(500); // Close progress . frmProgress.Close(); frmProgress.Dispose(); _controller.GetModel()._ExecuteStatus = (int)CameraModel.Status.NONE; break; case CameraEvent.Type.SHUT_DOWN: CameraModel cameramodel = _controller.GetModel(); cameramodel._ExecuteStatus = CameraModel.Status.CANCELING; frmProgress.label2.Text = "Canceling ..."; frmProgress.Invalidate(); break; default: break; } }
public RemoteCapture(ref CameraController controller, ref ActionSource actionSource) { InitializeComponent(); _controller = controller; _actionSource = actionSource; CameraEvent e; _observerList.Add((IObserver)aeMode1); _observerList.Add((IObserver)av1); _observerList.Add((IObserver)evfPictureBox1); _observerList.Add((IObserver)tv1); _observerList.Add((IObserver)iso1); _observerList.Add((IObserver)meteringMode1); _observerList.Add((IObserver)exposureComp1); _observerList.Add((IObserver)imageQuality1); _observerList.Add((IObserver)evfAFMode1); _observerList.Add((IObserver)driveMode1); _observerList.Add((IObserver)whiteBalance1); _observerList.Add((IObserver)availableShotLabel1); _observerList.Add((IObserver)batteryLebelLabel1); _observerList.Add((IObserver)zoom1); _observerList.Add((IObserver)afMode1); _observerList.Add((IObserver)flashMode1); _observerList.Add((IObserver)downloadProgressBar1); _observerList.Add((IObserver)tempStatusLabel1); _observerList.Add((IObserver)movieQuality1); System.Threading.Thread.Sleep(1000); _observerList.ForEach(observer => _controller.GetModel().Add(ref observer)); aeMode1.SetActionSource(ref _actionSource); e = new CameraEvent(CameraEvent.Type.PROPERTY_DESC_CHANGED, (IntPtr)EDSDKLib.EDSDK.PropID_AEModeSelect); _controller.GetModel().NotifyObservers(e); av1.SetActionSource(ref _actionSource); e = new CameraEvent(CameraEvent.Type.PROPERTY_DESC_CHANGED, (IntPtr)EDSDKLib.EDSDK.PropID_Av); _controller.GetModel().NotifyObservers(e); evfPictureBox1.SetActionSource(ref _actionSource); tv1.SetActionSource(ref _actionSource); e = new CameraEvent(CameraEvent.Type.PROPERTY_DESC_CHANGED, (IntPtr)EDSDKLib.EDSDK.PropID_Tv); _controller.GetModel().NotifyObservers(e); iso1.SetActionSource(ref _actionSource); e = new CameraEvent(CameraEvent.Type.PROPERTY_DESC_CHANGED, (IntPtr)EDSDKLib.EDSDK.PropID_ISOSpeed); _controller.GetModel().NotifyObservers(e); meteringMode1.SetActionSource(ref _actionSource); e = new CameraEvent(CameraEvent.Type.PROPERTY_DESC_CHANGED, (IntPtr)EDSDKLib.EDSDK.PropID_MeteringMode); _controller.GetModel().NotifyObservers(e); exposureComp1.SetActionSource(ref _actionSource); e = new CameraEvent(CameraEvent.Type.PROPERTY_DESC_CHANGED, (IntPtr)EDSDKLib.EDSDK.PropID_ExposureCompensation); _controller.GetModel().NotifyObservers(e); imageQuality1.SetActionSource(ref _actionSource); e = new CameraEvent(CameraEvent.Type.PROPERTY_DESC_CHANGED, (IntPtr)EDSDKLib.EDSDK.PropID_ImageQuality); _controller.GetModel().NotifyObservers(e); evfAFMode1.SetActionSource(ref _actionSource); e = new CameraEvent(CameraEvent.Type.PROPERTY_DESC_CHANGED, (IntPtr)EDSDKLib.EDSDK.PropID_Evf_AFMode); _controller.GetModel().NotifyObservers(e); driveMode1.SetActionSource(ref _actionSource); e = new CameraEvent(CameraEvent.Type.PROPERTY_DESC_CHANGED, (IntPtr)EDSDKLib.EDSDK.PropID_DriveMode); _controller.GetModel().NotifyObservers(e); whiteBalance1.SetActionSource(ref _actionSource); e = new CameraEvent(CameraEvent.Type.PROPERTY_DESC_CHANGED, (IntPtr)EDSDKLib.EDSDK.PropID_WhiteBalance); _controller.GetModel().NotifyObservers(e); e = new CameraEvent(CameraEvent.Type.PROPERTY_CHANGED, (IntPtr)EDSDKLib.EDSDK.PropID_AFMode); _controller.GetModel().NotifyObservers(e); flashMode1.SetActionSource(ref _actionSource); e = new CameraEvent(CameraEvent.Type.PROPERTY_DESC_CHANGED, (IntPtr)EDSDKLib.EDSDK.PropID_DC_Strobe); _controller.GetModel().NotifyObservers(e); movieQuality1.SetActionSource(ref _actionSource); e = new CameraEvent(CameraEvent.Type.PROPERTY_DESC_CHANGED, (IntPtr)EDSDKLib.EDSDK.PropID_MovieParam); _controller.GetModel().NotifyObservers(e); zoom1.SetActionSource(ref _actionSource); label16.Text = zoom1.Value.ToString(); e = new CameraEvent(CameraEvent.Type.PROPERTY_DESC_CHANGED, (IntPtr)EDSDKLib.EDSDK.PropID_DC_Zoom); _controller.GetModel().NotifyObservers(e); actionButton1.SetActionSource(ref _actionSource); actionButton1.Command = ActionEvent.Command.TAKE_PICTURE; actionButton3.SetActionSource(ref _actionSource); actionButton3.Command = ActionEvent.Command.PRESS_COMPLETELY; actionButton2.SetActionSource(ref _actionSource); actionButton2.Command = ActionEvent.Command.PRESS_HALFWAY; actionButton4.SetActionSource(ref _actionSource); actionButton4.Command = ActionEvent.Command.PRESS_OFF; actionButton5.SetActionSource(ref _actionSource); actionButton5.Command = ActionEvent.Command.START_EVF; actionButton6.SetActionSource(ref _actionSource); actionButton6.Command = ActionEvent.Command.END_EVF; actionButton10.SetActionSource(ref _actionSource); actionButton10.Command = ActionEvent.Command.FOCUS_NEAR3; actionButton11.SetActionSource(ref _actionSource); actionButton11.Command = ActionEvent.Command.FOCUS_NEAR2; actionButton12.SetActionSource(ref _actionSource); actionButton12.Command = ActionEvent.Command.FOCUS_NEAR1; actionButton13.SetActionSource(ref _actionSource); actionButton13.Command = ActionEvent.Command.FOCUS_FAR1; actionButton14.SetActionSource(ref _actionSource); actionButton14.Command = ActionEvent.Command.FOCUS_FAR2; actionButton15.SetActionSource(ref _actionSource); actionButton15.Command = ActionEvent.Command.FOCUS_FAR3; actionButton7.SetActionSource(ref _actionSource); actionButton7.Command = ActionEvent.Command.EVF_AF_ON; actionButton8.SetActionSource(ref _actionSource); actionButton8.Command = ActionEvent.Command.EVF_AF_OFF; actionButton9.SetActionSource(ref _actionSource); actionButton9.Command = ActionEvent.Command.ZOOM_FIT; actionButton16.SetActionSource(ref _actionSource); actionButton16.Command = ActionEvent.Command.ZOOM_ZOOM; actionButton17.SetActionSource(ref _actionSource); actionButton17.Command = ActionEvent.Command.POSITION_UP; actionButton18.SetActionSource(ref _actionSource); actionButton18.Command = ActionEvent.Command.POSITION_LEFT; actionButton19.SetActionSource(ref _actionSource); actionButton19.Command = ActionEvent.Command.POSITION_RIGHT; actionButton20.SetActionSource(ref _actionSource); actionButton20.Command = ActionEvent.Command.POSITION_DOWN; actionButton21.SetActionSource(ref _actionSource); actionButton21.Command = ActionEvent.Command.REC_START; actionButton22.SetActionSource(ref _actionSource); actionButton22.Command = ActionEvent.Command.REC_END; actionButton23.SetActionSource(ref _actionSource); actionButton23.Command = ActionEvent.Command.ROLLPITCH; actionButton23.Text = "Roll Pitch On"; actionButton24.SetActionSource(ref _actionSource); actionButton24.Command = ActionEvent.Command.CLICK_WB; actionRadioButton1.SetActionSource(ref _actionSource); actionRadioButton1.Command = ActionEvent.Command.PRESS_STILL; actionRadioButton2.SetActionSource(ref _actionSource); actionRadioButton2.Command = ActionEvent.Command.PRESS_MOVIE; // movieMode 0 : Disable , 1 : Enable uint movieMode; // Get movie mode. uint err = EDSDKLib.EDSDK.EdsGetPropertyData(_controller.GetModel().Camera, EDSDKLib.EDSDK.PropID_FixedMovie, 0, out movieMode); updateFixedMovie(movieMode); actionRadioButton3.SetActionSource(ref _actionSource); actionRadioButton3.Command = ActionEvent.Command.MIRRORUP_ON; actionRadioButton4.SetActionSource(ref _actionSource); actionRadioButton4.Command = ActionEvent.Command.MIRRORUP_OFF; // mirrorUpStatus 0 : Disable , 1 : Enable , 2 : During shooting uint mirrorLockUpState; // Get Mirror Lockup Status. err = EDSDKLib.EDSDK.EdsGetPropertyData(_controller.GetModel().Camera, EDSDKLib.EDSDK.PropID_MirrorLockUpState, 0, out mirrorLockUpState); // Mirror Up Settings Enabled if (mirrorLockUpState == (uint)EDSDKLib.EDSDK.EdsMirrorLockupState.Enable) { actionRadioButton3.Checked = true; } else { actionRadioButton4.Checked = true; } controlFocusButton((int)EDSDKLib.EDSDK.EdsEvfAFMode.Evf_AFMode_LiveFace != _controller.GetModel().EvfAFMode); // invalidate it in the DC label26.Enabled = _controller.GetModel().isTypeDS; actionButton9.Enabled = _controller.GetModel().isTypeDS; actionButton16.Enabled = _controller.GetModel().isTypeDS; label19.Enabled = _controller.GetModel().isTypeDS; // Processing inside updateFixedMovie //actionButton10.Enabled = _controller.GetModel().isTypeDS; //actionButton11.Enabled = _controller.GetModel().isTypeDS; //actionButton12.Enabled = _controller.GetModel().isTypeDS; //actionButton13.Enabled = _controller.GetModel().isTypeDS; //actionButton14.Enabled = _controller.GetModel().isTypeDS; //actionButton15.Enabled = _controller.GetModel().isTypeDS; // invalidate it in the DS label18.Enabled = !_controller.GetModel().isTypeDS; flashMode1.Enabled = !_controller.GetModel().isTypeDS; label15.Enabled = !_controller.GetModel().isTypeDS; zoom1.Enabled = false; // At the time of start, ZoomBar is off label16.Enabled = !_controller.GetModel().isTypeDS; e = new CameraEvent(CameraEvent.Type.PROPERTY_CHANGED, (IntPtr)EDSDKLib.EDSDK.PropID_Evf_AFMode); _controller.GetModel().NotifyObservers(e); e = new CameraEvent(CameraEvent.Type.PROPERTY_CHANGED, (IntPtr)EDSDKLib.EDSDK.PropID_AvailableShots); _controller.GetModel().NotifyObservers(e); e = new CameraEvent(CameraEvent.Type.PROPERTY_CHANGED, (IntPtr)EDSDKLib.EDSDK.PropID_BatteryLevel); _controller.GetModel().NotifyObservers(e); e = new CameraEvent(CameraEvent.Type.PROPERTY_CHANGED, (IntPtr)EDSDKLib.EDSDK.PropID_TempStatus); _controller.GetModel().NotifyObservers(e); e = new CameraEvent(CameraEvent.Type.PROPERTY_CHANGED, (IntPtr)EDSDKLib.EDSDK.PropID_FixedMovie); _controller.GetModel().NotifyObservers(e); e = new CameraEvent(CameraEvent.Type.PROPERTY_CHANGED, (IntPtr)EDSDKLib.EDSDK.PropID_MirrorUpSetting); _controller.GetModel().NotifyObservers(e); if (!_controller.GetModel().isTypeDS) { _actionSource.FireEvent(ActionEvent.Command.REMOTESHOOTING_START, IntPtr.Zero); } updateAngleInfoLabel("-", "-", "-"); }
private void button2_Click(object sender, EventArgs e) { IObserver frmProgress = new Progress(ref _controller); _controller.GetModel().Add(ref frmProgress); _controller.DownloadFile(_volumes[0]); ((Progress)frmProgress).ShowDialog(); _controller.GetModel().Remove(ref frmProgress); }