Inheritance: NikonBase
Esempio n. 1
0
 void OnImageReady(NikonDevice sender, NikonImage image)
 {
     if (_imageReady != null)
     {
         _imageReady(sender, image);
     }
 }
Esempio n. 2
0
 void OnLowResolutionPreviewReady(NikonDevice sender, NikonPreview preview)
 {
     if (_lowResolutionPreviewReady != null)
     {
         _lowResolutionPreviewReady(sender, preview);
     }
 }
Esempio n. 3
0
 void OnThumbnailReady(NikonDevice sender, NikonThumbnail thumbnail)
 {
     if (_thumbnailReady != null)
     {
         _thumbnailReady(sender, thumbnail);
     }
 }
Esempio n. 4
0
 void OnCapabilityValueChanged(NikonDevice sender, eNkMAIDCapability capability)
 {
     if (_capabilityValueChanged != null)
     {
         _capabilityValueChanged(sender, capability);
     }
 }
Esempio n. 5
0
 void OnPreviewReady(NikonDevice sender, NikonPreview preview)
 {
     if (_previewReady != null)
     {
         _previewReady(sender, preview);
     }
 }
Esempio n. 6
0
 private void OnDeviceAdded(NikonManager sender, NikonDevice device)
 {
     if (_deviceAdded != null)
     {
         _deviceAdded(sender, device);
     }
 }
Esempio n. 7
0
 void OnVideoFragmentReady(NikonDevice sender, NikonVideoFragment fragment)
 {
     if (_videoFragmentReady != null)
     {
         _videoFragmentReady(sender, fragment);
     }
 }
Esempio n. 8
0
 void OnVideoRecordingInterrupted(NikonDevice sender, int error)
 {
     if (_videoRecordingInterrupted != null)
     {
         _videoRecordingInterrupted(sender, error);
     }
 }
Esempio n. 9
0
 void OnProgress(NikonDevice sender, eNkMAIDDataObjType type, int done, int total)
 {
     if (_progress != null)
     {
         _progress(sender, type, done, total);
     }
 }
Esempio n. 10
0
 void OnCaptureComplete(NikonDevice sender, int data)
 {
     if (_captureComplete != null)
     {
         _captureComplete(sender, data);
     }
 }
Esempio n. 11
0
 void OnDeviceRemoved(NikonManager sender, NikonDevice device)
 {
     if (_deviceRemoved != null)
     {
         _deviceRemoved(sender, device);
     }
 }
Esempio n. 12
0
        void manager_DeviceAdded(NikonManager sender, NikonDevice device)
        {
            if (_device == null)
            {
                // Save device
                _device = device;

                // Signal that we got a device
                _waitForDevice.Set();
            }
        }
Esempio n. 13
0
        void HandleAddChild(uint data)
        {
            NikonDevice device = new NikonDevice(Md3, Scheduler, Object, ModuleType, data);

            lock (_devices)
            {
                Debug.Assert(!_devices.ContainsKey(data));
                _devices[data] = device;
            }

            Scheduler.Callback(new DeviceAddedDelegate(OnDeviceAdded), this, device);
        }
Esempio n. 14
0
        private void HandleAddChild(IntPtr data)
        {
            uint id = (uint)data.ToInt32();

            NikonDevice device = new NikonDevice(Md3, Scheduler, Object, ModuleType, id);

            lock (_devices) {
                Debug.Assert(!_devices.ContainsKey(id));
                _devices[id] = device;
            }

            Scheduler.Callback(new DeviceAddedDelegate(OnDeviceAdded), this, device);
        }
Esempio n. 15
0
        public NikonDevice GetDeviceById(uint id)
        {
            NikonDevice device = null;

            lock (_devices) {
                if (!_devices.TryGetValue(id, out device))
                {
                    device = null;
                }
            }

            return(device);
        }
Esempio n. 16
0
        void HandleRemoveChild(uint data)
        {
            NikonDevice device = null;

            lock (_devices)
            {
                Debug.Assert(_devices.ContainsKey(data));
                device = _devices[data];
                _devices.Remove(data);
            }

            device.Object.Close();

            Scheduler.Callback(new DeviceRemovedDelegate(OnDeviceRemoved), this, device);
        }
Esempio n. 17
0
        private void HandleRemoveChild(IntPtr data)
        {
            uint id = (uint)data.ToInt32();

            NikonDevice device = null;

            lock (_devices) {
                Debug.Assert(_devices.ContainsKey(id));
                device = _devices[id];
                _devices.Remove(id);
            }

            device.Object.Close();

            Scheduler.Callback(new DeviceRemovedDelegate(OnDeviceRemoved), this, device);
        }
