/// <summary> /// Click on Launch button: Write settings to Batch file and launch operation /// </summary> private void buttonLaunch_Click(object sender, EventArgs e) { if (currentlyProcessingImages) { if (processThread != null) { processThread.Abort(); processThread = null; SetProcessing(false); } } else { try { SetProcessing(true); settings.InputDir = textBoxInputDir.Text; settings.InputPaging = comboBoxInputPaging.Text; settings.OutputDir = textBoxOutputDir.Text; settings.InputExt = comboBoxInputExtension.Text; settings.OutputExt = comboBoxOutputExtension.Text; settings.RotateAngle = comboBoxImageRotate.Text; settings.CropLeft = (uint)numericCropLeft.Value; settings.CropRight = (uint)numericCropRight.Value; settings.CropTop = (uint)numericCropTop.Value; settings.CropBottom = (uint)numericCropBottom.Value; settings.OutputNaming = textBoxOutputNaming.Text.Trim(); settings.Reorder = checkBoxReorder.Checked; settings.Backflip = checkBoxBackFlip.Checked; Settings.WriteBatchFile(Program.BatName, settings); processThread = new Thread(() => { try { if (ImageProcessor.Run(settings, UpdateStatusLabel, ShowErrorMessage)) { try { new System.Media.SoundPlayer("C:\\WINDOWS\\Media\\chimes.wav").Play(); } catch { /* Failed to play finish sound */ } } } catch (Exception exception) { if (!(exception is ThreadAbortException)) { ShowErrorMessage(exception.GetType() + ": " + exception.Message); } } SetProcessing(false); }); processThread.Start(); } catch (Exception exception) { ShowErrorMessage(exception.GetType() + ": " + exception.Message); SetProcessing(false); } } }