public void Reload() { Licenses.Clear(); foreach (var item in LicenseRepository.RetrieveAllLicenses(SpAgent.Product)) { Licenses.Add(item); } }
public LicenseListModel() { IProductContext productContext = SpAgent.Product; ProductName = productContext.ProductName; ProductVersion = productContext.ProductVersion; // If there's no product context, then probably SpAgent hasn't been initialized // (this can happen inside Visual Studio Designer) if (productContext == null) { return; } Licenses = new ObservableCollection <LicenseItemModel>(LicenseRepository.RetrieveAllLicenses(productContext)); foreach (var license in Licenses) { license.ItemRemoved += RemoveSelectedItem; } }