private void bwLoadCatalogues_DoWork(object sender, DoWorkEventArgs e) { BackgroundWorker worker = sender as BackgroundWorker; try { TDSettings.ConnectionRow currentConnection = e.Argument as TDSettings.ConnectionRow; Catalogues cataloguesPerUser = CatalogueManager.LoadMainCatalogues(currentConnection, worker); e.Result = cataloguesPerUser; } catch (Exception ex) { SplashManager.Close(); // just in case MyLogger.Write(ex, "bwLoadCatalogues_DoWork", LoggingCategory.Exception); worker.ReportProgress(100); throw; } }
void bkgCatalogues_DoWork(object sender, DoWorkEventArgs e) { SavingData sp = null; BackgroundWorker backgroundWorker = sender as BackgroundWorker; ArrayList result = new ArrayList(); try { ArrayList al = e.Argument as ArrayList; TDSettings.ConnectionRow currentConnection = al[0] as TDSettings.ConnectionRow; sp = al[1] as SavingData; Catalogues cataloguesPerUser = CatalogueManager.GetCataloguesForUser(currentConnection, backgroundWorker); result.Add(cataloguesPerUser); result.Add(sp); e.Result = result; } catch (Exception ex) { sp.ErrorMessage = ex.Message; sp.Operation = OperationType.LogOnFailed; MyLogger.Write(ex, "bkgCatalogues_DoWork", LoggingCategory.Exception); SplashManager.Close(); // just in case backgroundWorker.ReportProgress(100); throw new CustomException(sp, String.Empty, ex); } }