public static void tryStripFile(string filename, bool stripCamera, bool stripMaterial) { if (!File.Exists(filename)) { MessageBox.Show("Error: File does not exist", "IV Trim", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } try { TrimIVFile.stripFile(filename, stripCamera, stripMaterial); } catch (Exception ex) { string msg = String.Format("Error trimming file ({0}):\n{1}", filename, ex.Message); libWrist.ExceptionHandling.HandledExceptionManager.ShowDialog(msg, "", "", ex); } }
private void workThreadWork(object queue) { System.Collections.Queue workQueue = (System.Collections.Queue)queue; bool done = false; while (!done) { string nextFile = ""; lock (workQueue) { if (workQueue.Count == 0) { return; //all done :) } nextFile = (string)workQueue.Dequeue(); } try { if (radioButtonTrim.Checked) { TrimIVFile.stripFile(nextFile, checkBoxCamera.Checked, checkBoxMaterial.Checked); } else { VRMLParser.ConvertVRMLToIV(nextFile, checkBoxMimics10.Checked); } lock (workQueue) _converted++; } catch (Exception ex) { _error.AppendFormat("Error converting file ({0}), {1}\n", nextFile, ex.Message); } finally { _bgWorker.ReportProgress((int)((_total - workQueue.Count) * 100 / _total)); } } }