/// <summary> /// Constructor loads profile and catalogs /// </summary> private bool LoadCswSearchDialog() { // load CSW Profiles try { cswProfiles = _cswManager.loadProfile(); if (cswProfiles == null) { throw new NullReferenceException(resourceManager.GetString("loadProfileFailed")); } // populate profiles profileList = CswObjectsToArrayList(cswProfiles); combProfile.BeginUpdate(); combProfile.DataSource = profileList; combProfile.DisplayMember = "Name"; combProfile.ValueMember = "ID"; combProfile.SelectedIndex = -1; combProfile.EndUpdate(); } catch (Exception ex) { MessageBox.Show(resourceManager.GetString("loadProfileFailed"), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return false; } // load CSW Catalogs try { cswCatalogs = _cswManager.loadCatalog(); if (cswCatalogs == null) { throw new NullReferenceException("Failed to load catalogs. _cswCatalogs is null."); } ArrayList alCatalogs = CswObjectsToArrayList(cswCatalogs); cswCatalogCount = alCatalogs.Count; alCatalogs.Sort(); lblCatalogs.Text = resourceManager.GetString("catalogsTxt") + " (" + alCatalogs.Count + ")"; cmbCswCatalog.DataSource = alCatalogs; cmbCswCatalog.DisplayMember = "Name"; cmbCswCatalog.ValueMember = "URL"; //populate lst box for configure tab lstCatalog.DataSource = alCatalogs; lstCatalog.DisplayMember = "Name"; lstCatalog.ValueMember = "ID"; lstCatalog.SelectedIndex = cswCatalogs.Count - 1; } catch (Exception ex) { MessageBox.Show(resourceManager.GetString("loadCatalogFailed"), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return false; } return true; }
/// <summary> /// Load components for Search Tab /// </summary> /// <returns>true if successful; false if error occurred. Exception shall be raised if there was any.</returns> private bool LoadSearchTab() { ResetSearchResultsGUI(); // load CSW Profiles try { _cswProfiles = _cswManager.loadProfile(); if (_cswProfiles == null) { throw new NullReferenceException(); } } catch (Exception ex) { throw new Exception(StringResources.LoadProfilesFailed + "\r\n" + ex.Message, ex); } // load CSW Catalogs try { _cswCatalogs = _cswManager.loadCatalog(); if (_cswCatalogs == null) { throw new NullReferenceException(); } _catalogList = CswObjectsToArrayList(_cswCatalogs); catalogComboBox.BeginUpdate(); catalogComboBox.DataSource = _catalogList; catalogComboBox.DisplayMember = "Name"; catalogComboBox.ValueMember = "ID"; catalogComboBox.SelectedIndex = -1; catalogComboBox.EndUpdate(); } catch (Exception ex) { throw new Exception(StringResources.LoadCatalogsFailed + "\r\n" + ex.Message, ex); } return true; }