示例#1
0
        protected async Task <IViewComponentResult> xpropertyInfo(XPropertyInfo xproperty, char accessKey, int tabIndex, _XThisCache xthis)
        {
            _XInModel xmodel = new _XInModel();

            xmodel.AccessKey = accessKey;
            xmodel.Class     = _XPropertyInfoModel.XToClass(xproperty);
            xmodel.Name      = xproperty.XName;
            xmodel.TabIndex  = tabIndex;
            xmodel.Text      = _XStringModel.XToString(xproperty, xstring);
            //xmodel.Title = _XStringModel.XToTitle(x, xproperty, xstring);
            xmodel.XString = xstring;
            xmodel.XType   = xproperty.XPropertyType;
            bool   ximplicit = _XPropertyInfoModel.XIsImplicit(xproperty, x);
            string view      = null;

            XBuild(xmodel, out view, xthis, ximplicit);
            if (view != null)
            {
                return(View(view, xmodel));
            }
            return(View(xmodel));
        }
示例#2
0
 protected void XBuild(_XInModel xmodel, out string view, _XThisCache xthis, bool ximplicit)
 {
     xmodel.DefaultValue   = "";
     xmodel.Disabled       = "";
     xmodel.Id             = "";
     xmodel.ReadOnly       = "";
     xmodel.Required       = "";
     xmodel.SpellCheck     = "";
     xmodel.AccessKeyIndex = xmodel.Text.IndexOf(xmodel.AccessKey, StringComparison.OrdinalIgnoreCase);
     xmodel.Type           = "";
     xmodel.Size           = (int)(XConst.XRATIO * xmodel.Text.Length);
     view = null;
     if (xmodel.XType.XIsEnum)
     {
         view = "Enum";
     }
     else if (xmodel.XType.XFullName == (typeof(string[])).FullName)
     {
         view = "StringArray";
     }
     else if (xmodel.XType.XIsArray)
     {
         view = "Array";
     }
     else
     {
         view = "Default";
         if (ximplicit)
         {
             xmodel.Type = "password";
         }
         else if (xmodel.XType.XFullName == (typeof(bool)).FullName)
         {
             xmodel.Type = "checkbox";
         }
         else if (xmodel.XType.XFullName == (typeof(Color)).FullName)
         {
             xmodel.Type = "color";
         }
         else if (xmodel.XType.XFullName == (typeof(DateTime)).FullName)
         {
             xmodel.Type = "datetime";
         }
         else if (xmodel.XType.XFullName == (typeof(File)).FullName)
         {
             xmodel.Type = "file";
         }
         else if (xmodel.XType.XFullName == (typeof(float)).FullName)
         {
             xmodel.Type = "number";
         }
         else if (xmodel.XType.XFullName == (typeof(int)).FullName)
         {
             xmodel.Type = "number";
         }
         else if (xmodel.XType.XFullName == (typeof(string)).FullName)
         {
             xmodel.SpellCheck = "spellcheck";
             xmodel.Type       = "text";
         }
         else if (xmodel.XType.XFullName == (typeof(Uri)).FullName)
         {
             xmodel.Type = "url";
         }
         else
         {
             view            = "Ref";
             xmodel.XObjects = new Dictionary <string, XObject>();
             foreach (var keyValue in xthis.XObjects)
             {
                 XType xtype2 = keyValue.Value.XGetType();
                 if (xmodel.XType.XIsAssignableFrom(xtype2))
                 {
                     xmodel.XObjects.Add(keyValue.Key, keyValue.Value);
                 }
             }
         }
     }
 }