Beispiel #1
0
 private extern void CapturePhotoToDisk_Internal(IntPtr photoCaptureObj, string filename, int fileOutputFormat, PhotoCapture.OnCapturedToDiskCallback onCapturedPhotoToDiskCallback);
Beispiel #2
0
 private static void InvokeOnCapturedPhotoToDiskDelegate(PhotoCapture.OnCapturedToDiskCallback callback, long hResult)
 {
     callback(PhotoCapture.MakeCaptureResult(hResult));
 }
Beispiel #3
0
 private extern void CapturePhotoToDisk_Internal(string filename, PhotoCaptureFileOutputFormat fileOutputFormat, PhotoCapture.OnCapturedToDiskCallback onCapturedPhotoToDiskCallback);
Beispiel #4
0
        public void TakePhotoAsync(string filename, PhotoCaptureFileOutputFormat fileOutputFormat, PhotoCapture.OnCapturedToDiskCallback onCapturedPhotoToDiskCallback)
        {
            if (this.m_NativePtr == IntPtr.Zero)
            {
                throw new InvalidOperationException("You must create a Photo Capture Object before taking a photo.");
            }
            if (onCapturedPhotoToDiskCallback == null)
            {
                throw new ArgumentNullException("onCapturedPhotoToDiskCallback");
            }
            if (string.IsNullOrEmpty(filename))
            {
                throw new ArgumentNullException("filename");
            }
            filename = filename.Replace("/", "\\");
            string directoryName = Path.GetDirectoryName(filename);

            if (!string.IsNullOrEmpty(directoryName) && !Directory.Exists(directoryName))
            {
                throw new ArgumentException("The specified directory does not exist.", "filename");
            }
            this.CapturePhotoToDisk_Internal(this.m_NativePtr, filename, (int)fileOutputFormat, onCapturedPhotoToDiskCallback);
        }
Beispiel #5
0
        public void TakePhotoAsync(string filename, PhotoCaptureFileOutputFormat fileOutputFormat, PhotoCapture.OnCapturedToDiskCallback onCapturedPhotoToDiskCallback)
        {
            bool flag = onCapturedPhotoToDiskCallback == null;

            if (flag)
            {
                throw new ArgumentNullException("onCapturedPhotoToDiskCallback");
            }
            bool flag2 = string.IsNullOrEmpty(filename);

            if (flag2)
            {
                throw new ArgumentNullException("filename");
            }
            filename = filename.Replace("/", "\\");
            string directoryName = Path.GetDirectoryName(filename);
            bool   flag3         = !string.IsNullOrEmpty(directoryName) && !System.IO.Directory.Exists(directoryName);

            if (flag3)
            {
                throw new ArgumentException("The specified directory does not exist.", "filename");
            }
            FileInfo fileInfo = new FileInfo(filename);
            bool     flag4    = fileInfo.Exists && fileInfo.IsReadOnly;

            if (flag4)
            {
                throw new ArgumentException("Cannot write to the file because it is read-only.", "filename");
            }
            this.CapturePhotoToDisk_Internal(filename, fileOutputFormat, onCapturedPhotoToDiskCallback);
        }