private void CaptureImage_Executed(object sender, ExecutedRoutedEventArgs e)
{
//// Store current image in the webcam
BitmapSource bitmap = webcamPlayer.CurrentBitmap;
if (bitmap != null)
{
// if the images in the SelectedImages pool are more than the limit, remove the first one
if (SelectedImages.Count >= NUMB_LIMIT_PHOTOS)
{
SelectedImages.RemoveAt(0);
}
SelectedImages.Add(bitmap);
// create a new name with the incremented numb (e.g. test0.jpg, test1.jpg, ...)
String filename = MYDOC_PATH + "\\test" + numb + ".jpg";
numb++;
// call a helper method to write this bitmap to this filename.
writeThisImageTo(bitmap, filename);
_selectedImg.Source = bitmap;
}
}