protected void btnInstallPortlets_Click(object sender, EventArgs e) { var uninstalled = this.GetUninstalledPortlets().ToList(); var categories = PortletInventory.GetCategories(uninstalled); var repoPortlets = PortletInventory.GetPortletsFromRepo(); var repoCategories = PortletInventory.GetCategoriesFromRepo(); foreach (var category in categories) { PortletInventory.ImportCategory(category, repoCategories); } foreach (var portlet in uninstalled) { try { PortletInventory.ImportPortlet(portlet, repoPortlets); } catch (Exception ex) { Logger.WriteException(ex); } } BindList(); pnlSuccess.Visible = true; }
private IEnumerable <PortletInventoryItem> GetUninstalledPortlets() { // get uninstalled portlets var allPortlets = PortletInventory.GetPortletsFromDll(); var repoPortlets = PortletInventory.GetPortletsFromRepo(); var uninstalled = allPortlets. Where(p => !repoPortlets.Any(r => r.GetProperty <string>("DisplayName") == p.Portlet.Name)); return(uninstalled); }