private static void SplitFiles(FileSplitter fs, string operation) { Thread t = new Thread(new ParameterizedThreadStart(SplitThread)); t.SetApartmentState(ApartmentState.STA); using (WaitDlg dlg = new WaitDlg(operation)) { dlg.UpdateStatus("Please wait while files are being extracted and imaged"); SplitThreadParams stp = new SplitThreadParams(fs, dlg); t.Start(stp); dlg.ShowDialog(); } }
private static void SplitThread(object o) { #if TEST_AS_FRENCH Tools.SetThreadToFrench(); #endif SplitThreadParams stp = (SplitThreadParams)o; WaitDlg dlg = stp.dlg; Stopwatch sw = new Stopwatch(); sw.Start(); try { stp.splitter(); sw.Stop(); dlg.AllowClose("Completed in {0:F2} seconds", sw.Elapsed.TotalSeconds); } catch (Exception e) { string exception = String.Format("Failed with exception {0} during split ", e.Message); dlg.AllowClose(exception); DebugLogger.Log("Split", exception + "{0}{1}", Environment.NewLine, e.StackTrace); } sw.Stop(); GC.Collect(); }