コード例 #1
0
        public static ctrl_TableList show_in_TableList(this List <ManagementBaseObject> searchResults, ctrl_TableList tableList)
        {
            if (searchResults.isNull() || tableList.isNull())
            {
                return(tableList);
            }
            var wmiQueryItems = searchResults.createObjectWithSearchResults();

            if (wmiQueryItems.isNull() || wmiQueryItems.size() == 0)
            {
                tableList.title("No items in WMI search results");
                return(tableList);
            }
            tableList.visible(false);

            var properties = wmiQueryItems[0].type().properties();

            foreach (var property in  properties)
            {
                tableList.add_Column(property.Name);
            }

            foreach (var wmiQueryItem in  wmiQueryItems)
            {
                tableList.add_Row(wmiQueryItem.getProperties_AsArray().Select <object, string>(o => o.str()).toList());
            }

            tableList.title("Showing {0} values form {1} search results".format(properties.size(), searchResults.size()));
            tableList.visible(true);
            return(tableList);
        }
 public static ctrl_TableList show(this ctrl_TableList tableList, object targetObject)
 {
     if (tableList.notNull() && targetObject.notNull())
     {
         tableList.clearTable();
         tableList.title("{0}".format(targetObject.typeFullName()));
         tableList.add_Columns("name", "value");
         foreach (var property in PublicDI.reflection.getProperties(targetObject))
         {
             tableList.add_Row(property.Name, targetObject.prop(property.Name).str());
         }
         tableList.makeColumnWidthMatchCellWidth();
     }
     return(tableList);
 }