public void Register(Type projtype)
 {
     if (!projtypes.ContainsKey(projtype))
     {
         Trace.WriteLine("Registering project type: {0}", NameAttribute.GetName(projtype));
         projtypes.Add(projtype, null);
     }
 }
Example #2
0
 static string GetServiceName(IService svc)
 {
     if (Attribute.IsDefined(svc.GetType(), typeof(NameAttribute)))
     {
         NameAttribute na = Attribute.GetCustomAttribute(svc.GetType(), typeof(NameAttribute)) as NameAttribute;
         return(na.Name);
     }
     return(svc.ToString());
 }
Example #3
0
        /// <summary>
        /// Gets the description for a type
        /// </summary>
        /// <param name="t">the type</param>
        /// <returns>the description, if any</returns>
        public static string GetDescription(Type t)
        {
            NameAttribute na = Get(t);

            if (na != null)
            {
                return(na.Description);
            }
            return(NODESC);
        }
Example #4
0
        /// <summary>
        /// Gets the name of a type
        /// </summary>
        /// <param name="t">the type</param>
        /// <returns>the name, if any</returns>
        public static string GetName(Type t)
        {
            if (t == null)
            {
                return("<NULL>");
            }
            NameAttribute na = Get(t);

            if (na != null)
            {
                return(na.Name);
            }
            return(t.Name);
        }
Example #5
0
            public override ICollection GetValues()
            {
                Document  c    = ServiceHost.File.CurrentDocument as Document;
                ArrayList vals = new ArrayList();

                if (c != null && c.Views != null)
                {
                    foreach (IDocument v in c.Views)
                    {
                        NameAttribute na = Attribute.GetCustomAttribute(v.GetType(), typeof(NameAttribute)) as NameAttribute;
                        if (na != null)
                        {
                            vals.Add(na.Name);
                        }
                        else
                        {
                            vals.Add(v.GetType().Name);
                        }
                    }
                }
                return(vals);
            }