/// <summary> /// This method parses the buglist.cgi response html and retrives the bugs found /// </summary> /// <param name="BugzillaUrl">Url of the bugzilla system where the user is connected</param> /// <param name="Params">Hash containing the columns that must be loaded and later on, displayed</param> /// <returns></returns> public List <MyZilla.BusinessEntities.Bug> SearchBugs(NameValueCollection Params) { TDSettings.ConnectionRow connection = MyZillaSettingsDataSet.GetInstance().GetConnectionById(_connectionId); string myZillaUrl = connection.URL; HttpHelper httpDialog = new HttpHelper(_connectionId, connection.Charset); myZillaUrl += SEARCH_BUGS_PAGE;// "buglist.cgi?"; StringBuilder criterias = new StringBuilder(); string paramFormat = "{0}={1}&"; for (int i = 0; i < Params.Count; i++) { //compose QueryString based on the criteria selected in the interface for (int j = 0; j < Params.GetValues(i).Length; j++) { criterias.Append(String.Format(paramFormat, Params.GetKey(i), Params.GetValues(i)[j])); } } myZillaUrl += criterias.ToString(); string htmlContent = httpDialog.GetFromUrl(myZillaUrl + "ctype=csv", false); this.ParseCsvGettingBugs(htmlContent); return(bugs); }
private bool CheckForModifications(int connectionID) { bool isModified = false; // get the connection info and compare with the values in the controls TDSettings.ConnectionRow connection = _connSettings.GetConnectionById(connectionID); if (connection != null) { isModified = (connection.ConnectionName != txtConnectionName.Text.Trim()); isModified |= (connection.URL != txtUrl.Text.Trim()); isModified |= (connection.UserName != txtUserName.Text.Trim()); isModified |= (connection.Password != txtPassword.Text.Trim()); isModified |= (connection.Type != cmbType.Text); isModified |= (connection.RememberPassword != chkRemember.Checked); isModified |= (connection.ActiveUser != chkActiveUser.Checked); } return(isModified); }
public int AddConnection(string connectionName, string url, string connectionType, string userName, string password, bool rememberPass, bool activeUser) { TDSettings.ConnectionRow connectionRow = this.Connection.NewConnectionRow(); connectionRow.ConnectionName = connectionName; connectionRow.URL = url; connectionRow.Type = connectionType; connectionRow.UserName = userName; connectionRow.Password = password; connectionRow.RememberPassword = rememberPass; connectionRow.ActiveUser = activeUser; this.Connection.Rows.Add(connectionRow); SavingData sp = new SavingData(OperationType.AddConnection, connectionRow); this.SaveXML(sp); return(connectionRow.ConnectionId); }
public void EditConnection(TDSettings.ConnectionRow connectionValues) { TDSettings.ConnectionRow[] rowConn = this.Connection.Select("ConnectionId=" + connectionValues.ConnectionId) as TDSettings.ConnectionRow[]; if (rowConn != null && rowConn.Length == 1) { rowConn[0].ConnectionName = connectionValues.ConnectionName; rowConn[0].URL = connectionValues.URL; rowConn[0].Type = connectionValues.Type; rowConn[0].UserName = connectionValues.UserName; rowConn[0].Password = connectionValues.Password; rowConn[0].RememberPassword = connectionValues.RememberPassword; rowConn[0].ActiveUser = connectionValues.ActiveUser; rowConn[0].Charset = connectionValues.Charset; SavingData sp = new SavingData(OperationType.EditConnection, rowConn[0]); this.SaveXML(sp); } }
public string GetAttachment(int attID, bool isPicture, out Bitmap bitmap, out string errorMessage) { bitmap = null; string result = string.Empty; errorMessage = string.Empty; TDSettings.ConnectionRow connection = MyZillaSettingsDataSet.GetInstance().GetConnectionById(_connectionId); string url = String.Concat(connection.URL, ATTACHMENT_PAGE, attID); MyZilla.BL.Utils.HttpHelper httpDialog = new HttpHelper(_connectionId, connection.Charset); if (isPicture) { bitmap = httpDialog.GetPictureFromUrl(url, false); } else { string getResult = httpDialog.GetFromUrl(url, false); if (result.ToLower().IndexOf("error") >= 0) { errorMessage = getResult; } else { result = getResult; } } return(result); }
/// <summary> /// Get the LAST_UPDATED (delta_ts) of the specified bug. /// Used only for bugzilla 2.18 /// </summary> /// <param name="bugzillaURL"></param> /// <param name="bugId"></param> /// <returns></returns> public string GetBugLastUpdated(int bugId) { string result = null; TDSettings.ConnectionRow connection = MyZillaSettingsDataSet.GetInstance().GetConnectionById(_connectionId); string myZillaUrl = connection.URL; string urlEnding = String.Format(BUG_LAST_UPDATED_URL, bugId); try { HttpHelper httpDialog = new HttpHelper(_connectionId, connection.Charset); string strContent = httpDialog.GetFromUrl(myZillaUrl + urlEnding, false); if (String.IsNullOrEmpty(strContent)) { } else { result = GetStringBetween(strContent, "value=\"", "\"", strContent.IndexOf("delta_ts"), false); } } catch { } return(result); }
void refreshCatalogues_DoWork(object sender, DoWorkEventArgs e) { BackgroundWorker bkgWork = sender as BackgroundWorker; try { bkgWork.ReportProgress(0); List <Catalogues> activeConnections = new List <Catalogues>(); for (int i = 0; i < globalCataloguesCollection.Count; i++) { activeConnections.Add(globalCataloguesCollection[i]); } globalCataloguesCollection.Clear(); for (int i = 0; i < activeConnections.Count; i++) { TDSettings.ConnectionRow connRow = _appSettings.GetConnectionById(activeConnections [i].ConnectionId); Catalogues newCatalogue = null; try { newCatalogue = CatalogueManager.GetCataloguesForUser(connRow, bkgWork); } catch (Exception) { // login failed or another exception // old collection are kept. } // add catalogues per user if (newCatalogue != null) { globalCataloguesCollection.Add(newCatalogue); } else { // keep the old collections globalCataloguesCollection.Add(activeConnections[i]); } string connectionInfo = _appSettings.GetConnectionInfo(connRow.ConnectionId); bkgWork.ReportProgress(1 + i * 90 / activeConnections.Count, connectionInfo); } bkgWork.ReportProgress(100); } catch (Exception ex) { MyLogger.Write(ex, "refreshCatalogues_DoWork", LoggingCategory.Exception); bkgWork.ReportProgress(100); throw; } }
public ArrayList GetValuesForDependentCatalogues(int classificationsCount, NameValueCollection products) { ArrayList result = new ArrayList(); NameValueCollection resCPTS = new NameValueCollection(); NameValueCollection resVERS = new NameValueCollection(); NameValueCollection resTMS = new NameValueCollection(); // get the content of the page TDSettings.ConnectionRow connection = MyZillaSettingsDataSet.GetInstance().GetConnectionById(_connectionId); string myZillaUrl = connection.URL; HttpHelper httpDialog = new HttpHelper(_connectionId, connection.Charset); myZillaUrl += ADVANCED_SEARCH_BUGS_PAGE; string htmlContent = httpDialog.GetFromUrl(myZillaUrl, false); if (classificationsCount == 0) { for (int i = 0; i < products.Count; i++) { string catalogItemName = products.GetKey(i); Dictionary <string, string> res = GetSubstringForCriteria(htmlContent, "cpts[" + i.ToString() + "] = ", "];", catalogItemName); foreach (KeyValuePair <string, string> entry in res) { resCPTS.Add(entry.Value, entry.Key); } res = GetSubstringForCriteria(htmlContent, "vers[" + i.ToString() + "] = ", "];", catalogItemName); foreach (KeyValuePair <string, string> entry in res) { resVERS.Add(entry.Value, entry.Key); } res = GetSubstringForCriteria(htmlContent, "tms[" + i.ToString() + "] = ", "];", catalogItemName); foreach (KeyValuePair <string, string> entry in res) { resTMS.Add(entry.Value, entry.Key); } } result.Add(resCPTS); result.Add(resVERS); result.Add(resTMS); } return(result); }
public void PostAttachment(Attachment attachment, out string errorMessage) { errorMessage = string.Empty; TDSettings.ConnectionRow connection = MyZillaSettingsDataSet.GetInstance().GetConnectionById(_connectionId); string myZillaUrl = connection.URL; MyZilla.BL.Utils.HttpHelper httpDialog = new HttpHelper(_connectionId, connection.Charset); try { string result = httpDialog.PostAttachment(attachment, myZillaUrl); string token = ""; int startToken = result.IndexOf("token"); if (startToken > 0) { int stopTokenEntry = result.Substring(startToken).IndexOf(">"); if (stopTokenEntry > 0) { string res = result.Substring(startToken, stopTokenEntry); if (!string.IsNullOrEmpty(res)) { if (res.Contains("value=")) { token = res.Substring(res.IndexOf("value=") + "value=".Length); token = token.Replace("\"", ""); } } } } if (!string.IsNullOrEmpty(token)) { attachment.Token = token; } if (result.IndexOf("Changes Submitted") >= 0) { errorMessage = string.Empty; } else { int pos1 = result.IndexOf("<title>"); int pos2 = result.IndexOf("</title>"); errorMessage = result.Substring(pos1 + "<title>".Length, pos2 - (pos1 - 1 + "</title>".Length)); } } catch (Exception ex) { errorMessage = ex.Message; } }
/// <summary> /// Get the details of the specified bug. /// </summary> /// <param name="bugzillaURL"></param> /// <param name="bugId"></param> /// <returns></returns> public MyZilla.BusinessEntities.Bug GetBug(int bugId) { TDSettings.ConnectionRow connection = MyZillaSettingsDataSet.GetInstance().GetConnectionById(_connectionId); string urlEnding = String.Format(BUG_DETAILS_URL, bugId); MyZilla.BusinessEntities.Bug bugBSI = GetBugDetailsFromXml(connection.URL, urlEnding, connection.Charset); return(bugBSI); }
private void lstConnections_SelectedIndexChanged(object sender, EventArgs e) { try { if (lstConnections.SelectedIndex >= 0) { ConnectionItem ci = lstConnections.SelectedItem as ConnectionItem; lblTestResult.Visible = false; if (ci != null) { TDSettings.ConnectionRow conn = _connSettings.GetConnectionById(ci.ConnectionID); if (conn != null) { txtUrl.Text = conn.URL; txtConnectionName.Text = conn.ConnectionName; txtUserName.Text = conn.UserName; txtPassword.Text = conn.Password; chkActiveUser.Checked = conn.ActiveUser; //chkRemember.Checked = conn.RememberPassword; } else { if (this._addConnection == true) { txtConnectionName.Text = Messages.NewConnection; txtUrl.Text = string.Empty; txtUserName.Text = string.Empty; txtPassword.Text = string.Empty; chkActiveUser.Checked = false; //chkRemember.Checked = false; } } } } } catch (Exception ex) { MyLogger.Write(ex, "lstConnections_SelectedIndexChanged", LoggingCategory.Exception); MessageBox.Show(this, ex.Message, Messages.Error, MessageBoxButtons.OK, MessageBoxIcon.Error); } }
public string GetBugzillaVersion(string url) { string version = String.Empty; TDSettings.ConnectionRow connection = MyZillaSettingsDataSet.GetInstance().GetConnectionById(_connectionId); string urlBase = connection.URL; HttpHelper httpDialog = new HttpHelper(_connectionId, connection.Charset); string httpContent = httpDialog.GetFromUrl(String.Concat(urlBase, String.Format(BUG_DETAILS_URL, -1)), false); this.bugzillaCharset = httpDialog.BugzillaCharset; XmlDocument doc = new XmlDocument(); string toFind = "urlbase=\""; int startIndex = httpContent.IndexOf(toFind); if (startIndex >= 0) { int endIndex = httpContent.IndexOf('"', startIndex + toFind.Length); if (endIndex > startIndex) { string[] list = httpContent.Substring(startIndex + toFind.Length, endIndex - startIndex - toFind.Length).Split(new char[] { '"' }, StringSplitOptions.RemoveEmptyEntries); httpContent = httpContent.Replace(list[0], urlBase); } } //WARNING //if login cookies are not generated //, xml is not returned and getting bugzilla version fails try { doc.LoadXml(httpContent); XmlNodeList bugVersion = doc.GetElementsByTagName("bugzilla"); XmlNode versionNode = bugVersion[0]; XmlElement versionElement = (XmlElement)versionNode; if (versionElement.HasAttributes) { version = versionElement.Attributes["version"].InnerText; } } catch { //generic version number for cases when getting bugzilla version fails version = "2.0"; } return(version); }
/// <summary> /// The passwords must be encrypted before saving them in xml. /// </summary> private void DecryptPasswordsAfterSaving() { if (this.Connection.Rows.Count > 0) { for (int i = 0; i < this.Connection.Rows.Count; i++) { TDSettings.ConnectionRow connection = this.Connection.Rows[i] as TDSettings.ConnectionRow; connection.Password = EncryptDecrypt.DecryptString(connection.Password, encryptionKey); } } }
public string GetAttachment(int attID, out string errorMessage) { TDSettings.ConnectionRow connection = MyZillaSettingsDataSet.GetInstance().GetConnectionById(_connectionId); string url = String.Concat(connection.URL, ATTACHMENT_PAGE, attID); MyZilla.BL.Utils.HttpHelper httpDialog = new HttpHelper(_connectionId, connection.Charset); string strFullPath = httpDialog.GetStreamFormUrl(url, out errorMessage); return(strFullPath); }
public TDSettings.ConnectionRow GetConnectionById(int connectionId) { TDSettings.ConnectionRow result = null; TDSettings.ConnectionRow[] rows = this.Connection.Select("ConnectionId=" + connectionId.ToString()) as TDSettings.ConnectionRow []; if (rows != null && rows.Length == 1) { result = rows[0]; } return(result); }
public string UpdateBugs(SortedList bugsIdList, Bug bugPropetriesToBeChanged, out string errorMessage) { errorMessage = string.Empty; TDSettings.ConnectionRow connection = MyZillaSettingsDataSet.GetInstance().GetConnectionById(_connectionId); string strResult = string.Empty; string url = String.Concat(connection.URL, UPDATE_BUG_PAGE); MyZilla.BL.Utils.HttpHelper httpDialog = new HttpHelper(_connectionId, connection.Charset); string dataToPost = httpDialog.PostHttpRequest_UpdateBugsBulk(bugsIdList, bugPropetriesToBeChanged); string htmlContent = httpDialog.PostToUrl(url, dataToPost, false); errorMessage = HttpEngine.GetStringBetween(htmlContent, "<title>", "</title>", 0, false); if (errorMessage.Contains("processed")) { //message is not from an error errorMessage = String.Empty; string updBugs = String.Empty; foreach (object key in bugsIdList.Keys) { if (String.IsNullOrEmpty(updBugs)) { updBugs = key.ToString(); } else { updBugs += "," + key.ToString(); } } if (updBugs.Length > 0) { strResult = string.Format(Resource.MsgUpdBunchBugsSuccessfully, updBugs); } } #if DEBUG MyZilla.BL.Interfaces.Utils.htmlContents = htmlContent; #endif return(strResult); }
public string GetBugzillaCharset(string url) { string version = String.Empty; TDSettings.ConnectionRow connection = MyZillaSettingsDataSet.GetInstance().GetConnectionById(_connectionId); string urlBase = connection.URL; HttpHelper httpDialog = new HttpHelper(_connectionId, connection.Charset); string httpContent = httpDialog.GetFromUrl(urlBase, false); this.bugzillaCharset = httpDialog.BugzillaCharset; return(this.bugzillaCharset); }
// TO DO load catalogues for connection public void LoadCataloguesForUser(int connectionId) { TDSettings.ConnectionRow connection = _appSettings.GetConnectionById(connectionId); if (String.IsNullOrEmpty(connection.Charset)) { IUtilities utilities = (IUtilities)BLControllerFactory.GetRegisteredConcreteFactory(connectionId); connection.Charset = utilities.GetBugzillaCharset(connection.URL); _appSettings.EditConnection(connection); } SavingData data = new SavingData(OperationType.EditConnection, connection); this.LoadCataloguesForUser(data); }
private static FoldersRow CreateFolder(TDSettings.ConnectionRow connectionRow, string forlderName, int levelId, int parentId) { FoldersRow newFolder = _instance.Folders.NewFoldersRow(); newFolder.Name = forlderName; newFolder.UserID = connectionRow.ConnectionId; newFolder.LevelID = levelId; newFolder.ParentID = parentId; newFolder.ReadOnly = true; newFolder.Expanded = false; newFolder.Deleted = false; _instance.Folders.AddFoldersRow(newFolder); _instance.AcceptChanges(); return(newFolder); }
/// <summary> /// Gets the columns to be displayed from Bugzilla - colchange.cgi /// /// </summary> /// <param name="BugzillaUrl">Url of the bugzilla system</param> /// <returns>Hashtable (key is column name, value is the index in the array of columns)</returns> public Hashtable GenerateColumnsToBeDisplayed(System.ComponentModel.BackgroundWorker backgroundWorker) { TDSettings.ConnectionRow connection = MyZillaSettingsDataSet.GetInstance().GetConnectionById(_connectionId); HttpHelper httpRequest = new HttpHelper(_connectionId, connection.Charset); //GET HTML content for the page provided string htmlContent = httpRequest.GetFromUrl(String.Concat(connection.URL, DISPLAYED_COLUMNS_PAGE), false); ParseHtmlForColumnListValues(htmlContent); if (backgroundWorker != null) { backgroundWorker.ReportProgress(100); } return(cols); }
/// <summary> /// Returns the folder datarow object if folder exists, otherwise returns null /// </summary> /// <param name="Connection"></param> /// <param name="FolderName"></param> /// <returns></returns> private static FoldersRow GetFolderByName(TDSettings.ConnectionRow connectionRow, string folderName) { DataRow[] folders; FoldersRow result; folders = _instance.Folders.Select("Name = '" + folderName + "' AND UserID = " + connectionRow.ConnectionId.ToString()); if (folders == null || folders.GetLength(0) == 0) { result = null; } else //length should be 1 { result = (FoldersRow)folders[0]; } return(result); }
public void LoadDefaultDataForUserId(TreeView treeView, TDSettings.ConnectionRow connectionRow) { string defaultFileName = Application.StartupPath + Path.DirectorySeparatorChar + _defaultFileName; try { if (File.Exists(defaultFileName)) { TDSQueriesTree treeStructure = new TDSQueriesTree(); treeStructure.ReadXml(defaultFileName); //treeStructure.WriteXml("c:\\test.xml"); BuildTreeStructureForUserId(treeStructure, connectionRow); } } catch (IOException) { throw (new IOException("File " + defaultFileName + " does not exist.")); } }
public ArrayList GetSpecificCataloguesWhenManageBug(string productName, NameValueCollection Components) { MyLogger.Write("Start getting bug specific catalogs!", "GetSpecificCataloguesWhenManageBug", LoggingCategory.General); TDSettings.ConnectionRow connection = MyZillaSettingsDataSet.GetInstance().GetConnectionById(_connectionId); string myZillaUrl = connection.URL; HttpHelper httpHelper = new HttpHelper(_connectionId, connection.Charset); myZillaUrl = myZillaUrl + String.Format(ADD_BUG_PAGE, productName); //get html content string htmlContent = httpHelper.GetFromUrl(myZillaUrl, false); ParseHtmlForDependentCatalogues(new DataContainer(productName, htmlContent, Components)); MyLogger.Write("Complete getting bug specific catalogs!", "GetSpecificCataloguesWhenManageBug", LoggingCategory.General); return(resultSpecificCatalogues); }
private MyZillaSettingsDataSet(string userPathData) { // set the path where the xml file are stored. _fileName = userPathData + "\\BSISettings.xml"; try { if (File.Exists(_fileName)) { this.ReadXml(_fileName); if (this.Connection.Rows.Count > 0) { for (int i = 0; i < this.Connection.Rows.Count; i++) { TDSettings.ConnectionRow connection = this.Connection.Rows[i] as TDSettings.ConnectionRow; connection.Password = EncryptDecrypt.DecryptString(connection.Password, encryptionKey); } } //prevent access to SortIndex field when this field is null for (int i = 0; i < this.Columns.Count; i++) { try { this.Columns[i].SortIndex = this.Columns[i].SortIndex; } catch { this.Columns[i].SortIndex = 0; } } this.Columns.AcceptChanges(); } } catch (IOException) { throw (new IOException("File " + _fileName + " not exist.")); } }
/// <summary> /// Load catalogues for all users that are active and the credentials are known. /// </summary> public void LoadCataloguesForActiveConnections() { #if DEBUG System.Diagnostics.Stopwatch watch = System.Diagnostics.Stopwatch.StartNew(); #endif // get all active users TDSettings.ConnectionDataTable activeConnections = _appSettings.GetActiveConnections(); if (activeConnections.Rows.Count > 0) { for (int iThread = 0; iThread < activeConnections.Count; iThread++) { Interlocked.Increment(ref activeThreads); TDSettings.ConnectionRow currentConnection = activeConnections.Rows[iThread] as TDSettings.ConnectionRow; ParameterizedThreadStart operation = new ParameterizedThreadStart(StartAsyncOperation); Thread ts = new Thread(operation); ts.Start(currentConnection); } // Wait for all threads to complete their task... do { }while (activeThreads != 0); #if DEBUG watch.Stop(); MyLogger.Write(watch.ElapsedMilliseconds.ToString(), "LoadCataloguesForActiveConnections", LoggingCategory.Debug); #endif } }
private void LoadCataloguesForUser(SavingData data) { // check if the catalogues collection has loaded. bool isLoaded = false; for (int i = 0; i < globalCataloguesCollection.Count; i++) { if (globalCataloguesCollection[i].ConnectionId == data.ConnectionRow.ConnectionId) { isLoaded = true; } } if (!isLoaded) { TDSettings.ConnectionRow connection = _appSettings.GetConnectionById(data.ConnectionRow.ConnectionId); BackgroundWorker bwCatalogues = new BackgroundWorker(); bwCatalogues.DoWork += new DoWorkEventHandler(bkgCatalogues_DoWork); bwCatalogues.RunWorkerCompleted += new RunWorkerCompletedEventHandler(bkgCatalogues_RunWorkerCompleted); bwCatalogues.ProgressChanged += new ProgressChangedEventHandler(bkgCatalogues_ProgressChanged); bwCatalogues.WorkerReportsProgress = true; bwCatalogues.WorkerSupportsCancellation = true; ArrayList al = new ArrayList(); al.Add(connection); al.Add(data); bwCatalogues.RunWorkerAsync(al); } }
/// <summary> /// Get the details of the specified bug. /// </summary> /// <param name="bugzillaURL"></param> /// <param name="bugId"></param> /// <returns></returns> public List <MyZilla.BusinessEntities.Bug> GetBugs(string bugIdList) { TDSettings.ConnectionRow connection = MyZillaSettingsDataSet.GetInstance().GetConnectionById(_connectionId); string urlEnding = String.Format(BUGS_DETAILS_URL, bugIdList); XmlNodeList bugsAsXMLNodes = GetBugsAsXML(connection.URL, urlEnding, connection.Charset); List <MyZilla.BusinessEntities.Bug> bugs = new List <MyZilla.BusinessEntities.Bug>(); if (bugsAsXMLNodes != null) { foreach (XmlNode node in bugsAsXMLNodes) { bugs.Add(GetBug(node)); } } else { } return(bugs); }
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; } }
public string AddBug(MyZilla.BusinessEntities.Bug newBug) { string result = string.Empty; int versionINT = -1; TDSettings.ConnectionRow connection = MyZillaSettingsDataSet.GetInstance().GetConnectionById(_connectionId); // get version for connection MyZillaSettingsDataSet _appSettings = MyZillaSettingsDataSet.GetInstance(); string version = _appSettings.GetConnectionById(_connectionId).Version; try { versionINT = int.Parse(version.Substring(0, version.IndexOf("."))); } catch (FormatException ex) { result = ex.Message; return(result); } switch (versionINT) { case 2: result = this.AddBugForVersion_2_0(newBug, connection.URL, connection.Charset); break; case 3: result = this.AddBugForVersion_3_0(newBug, connection.URL, connection.Charset); break; } return(result); }
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); } }