Esempio n. 18
0
        public NikonDevice GetDeviceByIndex(uint index)
        {
            NikonDevice device = null;

            lock (_devices) {
                int i = 0;
                foreach (NikonDevice d in _devices.Values)
                {
                    if (i == index)
                    {
                        device = d;
                        break;
                    }

                    i++;
                }
            }

            return(device);
        }
Esempio n. 19
0
        void HandleAddChild(uint data)
        {
            NikonDevice device = new NikonDevice(Md3, Scheduler, Object, ModuleType, data);

            lock (_devices)
            {
                Debug.Assert(!_devices.ContainsKey(data));
                _devices[data] = device;
            }

            Scheduler.Callback(new DeviceAddedDelegate(OnDeviceAdded), this, device);
        }
Esempio n. 20
0
 void OnDeviceRemoved(NikonManager sender, NikonDevice device)
 {
     if (_deviceRemoved != null)
     {
         _deviceRemoved(sender, device);
     }
 }
Esempio n. 21
0
 void OnVideoFragmentReady(NikonDevice sender, NikonVideoFragment fragment)
 {
     if (_videoFragmentReady != null)
     {
         _videoFragmentReady(sender, fragment);
     }
 }
Esempio n. 22
0
 void OnVideoRecordingInterrupted(NikonDevice sender, int error)
 {
     if (_videoRecordingInterrupted != null)
     {
         _videoRecordingInterrupted(sender, error);
     }
 }
Esempio n. 23
0
 void OnProgress(NikonDevice sender, eNkMAIDDataObjType type, int done, int total)
 {
     if (_progress != null)
     {
         _progress(sender, type, done, total);
     }
 }
Esempio n. 24
0
 void OnThumbnailReady(NikonDevice sender, NikonThumbnail thumbnail)
 {
     if (_thumbnailReady != null)
     {
         _thumbnailReady(sender, thumbnail);
     }
 }
Esempio n. 25
0
 void OnLowResolutionPreviewReady(NikonDevice sender, NikonPreview preview)
 {
     if (_lowResolutionPreviewReady != null)
     {
         _lowResolutionPreviewReady(sender, preview);
     }
 }
Esempio n. 26
0
 void OnPreviewReady(NikonDevice sender, NikonPreview preview)
 {
     if (_previewReady != null)
     {
         _previewReady(sender, preview);
     }
 }
Esempio n. 27
0
        void _device_VideoFragmentReady(NikonDevice sender, NikonVideoFragment fragment)
        {
            // Open the filestream when we receive the first video fragment
            if (fragment.IsFirst)
            {
                _fileStream = new FileStream(fragment.Filename, FileMode.Create, FileAccess.Write);
            }

            // Save video fragments to file
            _fileStream.Write(fragment.Buffer, 0, fragment.Buffer.Length);

            // When we recive the last fragment, close the file and signal that we're done
            if (fragment.IsLast)
            {
                _fileStream.Close();
                _waitForVideoCompleted.Set();
            }
        }
Esempio n. 28
0
        void _device_ImageReady(NikonDevice sender, NikonImage image)
        {
            // Save captured image to disk
            string filename = "image" + ((image.Type == NikonImageType.Jpeg) ? ".jpg" : ".nef");

            using (FileStream s = new FileStream(filename, FileMode.Create, FileAccess.Write))
            {
                s.Write(image.Buffer, 0, image.Buffer.Length);
            }
        }
Esempio n. 29
0
        void device_VideoFragmentReady(NikonDevice sender, NikonVideoFragment fragment)
        {
            string path = Path.Combine(System.Environment.GetFolderPath(Environment.SpecialFolder.MyVideos), fragment.Filename);

            if (fragment.IsFirst)
            {
                Debug.Assert(_videoFile == null);
                _videoFile = new FileStream(path, FileMode.Create, FileAccess.Write);
                Log.GetInstance().WriteLine("Downloading Video...");
            }

            Log.GetInstance().WriteLine(fragment.PercentComplete.ToString(".0") + "%");

            Debug.Assert(_videoFile != null);
            _videoFile.Write(fragment.Buffer, 0, fragment.Buffer.Length);

            if (fragment.IsLast)
            {
                _videoFile.Close();
                _videoFile = null;
                Log.GetInstance().WriteLine("Saved Video: " + path + " (" + fragment.VideoWidth + "x" + fragment.VideoHeight + ")");
            }
        }
Esempio n. 30
0
 void device_PreviewReady(NikonDevice sender, NikonPreview preview)
 {
     Save(preview.JpegBuffer, "preview.jpg");
 }
