public static string GetTypeCategoryDisplayString(ReflectionUtil.TypeCategory type)
 {
     if (type == ReflectionUtil.TypeCategory.StaticClass)
     {
         return "static class";
     }
     else if (type == ReflectionUtil.TypeCategory.AbstractClass)
     {
         return "abstract class";
     }
     else if (type == ReflectionUtil.TypeCategory.Class)
     {
         return "class";
     }
     else if (type == ReflectionUtil.TypeCategory.Enum)
     {
         return "enum";
     }
     else if (type == ReflectionUtil.TypeCategory.Interface)
     {
         return "interface";
     }
     else if (type == ReflectionUtil.TypeCategory.Struct)
     {
         return "struct";
     }
     else
     {
         return "";
     }
 }
Example #2
0
 public TypeInfo(System.Type type)
 {
     this.Type         = type;
     this.TypeCategory = ReflectionUtil.GetTypeCategory(type);
     this.Label        = ReflectionUtil.GetTypeCategoryDisplayString(type) + " " + ReflectionUtil.GetNiceTypeName(type);
 }
Example #3
0
        public static string GetTypeCategoryDisplayString(System.Type type)
        {
            var cat = ReflectionUtil.GetTypeCategory(type);

            return(ReflectionUtil.GetTypeCategoryDisplayString(cat));
        }
Example #4
0
        public IVisio.Document DrawScriptingDocumentation()
        {
            this.AssertApplicationAvailable();

            var formdoc = new VA.Models.Forms.FormDocument();

            formdoc.Subject = "VisioAutomation.Scripting Documenation";
            formdoc.Title   = "VisioAutomation.Scripting Documenation";
            formdoc.Creator = "";
            formdoc.Company = "";

            //docbuilder.BodyParaSpacingAfter = 6.0;
            var lines = new List <string>();

            var cmdst_props = VA.Scripting.Client.GetCommandSetProperties().OrderBy(i => i.Name).ToList();
            var sb          = new System.Text.StringBuilder();
            var helpstr     = new System.Text.StringBuilder();

            foreach (var cmdset_prop in cmdst_props)
            {
                var cmdset_type = cmdset_prop.PropertyType;

                // Calculate the text
                var methods = CommandSet.GetCommandMethods(cmdset_type);
                lines.Clear();
                foreach (var method in methods)
                {
                    sb.Length = 0;
                    var method_params = method.GetParameters();
                    TextCommandsUtil.Join(sb, ", ", method_params.Select(param => string.Format("{0} {1}", ReflectionUtil.GetNiceTypeName(param.ParameterType), param.Name)));

                    if (method.ReturnType != typeof(void))
                    {
                        string line = string.Format("{0}({1}) -> {2}", method.Name, sb, ReflectionUtil.GetNiceTypeName(method.ReturnType));
                        lines.Add(line);
                    }
                    else
                    {
                        string line = string.Format("{0}({1})", method.Name, sb);
                        lines.Add(line);
                    }
                }

                lines.Sort();

                helpstr.Length = 0;
                TextCommandsUtil.Join(helpstr, "\r\n", lines);

                var formpage = new VisioAutomation.Models.Forms.FormPage();
                formpage.Title  = cmdset_prop.Name + " commands";
                formpage.Body   = helpstr.ToString();
                formpage.Name   = cmdset_prop.Name + " commands";
                formpage.Size   = new VA.Drawing.Size(8.5, 11);
                formpage.Margin = new VA.Drawing.Margin(0.5, 0.5, 0.5, 0.5);
                formdoc.Pages.Add(formpage);
            }


            //hide_ui_stuff(docbuilder.VisioDocument);

            var app = this.Client.VisioApplication;
            var doc = formdoc.Render(app);

            return(doc);
        }