/// <summary> /// Refresh cached data. /// </summary> private static void RefreshCache() { lock (_unknownTaxon) { _unknownTaxon.Clear(); } TaxonNameTypes = null; TaxonNameUseTypes = null; TaxonTypes = null; }
/// <summary> /// Get all taxon type objects. /// </summary> /// <returns>All taxon types.</returns> public static TaxonTypeList GetTaxonTypes() { TaxonTypeList taxonTypes = null; for (Int32 getAttempts = 0; (taxonTypes.IsNull()) && (getAttempts < 3); getAttempts++) { LoadTaxonTypes(); taxonTypes = TaxonTypes; } return(taxonTypes); }
/// <summary> /// Get taxon types from web service. /// </summary> private static void LoadTaxonTypes() { TaxonTypeList taxonTypes; if (TaxonTypes.IsNull()) { // Get data from web service. taxonTypes = new TaxonTypeList(); foreach (WebTaxonType webTaxonType in WebServiceClient.GetTaxonTypes()) { taxonTypes.Add(new TaxonType(webTaxonType.Id, webTaxonType.Name, webTaxonType.SortOrder)); } TaxonTypes = taxonTypes; } }