Esempio n. 31
0
 void device_ImageReady(NikonDevice sender, NikonImage image)
 {
     Save(image.Buffer, "image" + ((image.Type == NikonImageType.Jpeg) ? ".jpg" : ".nef"));
 }
Esempio n. 32
0
 void device_CapabilityChanged(NikonDevice sender, eNkMAIDCapability capability)
 {
     RefreshCaps();
 }
Esempio n. 33
0
 void _manager_DeviceAdded(NikonManager sender, NikonDevice device)
 {
     _objects.Add(new ObjectModel(device));
     OnPropertyChanged("NewestIndex");
 }
Esempio n. 34
0
 void _device_CaptureComplete(NikonDevice sender, int data)
 {
     // Signal the the capture completed
     _waitForCaptureComplete.Set();
 }
Esempio n. 35
0
 void OnImageReady(NikonDevice sender, NikonImage image)
 {
     if (_imageReady != null)
     {
         _imageReady(sender, image);
     }
 }
Esempio n. 36
0
        void device_CapabilityValueChanged(NikonDevice sender, eNkMAIDCapability capability)
        {
            if (_cap.ulID == capability)
            {
                OnPropertyChanged("CapValue");

                switch (_cap.ulType)
                {
                    case eNkMAIDCapType.kNkMAIDCapType_Enum:
                        OnPropertyChanged("EnumSelectedIndex");
                        break;

                    case eNkMAIDCapType.kNkMAIDCapType_Range:
                        OnPropertyChanged("RangeValue");
                        break;
                }
            }
        }
Esempio n. 37
0
 // 撮影完了時にトグルボタンをONにするイベントメソッド(コールバック)
 void device_CaptureComplete(NikonDevice sender, int data)
 {
     // Re-enable buttons when the capture completes
     ToggleButtons(true);
 }
Esempio n. 38
0
        void _manager_DeviceRemoved(NikonManager sender, NikonDevice device)
        {
            ObjectModel deviceModelToRemove = null;

            foreach (ObjectModel deviceModel in _objects)
            {
                if (deviceModel.Object == device)
                {
                    deviceModelToRemove = deviceModel;
                }
            }

            _objects.Remove(deviceModelToRemove);
            OnPropertyChanged("NewestIndex");
        }
Esempio n. 39
0
        // 撮影画像の準備完了時のイベントメソッド:撮影画像を保存し、保存完了時に【writeImgFileCallback】Hubを呼び出す。
        void device_ImageReady(NikonDevice sender, NikonImage image)
        {
            using (MemoryStream memStream = new MemoryStream(image.Buffer)) {
                // 画像データの検証オン
                _PhotImg = System.Drawing.Image.FromStream(memStream);

                //保存する写真画像のユーニークなファイル名
                //確認用に、フォームに撮った写真をフォームに表示
                picBoxPhotImage.Image = _PhotImg;

                //写真画像保存時のファイル名にユニークな名前を付ける。
                string fileUnqNm = "phot" + DateTime.Now.Month.ToString() + "_" + DateTime.Now.Day.ToString() + "_" + DateTime.Now.Hour.ToString() + "_" + DateTime.Now.Minute.ToString() + "_" + DateTime.Now.Second.ToString() + "_" + DateTime.Now.Millisecond.ToString() + ".jpg";

                #region 条件分岐:ローカルサーバへのファイル保存がONなら
                if (chkBxFileSave.Checked == true) {
                    try {//ファイル保存
                        Console.WriteLine("写真画像保存開始");

                        //flStream.BeginWriteイベントハンド呼び出し時に使用するステイタスパラメータクラスのインスタンスを作成
                        using (EvHndParamClass param = new EvHndParamClass()) {

                            // ファイル書き込み終了時のイベントハンドラで実行されるコールバックメソッド内でファイル名を利用すため
                            //そのイベントハンドラに渡すパラメータの、stプロパティにファイル名をセット
                            param.str = fileUnqNm;

                            //非同期書き込み用のファイルストリームを作成
                            using (FileStream flStream = new FileStream(@"C:\inetpub\wwwroot\images/" + fileUnqNm, FileMode.Create,
                                                                        FileAccess.Write, FileShare.ReadWrite, image.Buffer.Length, true)) {
                                //非同期書き込み、書き込み終了時に呼び出されるメソッド【writeFileCallback】
                                //flStream.BeginWrite(image.Buffer, 0, image.Buffer.Length, new AsyncCallback(writeImgFileCallback), flStream);
                                flStream.BeginWrite(image.Buffer, 0, image.Buffer.Length, new AsyncCallback(writeImgFileCallback), param);
                                //							await writer.WriteAsync(input);
                            }
                        }
                    } catch (Exception ex) {
                        Console.WriteLine("err:" + ex.Message + " 写真画像ファイル書き込み失敗!");
                    }
                }
                #endregion

                #region 条件分岐: FTPアップロードチェックボックスがONなら
                if (chkBxFtpUpLoad.Checked == true) {
                    try {//↓は、FTPにて写真アップロードの【場合】です。
                        WebClient wc = new WebClient();
                        //アップロード完了時イベントを登録
                        wc.UploadDataCompleted += (s, e) => {
                            Console.WriteLine("アップロード完了");
                            _HubProxy.Invoke("PhotChange", fileUnqNm).Wait();
                        };

                        //Uri u = new Uri("" + fileUnqNm);
                        Uri u = new Uri("ftp://waws-prod-os1-001.ftp.azurewebsites.windows.net/site/wwwroot/images/" + fileUnqNm);

                        //認証設定
            //						wc.Credentials = new NetworkCredential(@"", "");
                        wc.Credentials = new NetworkCredential(@"picUpSignalR\$picUpSignalR", FtpCredentials);

                        Console.WriteLine("写真画像FTPアップロード開始");
                        wc.UploadDataAsync(u, image.Buffer);
                    } catch (Exception ex) {
                        //MessageBox.Show(ex.ToString());
                        Console.WriteLine("err:" + ex.Message + " 写真画像FTPアップロード失敗!");
                    }
                }
                #endregion
            }
        }
