44using System . Threading ;
55using System . Threading . Tasks ;
66using System . Windows . Input ;
7- using EA . DesktopApp . Constants ;
87using EA . DesktopApp . Contracts ;
98using EA . DesktopApp . Contracts . ViewContracts ;
109using EA . DesktopApp . Helpers ;
1312using EA . DesktopApp . Services ;
1413using EA . DesktopApp . ViewModels . Commands ;
1514using Emgu . CV ;
16- using Emgu . CV . CvEnum ;
1715using Emgu . CV . Structure ;
1816using NLog ;
1917
@@ -29,7 +27,7 @@ public class RegistrationViewModel : BaseViewModel
2927 private readonly IEmployeeGatewayService _employeeGatewayService ;
3028
3129 private readonly IPhotoShootService _photoShootService ;
32- private readonly ISoundPlayerService _soundPlayerService ;
30+ private readonly ISoundPlayerService _soundPlayerHelper ;
3331 private readonly CancellationToken _token ;
3432 private readonly IWindowManager _windowManager ;
3533
@@ -40,14 +38,14 @@ public class RegistrationViewModel : BaseViewModel
4038 /// <summary>
4139 /// .ctor
4240 /// </summary>
43- public RegistrationViewModel ( IPhotoShootService photoShootService ,
44- ISoundPlayerService soundPlayerService ,
45- IEmployeeGatewayService employeeGatewayService ,
46- IWindowManager windowManager ,
41+ public RegistrationViewModel ( IPhotoShootService photoShootService ,
42+ ISoundPlayerService soundPlayerHelper ,
43+ IEmployeeGatewayService employeeGatewayService ,
44+ IWindowManager windowManager ,
4745 CancellationToken token )
4846 {
4947 _photoShootService = photoShootService ;
50- _soundPlayerService = soundPlayerService ;
48+ _soundPlayerHelper = soundPlayerHelper ;
5149 _employeeGatewayService = employeeGatewayService ;
5250 _windowManager = windowManager ;
5351 _token = token ;
@@ -126,6 +124,8 @@ public Bitmap PhotoShootFrame
126124 /// </summary>
127125 public ICommand ToggleClearFormCommand { get ; private set ; }
128126
127+ private Image < Bgr , byte > CapturedImage { get ; set ; }
128+
129129 private void OnWindowClosingBehavior ( object sender , EventArgs e )
130130 {
131131 _photoShootService ? . CancelServiceAsync ( ) ;
@@ -167,6 +167,8 @@ private void ToggleClearFields()
167167
168168 protected override void ClearFields ( )
169169 {
170+ _soundPlayerHelper . PlaySound ( SoundPlayerService . ButtonSound ) ;
171+
170172 PersonName = string . Empty ;
171173 PersonLastName = string . Empty ;
172174 PersonDepartment = string . Empty ;
@@ -178,7 +180,7 @@ protected override void ClearFields()
178180 /// </summary>
179181 private async Task ToggleAddImageToDataBase ( )
180182 {
181- _soundPlayerService . PlaySound ( SoundPlayerService . ButtonSound ) ;
183+ _soundPlayerHelper . PlaySound ( SoundPlayerService . ButtonSound ) ;
182184
183185 var converter = new ImageConverter ( ) ;
184186 var imageArray = ( byte [ ] ) converter . ConvertTo ( GrayScaleImage , typeof ( byte [ ] ) ) ;
@@ -219,14 +221,12 @@ private async Task ToggleAddImageToDataBase()
219221 }
220222 }
221223
222- private Image < Bgr , byte > CapturedImage { get ; set ; }
223-
224224 /// <summary>
225225 /// Get grayscale image method
226226 /// </summary>
227227 private void ToggleGetImageExecute ( )
228228 {
229- _soundPlayerService . PlaySound ( SoundPlayerService . CameraSound ) ;
229+ _soundPlayerHelper . PlaySound ( SoundPlayerService . CameraSound ) ;
230230 GrayScaleImage = _photoShootService . CropFaceFromImage ( CapturedImage ) . ToBitmap ( ) ;
231231 }
232232 }
0 commit comments