Advertisement
Guest User

NightVision.cs

a guest
Nov 9th, 2014
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.29 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Text;
  4. using System.Threading.Tasks;
  5. using Windows.Devices.Enumeration;
  6. using Windows.Media.Capture;
  7. using Windows.Media.MediaProperties;
  8. using Windows.UI.Xaml.Controls;
  9.  
  10. namespace Night_Vision
  11. {
  12.     public class NightVision
  13.     {
  14.         private static NightVision _Default;
  15.         public static NightVision GetDefault()
  16.         {
  17.             if (_Default == null)
  18.             {
  19.                 _Default = new NightVision();
  20.             }
  21.             return _Default;
  22.         }
  23.  
  24.         CaptureElement capturePreview;
  25.         MediaCapture captureMgr;
  26.         ImageEncodingProperties imageProperties = ImageEncodingProperties.CreateJpeg();
  27.  
  28.         public async System.Threading.Tasks.Task InitPreview(CaptureElement capturePreview)
  29.         {
  30.             this.capturePreview = capturePreview;
  31.             this.captureMgr = new MediaCapture();
  32.  
  33.             MediaCaptureInitializationSettings settings = new Windows.Media.Capture.MediaCaptureInitializationSettings();
  34.             settings.StreamingCaptureMode = StreamingCaptureMode.Video;
  35.             await this.captureMgr.InitializeAsync(settings);
  36.             this.capturePreview.Source = captureMgr;
  37.             await this.captureMgr.StartPreviewAsync();
  38.         }
  39.     }
  40. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement