示例#1
0
        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;
        }
示例#2
0
        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);
        }