private void startRecognition_Click( object sender, EventArgs e )
{
try {
sourceDataSplitContainer.Enabled = false;
resultSplitContainer.Enabled = false;
ProgressBarForm progress = new ProgressBarForm( this );
try {
processor.StepChangedAction = progress.ShowMessage;
processor.ProgressChangedAction = progress.ShowProgress;
ProcessingSettings settings = new ProcessingSettings();
settings.Country = (CountryOfOrigin)receiptCountries[countryComboBox.Text];
settings.TreatAsPhoto = treatAsPhotoCheckBox.Checked;
string result = processor.Process( imageFileTextBox.Text, settings );
receiptPictureBox.Image = sourceFilePictureBox.Image;
if( !String.IsNullOrEmpty( result ) ) {
fillReceiptFields( result );
}
resultSplitContainer.Panel1Collapsed = true;
//refreshGraphics();
showReceipt();
} finally {
processor.ProgressChangedAction = null;
processor.StepChangedAction = null;
progress.EndProgress();
}
} catch( Exception exception ) {
MessageBox.Show( this, exception.Message, this.Text, MessageBoxButtons.OK, MessageBoxIcon.Error );
} finally {
sourceDataSplitContainer.Enabled = true;
resultSplitContainer.Enabled = true;
}
}