/// <summary> /// Clears all the global /// </summary> public static void ClearValues() { AccountingGroups.Clear(); CostProfileGroups.Clear(); CountriesOfOrigin.Clear(); CustomerIdConversions.Clear(); ExternalIdTypes.Clear(); ItemCategories.Clear(); ItemGroups.Clear(); ItemIds.Clear(); ItemIdSuffixes.Clear(); ItemRecords.Clear(); Languages.Clear(); Licenses.Clear(); LocalItemIds.Clear(); MetaDescriptions.Clear(); PricingGroups.Clear(); ProductCategories.Clear(); ProductFormats.Clear(); ProductGoups.Clear(); ProductLines.Clear(); Properties.Clear(); PsStatuses.Clear(); RequestStatus.Clear(); SpecialCharacters.Clear(); TariffCodes.Clear(); Territories.Clear(); ToolTips.Clear(); UpcProductFormatExceptions.Clear(); Upcs.Clear(); UserNames.Clear(); UserRoles.Clear(); WebCategoryList.Clear(); }
private void LoadResources() { Licenses.Clear(); Licenses.Add(string.Empty, Strings.Common_ChooseALicense); SelectedLicense = string.Empty; foreach (var line in _git.GetLicenses()) { Licenses.Add(line, line); } Owners.Clear(); var user = _storage.GetUser(); if (user != null) { Owners.Add(new Ownership(user.Username, user.FullName, OwnershipTypes.User)); } Task.Run(async() => { var owners = await _web.GetUserOrginizationsAsync(); await ThreadingHelper.SwitchToMainThreadAsync(); foreach (var owner in owners) { Owners.Add(owner); } }); }
public void Reload() { Licenses.Clear(); foreach (var item in LicenseRepository.RetrieveLicensesDueForRenewal(SpAgent.Product)) { Licenses.Add(item); } }
private void LoadResources() { Licenses.Clear(); Licenses.Add(string.Empty, Strings.Common_ChooseALicense); SelectedLicense = string.Empty; foreach (var line in _git.GetLicenses()) { Licenses.Add(line, line); } }
private void LoadLicenses(string licenseFile) { bool createPlaceholder = false; string errorDescription = "No licenses found in license file!"; if (File.Exists(licenseFile)) { try { XDocument root = XDocument.Load(licenseFile); if (root?.Root == null) { errorDescription = $"No Data extracted from license file!"; createPlaceholder = true; } else { string licenseDirectory = Path.GetDirectoryName(licenseFile); foreach (XElement license in root.Root.Elements("License")) { LicenseData licenseData = new LicenseData(); licenseData.Name = license.Attribute("Name")?.Value ?? "No License File"; licenseData.Link = license.Attribute("Link")?.Value ?? "..."; const string licenseFileName = "licenseFile"; if (license.Attribute(licenseFileName) != null) { string builtLicenseFile = Path.Combine(licenseDirectory, license.Attribute(licenseFileName).Value); if (File.Exists(builtLicenseFile)) { licenseData.License = File.ReadAllText(builtLicenseFile); } else { licenseData.License = $"License file not found! file '{builtLicenseFile}'"; } } else { licenseData.License = "No license file defined!"; } Licenses.Add(licenseData); } } } catch (Exception ex) { Logging.Logger.Log(LogLevel.Error, $"Failed to extact License data from '{licenseFile}'", ex); errorDescription = $"Failed to load data from the license file '{licenseFile}'\n\nReason: {ex.Message}"; createPlaceholder = true; } } else { createPlaceholder = true; errorDescription = $"Failed to find the license file '{licenseFile}'"; } if (createPlaceholder || Licenses.Count == 0) { Licenses.Clear(); LicenseData licenseData = new LicenseData(); licenseData.Name = "No License File"; licenseData.Link = "..."; licenseData.License = $"Oh No! :(\n\n{errorDescription}"; Licenses.Add(licenseData); } }