private static void InvokeOnCapturedPhotoToDiskDelegate(OnCapturedToDiskCallback callback, long hResult)
 {
     callback(MakeCaptureResult(hResult));
 }
 public void TakePhotoAsync(string filename, PhotoCaptureFileOutputFormat fileOutputFormat, 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);
 }
 private extern void CapturePhotoToDisk_Internal(IntPtr photoCaptureObj, string filename, int fileOutputFormat, OnCapturedToDiskCallback onCapturedPhotoToDiskCallback);
 private extern void CapturePhotoToDisk_Internal(IntPtr photoCaptureObj, string filename, int fileOutputFormat, OnCapturedToDiskCallback onCapturedPhotoToDiskCallback);
 public void TakePhotoAsync(string filename, PhotoCaptureFileOutputFormat fileOutputFormat, OnCapturedToDiskCallback onCapturedPhotoToDiskCallback)
 {
     try
     {
         var capture = m_CaptureContext.GetBehaviour();
         ((NRCaptureBehaviour)capture).Do(filename, fileOutputFormat);
     }
     catch (Exception)
     {
         throw;
     }
 }
        public void TakePhotoAsync(string filename, PhotoCaptureFileOutputFormat fileOutputFormat, 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);
        }
 private static void InvokeOnCapturedPhotoToDiskDelegate(OnCapturedToDiskCallback callback, long hResult)
 {
     callback(MakeCaptureResult(hResult));
 }
Exemple #8
0
 private extern void CapturePhotoToDisk_Internal(string filename, PhotoCaptureFileOutputFormat fileOutputFormat, OnCapturedToDiskCallback onCapturedPhotoToDiskCallback);
Exemple #9
0
        //-----------------------------------------------------------------
        public void TakePhotoAsync(string filename, PhotoCaptureFileOutputFormat fileOutputFormat, OnCapturedToDiskCallback onCapturedPhotoToDiskCallback)
        {
            if (onCapturedPhotoToDiskCallback == null)
            {
                throw new ArgumentNullException("onCapturedPhotoToDiskCallback");
            }

            if (string.IsNullOrEmpty(filename))
            {
                throw new ArgumentNullException("filename");
            }

            // Make sure we don't have any forward slashes.
            // WinRT Apis do not like forward slashes.
            filename = filename.Replace("/", @"\");

            string directory = System.IO.Path.GetDirectoryName(filename);

            if (!string.IsNullOrEmpty(directory) && !System.IO.Directory.Exists(directory))
            {
                throw new ArgumentException("The specified directory does not exist.", "filename");
            }

            System.IO.FileInfo fileInfo = new System.IO.FileInfo(filename);
            if (fileInfo.Exists && fileInfo.IsReadOnly)
            {
                throw new ArgumentException("Cannot write to the file because it is read-only.", "filename");
            }

            CapturePhotoToDisk_Internal(filename, fileOutputFormat, onCapturedPhotoToDiskCallback);
        }
 public void TakePhotoAsync(string filename, PhotoCaptureFileOutputFormat fileOutputFormat, OnCapturedToDiskCallback onCapturedPhotoToDiskCallback)
 {
     CaptureBehaviour.Do(filename, fileOutputFormat);
 }