13 { |
13 { |
14 public class WebCamControlVM : BaseMVVM.ViewModel.ViewModel |
14 public class WebCamControlVM : BaseMVVM.ViewModel.ViewModel |
15 { |
15 { |
16 |
16 |
17 |
17 |
18 |
18 private CaptureSource _captureSource {get;set;} |
|
19 public CaptureSource CaptureSource |
|
20 { |
|
21 get |
|
22 { |
|
23 return _captureSource; |
|
24 } |
|
25 set |
|
26 { |
|
27 _captureSource = value; |
|
28 OnPropertyChanged("CaputreSource"); |
|
29 } |
|
30 } |
19 public WebCamControlVM() |
31 public WebCamControlVM() |
20 { |
32 { |
21 |
33 Commands.WebCamControl.CamRecordLanch.Executed += new EventHandler<SLExtensions.Input.ExecutedEventArgs>(CamRecordLanch_Executed); |
22 |
34 Commands.WebCamControl.CamRecordStop.Executed += new EventHandler<SLExtensions.Input.ExecutedEventArgs>(CamRecordStop_Executed); |
|
35 Commands.WebCamControl.CamRecordEnd.Executed += new EventHandler<SLExtensions.Input.ExecutedEventArgs>(CamRecordEnd_Executed); |
|
36 Commands.WebCamControl.CamRecordBegin.Executed += new EventHandler<SLExtensions.Input.ExecutedEventArgs>(CamRecordBegin_Executed); |
|
37 |
|
38 CaptureSource = new CaptureSource() |
|
39 { |
|
40 VideoCaptureDevice = CaptureDeviceConfiguration.GetDefaultVideoCaptureDevice(), |
|
41 AudioCaptureDevice = CaptureDeviceConfiguration.GetDefaultAudioCaptureDevice() |
|
42 }; |
|
43 } |
|
44 void CamRecordStop_Executed(object sender, SLExtensions.Input.ExecutedEventArgs e) |
|
45 { |
|
46 _captureSource.Stop(); |
|
47 } |
|
48 |
|
49 void CamRecordEnd_Executed(object sender, SLExtensions.Input.ExecutedEventArgs e) |
|
50 { |
|
51 |
|
52 } |
|
53 |
|
54 void CamRecordLanch_Executed(object sender, SLExtensions.Input.ExecutedEventArgs e) |
|
55 { |
|
56 if (CaptureDeviceConfiguration.AllowedDeviceAccess || CaptureDeviceConfiguration.RequestDeviceAccess()) |
|
57 { |
|
58 _captureSource.Start(); |
|
59 } |
|
60 } |
|
61 |
|
62 void CamRecordBegin_Executed(object sender, SLExtensions.Input.ExecutedEventArgs e) |
|
63 { |
|
64 |
23 } |
65 } |
24 } |
66 } |
25 } |
67 } |