public IEnumerable <CompletionData> GetControlCompletionData(IType baseType)
        {
            bool isSWC = baseType.FullName == "System.Web.UI.Control";

            string aspPrefix = "asp:";

            foreach (IType cls in WebTypeContext.ListSystemControlClasses(baseType, Project))
            {
                yield return(new AspTagCompletionData(aspPrefix, cls));
            }

            foreach (var rd in RegisteredTags)
            {
                if (!rd.IsValid())
                {
                    continue;
                }

                var ard = rd as AssemblyRegisterDirective;
                if (ard != null)
                {
                    var dom = TypeCtx.ResolveAssembly(ard.Assembly);
                    if (dom == null)
                    {
                        continue;
                    }

                    string prefix = ard.TagPrefix + ":";
                    foreach (IType cls in WebTypeContext.ListControlClasses(baseType, dom, ard.Namespace))
                    {
                        yield return(new AspTagCompletionData(prefix, cls));
                    }
                    continue;
                }

                if (!isSWC)
                {
                    continue;
                }

                ControlRegisterDirective cd = rd as ControlRegisterDirective;
                if (cd != null)
                {
                    yield return(new CompletionData(string.Concat(cd.TagPrefix, ":", cd.TagName),
                                                    Gtk.Stock.GoForward));
                }
            }

            //return controls from web.config
            foreach (var cd in TypeCtx.GetRegisteredTypeCompletionData(DirectoryPath, baseType))
            {
                yield return(cd);
            }
        }
コード例 #2
0
        public string GetRegisterDirectives()
        {
            var sb = new System.Text.StringBuilder();

            foreach (var directive in RegisteredTags)
            {
                var ard = directive as AssemblyRegisterDirective;

                if (ard != null)
                {
                    sb.AppendFormat("<%@ Register {0}=\"{1}\" {2}=\"{3}\" {4}=\"{5}\" %>", "TagPrefix", ard.TagPrefix, "Namespace", ard.Namespace, "Assembly", ard.Assembly);
                }
                else
                {
                    ControlRegisterDirective crd = (ControlRegisterDirective)directive;
                    sb.AppendFormat("<%@ Register {0}=\"{1}\" {2}=\"{3}\" {4}=\"{5}\" %>", "TagPrefix", crd.TagPrefix, "TagName", crd.TagName, "Src", crd.Src);
                }
            }

            return(sb.ToString());
        }