Esempio n. 40
0
 void device_CaptureComplete(NikonDevice sender, int data)
 {
 }
Esempio n. 41
0
        // カメラ接続開始時のイベントメソッド(コールバック)
        void manager_DeviceAdded(NikonManager sender, NikonDevice device)
        {
            this._Device = device;

            // Set the device name
            label_name.Text = device.Name;

            // Enable buttons
            ToggleButtons(true);

            // 撮影画像のバッファへの転送完了イベント
            device.ImageReady += new ImageReadyDelegate(device_ImageReady);
            // 撮影完了時のイベント(トグルボタンOFF→ON)
            device.CaptureComplete += new CaptureCompleteDelegate(device_CaptureComplete);
        }
Esempio n. 42
0
 void device_LowResolutionPreviewReady(NikonDevice sender, NikonPreview preview)
 {
     Save(preview.JpegBuffer, "preview_lowres.jpg");
 }
Esempio n. 43
0
        // カメラ接続終了時のイベントメソッド(コールバック)
        void manager_DeviceRemoved(NikonManager sender, NikonDevice device)
        {
            this._Device = null;

            // Stop live view timer
            _LiveViewTimer.Stop();

            // Clear device name
            label_name.Text = "No Camera";

            // Disable buttons
            ToggleButtons(false);

            // Clear live view picture
            picBoxPhotImage.Image = null;
        }
Esempio n. 44
0
        void device_ThumbnailReady(NikonDevice sender, NikonThumbnail thumbnail)
        {
            // We're expecting to get RGB24 data, make sure that the format is correct
            if (thumbnail.Stride / thumbnail.Width < 3)
            {
                return;
            }

            // Note: Thumbnail pixels are uncompressed RGB24 - here's an example of how to jpeg encode it

            JpegBitmapEncoder encoder = new JpegBitmapEncoder();
            encoder.QualityLevel = 90;

            BitmapSource source = BitmapFrame.Create(
                thumbnail.Width,
                thumbnail.Height,
                96.0,
                96.0,
                System.Windows.Media.PixelFormats.Rgb24,
                null,
                thumbnail.Pixels,
                thumbnail.Stride);

            BitmapFrame frame = BitmapFrame.Create(source);
            encoder.Frames.Add(frame);

            MemoryStream stream = new MemoryStream();
            encoder.Save(stream);

            Save(stream.GetBuffer(), "thumbnail.jpg");
        }
Esempio n. 45
0
 void OnCapabilityValueChanged(NikonDevice sender, eNkMAIDCapability capability)
 {
     if (_capabilityValueChanged != null)
     {
         _capabilityValueChanged(sender, capability);
     }
 }
Esempio n. 46
0
 void device_VideoRecordingInterrupted(NikonDevice sender, int error)
 {
     Log.GetInstance().WriteLine("Video Recording Interrupted (" + error.ToString() + ")");
 }
Esempio n. 47
0
 void OnCaptureComplete(NikonDevice sender, int data)
 {
     if (_captureComplete != null)
     {
         _captureComplete(sender, data);
     }
 }