/// <summary> /// Transfers the specified file. /// </summary> /// <param name="file">The file.</param> /// <param name="showMessages">if set to <c>true</c> [show messages].</param> /// <remarks>Documented by Dev02, 2009-07-15</remarks> private static void Transfer(string file, bool showMessages) { Thread sendingFormThread = new Thread(new ThreadStart(delegate() { try { lock (pendingThreads) pendingThreads.Add(Thread.CurrentThread); lock (SendingLock) { if (SendingCanceledByUser) { return; } ErrorReportSenderForm errorReportForm = new ErrorReportSenderForm(file, showMessages); Application.Run(errorReportForm); SendingCanceledByUser = errorReportForm.SendingCanceled; if (errorReportForm.SendingSuccess) { ArchiveReport(errorReportForm.ReportFile); } } } catch (Exception exp) { Trace.WriteLine("Error in Error report sending form thread: " + Environment.NewLine + exp.ToString()); } finally { lock (pendingThreads) pendingThreads.Remove(Thread.CurrentThread); } })); sendingFormThread.Name = "Error Report Sending Form Thread"; sendingFormThread.IsBackground = false; sendingFormThread.Start(); }
/// <summary> /// Transfers the specified file. /// </summary> /// <param name="file">The file.</param> /// <param name="showMessages">if set to <c>true</c> [show messages].</param> /// <remarks>Documented by Dev02, 2009-07-15</remarks> private static void Transfer(string file, bool showMessages) { Thread sendingFormThread = new Thread(new ThreadStart(delegate() { try { lock (pendingThreads) pendingThreads.Add(Thread.CurrentThread); lock (SendingLock) { if (SendingCanceledByUser) return; ErrorReportSenderForm errorReportForm = new ErrorReportSenderForm(file, showMessages); Application.Run(errorReportForm); SendingCanceledByUser = errorReportForm.SendingCanceled; if (errorReportForm.SendingSuccess) ArchiveReport(errorReportForm.ReportFile); } } catch (Exception exp) { Trace.WriteLine("Error in Error report sending form thread: " + Environment.NewLine + exp.ToString()); } finally { lock (pendingThreads) pendingThreads.Remove(Thread.CurrentThread); } })); sendingFormThread.Name = "Error Report Sending Form Thread"; sendingFormThread.IsBackground = false; sendingFormThread.Start(); }