private void bgWorker_DoWork(object sender, DoWorkEventArgs e) { try { DateTime startTime = DateTime.Now; Processor.GenerateHelp(); if (UI.CancellRequested()) { UI.Log("PROCESS CANCELLED", ChmLogLevel.ERROR); return; } UI.Log("DONE!", ChmLogLevel.INFO); DateTime stopTime = DateTime.Now; TimeSpan duration = stopTime - startTime; UI.Log("Total time: " + duration.ToString(), ChmLogLevel.DEBUG); } catch (Exception ex) { MainException = ex; UI.Log(ex); } }