internal void TakePicture()
{
if ((m_takePictureAsync == null) && (m_cam != null))
{
if (m_countdownTimer != null)
{
m_countdownTimer.Abort();
m_countdownTimer = null;
}
pictureBox.Text = Language.FormatString(Language.LanguageString.MainForm_TakePicture_TakingPicture);
m_takePictureAsync = new TakePicture(m_cam.TakePicture);
m_takePictureAsync.BeginInvoke((AsyncCallback) delegate(IAsyncResult result) {
try {
pictureBox.DisplayBitmap = m_takePictureAsync.EndInvoke(result);
Invoke((MethodInvoker) delegate() {
try {
Common.SaveJPEG(pictureBox.DisplayBitmap, Path.Combine(Settings.OutputFolder, m_fileName));
pictureBox.Text = string.Empty;
} catch (Exception) {
pictureBox.Text = Language.FormatString(Language.LanguageString.NotifyForm_FailedToSave) + "\r\n" + m_fileName;
}
});
} catch (Exception) {
Invoke((MethodInvoker) delegate() {
pictureBox.Text = Language.FormatString(Language.LanguageString.NotifyForm_FailedToTakePicture);
});
} finally {
m_takePictureAsync = null;
CountdownTimerSetup();
}
}, null);
}
}