示例#1
0
        private void BindApplications()
        {
            WebAppGalleryHelpers helper = new WebAppGalleryHelpers();

            GalleryApplicationsResult result = helper.GetGalleryApplications("ZooTemplate", PanelSecurity.PackageId);

            List <GalleryApplication> applications         = result.Value as List <GalleryApplication>;
            List <GalleryApplication> filteredApplications = new List <GalleryApplication>();

            List <ShortHeliconZooEngine> allowedEngines = (List <ShortHeliconZooEngine>)ViewState["AllowedEngines"];

            if (null != allowedEngines)
            {
                foreach (GalleryApplication application in applications)
                {
                    foreach (string keyword in application.Keywords)
                    {
                        bool appAlreadyAdded = false;
                        if (keyword.StartsWith("ZooEngine", StringComparison.OrdinalIgnoreCase))
                        {
                            string appEngine = keyword.Substring("ZooEngine".Length);

                            foreach (ShortHeliconZooEngine engine in allowedEngines)
                            {
                                if (!engine.Enabled)
                                {
                                    continue; //skip
                                }

                                if (
                                    string.Equals(appEngine, engine.KeywordedName, StringComparison.OrdinalIgnoreCase)
                                    ||
                                    engine.Name == "*"
                                    )
                                {
                                    filteredApplications.Add(application);
                                    appAlreadyAdded = true;
                                    break;
                                }
                            }
                            if (appAlreadyAdded)
                            {
                                break;
                            }
                        }
                    }
                }
            }
            else
            {
                filteredApplications.AddRange(applications);
            }


            gvApplications.DataSource = filteredApplications;
            gvApplications.DataBind();
        }
        private void BindApplications()
        {
            ViewState["IsSearchResults"] = false;
            WebAppGalleryHelpers helper = new WebAppGalleryHelpers();
            //
            GalleryApplicationsResult result = helper.GetGalleryApplications(rbsCategory.SelectedValue, PanelSecurity.PackageId);

            //
            gvApplications.DataSource = result.Value;
            gvApplications.DataBind();
        }