protected override void OnInit(EventArgs e)
        {
            base.OnInit(e);

            Page.RegisterRequiresControlState(this);

            PropertyTypeDropDownList.Items.Add(ContentFieldTopLevelType.Text.ToString());
            PropertyTypeDropDownList.Items.Add(ContentFieldTopLevelType.Choice.ToString());

            var mgr      = new RepositoryMetadataManager();
            var allRepos = mgr.Find();

            foreach (var repo in allRepos)
            {
                var repoType =
                    RepositoryTypeResolver.ResolveTypeByApiId(repo.ApiId);

                var repoName = repo.CustomRepositoryName;
                if (string.IsNullOrWhiteSpace(repoName))
                {
                    repoName = repoType.GetCustomAttribute <DisplayNameAttribute>()?.DisplayName;
                }

                if (string.IsNullOrWhiteSpace(repoName))
                {
                    repoName = repoType.Name;
                }

                RepositoryDataSourceDropDownList.Items.Add(new ListItem(repoName, repo.ApiId.ToString()));
            }


            if (Page.IsPostBack)
            {
                return;
            }

            var interfaceId = Request["wc-interface"];

            if (!string.IsNullOrWhiteSpace(interfaceId))
            {
                var dynamicPropertyViewModels = GetAllDynamicFields(new Guid(interfaceId));
                _controlState.Properties = dynamicPropertyViewModels;
            }

            FinishInit();
        }
Exemple #2
0
        public IEnumerable <ListOption> GetOptions(ConfiguratorBuildArguments buildArguments, IDictionary <string, string> model)
        {
            var mgr = new RepositoryMetadataManager();

            foreach (var repo in mgr.Find())
            {
                var t = RepositoryTypeResolver.ResolveTypeByApiId(repo.ApiId);

                var displayName = repo.CustomRepositoryName ?? t.GetDisplayName();

                yield return(new ListOption
                {
                    Text = displayName,
                    Value = repo.ApiId.ToString()
                });
            }
        }