internal NonscalarTypeHeader(OutGridViewCommand parentCmd, PSObject input) : base(parentCmd) { // Prepare a table view. TableView tableView = new TableView(); tableView.Initialize(parentCmd._expressionFactory, parentCmd._typeInfoDataBase); // Request a view definition from the type database. ViewDefinition viewDefinition = DisplayDataQuery.GetViewByShapeAndType(parentCmd._expressionFactory, parentCmd._typeInfoDataBase, FormatShape.Table, input.TypeNames, null); if (viewDefinition != null) { // Create a header using a view definition provided by the types database. parentCmd._windowProxy.AddColumnsAndItem(input, tableView, (TableControlBody)viewDefinition.mainControl); // Remember all type names and type groups the current view applies to. _appliesTo = viewDefinition.appliesTo; } else { // Create a header using only the input object's properties. parentCmd._windowProxy.AddColumnsAndItem(input, tableView); _appliesTo = new AppliesTo(); // Add all type names except for Object and MarshalByRefObject types because they are too generic. // Leave the Object type name if it is the only type name. int index = 0; foreach (string typeName in input.TypeNames) { if (index > 0 && (typeName.Equals(typeof(Object).FullName, StringComparison.OrdinalIgnoreCase) || typeName.Equals(typeof(MarshalByRefObject).FullName, StringComparison.OrdinalIgnoreCase))) { break; } _appliesTo.AddAppliesToType(typeName); index++; } } }
internal void AddColumnsAndItem(PSObject liveObject, TableView tableView, TableControlBody tableBody) { this.headerInfo = tableView.GenerateHeaderInfo(liveObject, tableBody, this.parentCmdlet); this.AddColumnsAndItemEnd(liveObject); }
internal NonscalarTypeHeader(OutGridViewCommand parentCmd, PSObject input) : base(parentCmd) { TableView tableView = new TableView(); tableView.Initialize(parentCmd.expressionFactory, parentCmd.typeInfoDataBase); ViewDefinition definition = DisplayDataQuery.GetViewByShapeAndType(parentCmd.expressionFactory, parentCmd.typeInfoDataBase, FormatShape.Table, input.TypeNames, null); if (definition != null) { parentCmd.windowProxy.AddColumnsAndItem(input, tableView, (TableControlBody) definition.mainControl); this.appliesTo = definition.appliesTo; } else { parentCmd.windowProxy.AddColumnsAndItem(input, tableView); this.appliesTo = new AppliesTo(); int num = 0; foreach (string str in input.TypeNames) { if ((num > 0) && (str.Equals(typeof(object).FullName, StringComparison.OrdinalIgnoreCase) || str.Equals(typeof(MarshalByRefObject).FullName, StringComparison.OrdinalIgnoreCase))) { break; } this.appliesTo.AddAppliesToType(str); num++; } } }
// Types that are not defined in the database and are not scalar. internal void AddColumnsAndItem(PSObject liveObject, TableView tableView) { // Create a header using only the input object's properties. _headerInfo = tableView.GenerateHeaderInfo(liveObject, _parentCmdlet); AddColumnsAndItemEnd(liveObject); }
// Database defined types. internal void AddColumnsAndItem(PSObject liveObject, TableView tableView, TableControlBody tableBody) { _headerInfo = tableView.GenerateHeaderInfo(liveObject, tableBody, _parentCmdlet); AddColumnsAndItemEnd(liveObject); }