client/src/Iri.Modernisation.Controls/ViewModel/WebCamControl/WebCamControlVM.cs
changeset 35 43bb1b8ed555
parent 29 5f8d275750e7
--- a/client/src/Iri.Modernisation.Controls/ViewModel/WebCamControl/WebCamControlVM.cs	Tue Jan 19 09:49:56 2010 +0100
+++ b/client/src/Iri.Modernisation.Controls/ViewModel/WebCamControl/WebCamControlVM.cs	Mon Jan 25 09:30:22 2010 +0100
@@ -15,11 +15,53 @@
     {
 
 
-     
+         private CaptureSource _captureSource {get;set;}
+         public CaptureSource CaptureSource
+         {
+             get
+             {
+                 return _captureSource;
+             }
+             set
+             {
+                 _captureSource = value;
+                 OnPropertyChanged("CaputreSource");
+             }
+         }
         public WebCamControlVM()
         {
-            
-          
+            Commands.WebCamControl.CamRecordLanch.Executed += new EventHandler<SLExtensions.Input.ExecutedEventArgs>(CamRecordLanch_Executed);
+            Commands.WebCamControl.CamRecordStop.Executed += new EventHandler<SLExtensions.Input.ExecutedEventArgs>(CamRecordStop_Executed);
+            Commands.WebCamControl.CamRecordEnd.Executed += new EventHandler<SLExtensions.Input.ExecutedEventArgs>(CamRecordEnd_Executed);
+            Commands.WebCamControl.CamRecordBegin.Executed += new EventHandler<SLExtensions.Input.ExecutedEventArgs>(CamRecordBegin_Executed);
+		
+        CaptureSource  = new CaptureSource()
+            {
+                VideoCaptureDevice = CaptureDeviceConfiguration.GetDefaultVideoCaptureDevice(),
+                AudioCaptureDevice = CaptureDeviceConfiguration.GetDefaultAudioCaptureDevice()
+            };
+        }
+        void CamRecordStop_Executed(object sender, SLExtensions.Input.ExecutedEventArgs e)
+        {
+            _captureSource.Stop();
+        }
+
+        void CamRecordEnd_Executed(object sender, SLExtensions.Input.ExecutedEventArgs e)
+        {
+
+        }
+
+        void CamRecordLanch_Executed(object sender, SLExtensions.Input.ExecutedEventArgs e)
+        {
+            if (CaptureDeviceConfiguration.AllowedDeviceAccess || CaptureDeviceConfiguration.RequestDeviceAccess())
+            {
+                _captureSource.Start();
+            }
+        }
+
+        void CamRecordBegin_Executed(object sender, SLExtensions.Input.ExecutedEventArgs e)
+        {
+
         }
     }
 }