private WideViewEntry GenerateWideViewEntryFromProperties(PSObject so, int enumerationLimit)
        {
            // compute active properties every time
            if (this.activeAssociationList == null)
            {
                SetUpActiveProperty(so);
            }

            WideViewEntry       wve = new WideViewEntry();
            FormatPropertyField fpf = new FormatPropertyField();

            wve.formatPropertyField = fpf;
            if (this.activeAssociationList.Count > 0)
            {
                // get the first one
                MshResolvedExpressionParameterAssociation a = this.activeAssociationList[0];
                FieldFormattingDirective directive          = null;
                if (a.OriginatingParameter != null)
                {
                    directive = a.OriginatingParameter.GetEntry(FormatParameterDefinitionKeys.FormatStringEntryKey) as FieldFormattingDirective;
                }

                fpf.propertyValue = this.GetExpressionDisplayValue(so, enumerationLimit, a.ResolvedExpression, directive);
            }

            this.activeAssociationList = null;
            return(wve);
        }
Example #2
0
        private TableHeaderInfo GenerateTableHeaderInfoFromProperties(PSObject so)
        {
            TableHeaderInfo info = new TableHeaderInfo {
                hideHeader = this.HideHeaders
            };

            for (int i = 0; i < base.activeAssociationList.Count; i++)
            {
                MshResolvedExpressionParameterAssociation association = base.activeAssociationList[i];
                TableColumnInfo item = new TableColumnInfo();
                if (association.OriginatingParameter != null)
                {
                    object entry = association.OriginatingParameter.GetEntry("label");
                    if (entry != AutomationNull.Value)
                    {
                        item.propertyName = (string)entry;
                    }
                }
                if (item.propertyName == null)
                {
                    item.propertyName = base.activeAssociationList[i].ResolvedExpression.ToString();
                }
                if (association.OriginatingParameter != null)
                {
                    object obj3 = association.OriginatingParameter.GetEntry("width");
                    if (obj3 != AutomationNull.Value)
                    {
                        item.width = (int)obj3;
                    }
                    else
                    {
                        item.width = 0;
                    }
                }
                else
                {
                    item.width = 0;
                }
                if (association.OriginatingParameter != null)
                {
                    object obj4 = association.OriginatingParameter.GetEntry("alignment");
                    if (obj4 != AutomationNull.Value)
                    {
                        item.alignment = (int)obj4;
                    }
                    else
                    {
                        item.alignment = ComputeDefaultAlignment(so, association.ResolvedExpression);
                    }
                }
                else
                {
                    item.alignment = ComputeDefaultAlignment(so, association.ResolvedExpression);
                }
                info.tableColumnInfoList.Add(item);
            }
            return(info);
        }
Example #3
0
        private ListViewEntry GenerateListViewEntryFromProperties(PSObject so, int enumerationLimit)
        {
            // compute active properties every time
            if (this.activeAssociationList is null)
            {
                SetUpActiveProperties(so);
            }

            ListViewEntry lve = new ListViewEntry();

            for (int k = 0; k < this.activeAssociationList.Count; k++)
            {
                MshResolvedExpressionParameterAssociation a = this.activeAssociationList[k];
                ListViewField lvf = new ListViewField();

                if (a.OriginatingParameter != null)
                {
                    object key = a.OriginatingParameter.GetEntry(FormatParameterDefinitionKeys.LabelEntryKey);

                    if (key != AutomationNull.Value)
                    {
                        lvf.propertyName = (string)key;
                    }
                    else
                    {
                        lvf.propertyName = a.ResolvedExpression.ToString();
                    }
                }
                else
                {
                    lvf.propertyName = a.ResolvedExpression.ToString();
                }

                FieldFormattingDirective directive = null;
                if (a.OriginatingParameter != null)
                {
                    directive = a.OriginatingParameter.GetEntry(FormatParameterDefinitionKeys.FormatStringEntryKey) as FieldFormattingDirective;
                }

                lvf.formatPropertyField.propertyValue = this.GetExpressionDisplayValue(so, enumerationLimit, a.ResolvedExpression, directive);
                lve.listViewFieldList.Add(lvf);
            }

            this.activeAssociationList = null;
            return(lve);
        }
Example #4
0
        private ListViewEntry GenerateListViewEntryFromProperties(PSObject so, int enumerationLimit)
        {
            if (base.activeAssociationList == null)
            {
                this.SetUpActiveProperties(so);
            }
            ListViewEntry entry = new ListViewEntry();

            for (int i = 0; i < base.activeAssociationList.Count; i++)
            {
                MshResolvedExpressionParameterAssociation association = base.activeAssociationList[i];
                ListViewField item = new ListViewField();
                if (association.OriginatingParameter != null)
                {
                    object obj2 = association.OriginatingParameter.GetEntry("label");
                    if (obj2 != AutomationNull.Value)
                    {
                        item.propertyName = (string)obj2;
                    }
                    else
                    {
                        item.propertyName = association.ResolvedExpression.ToString();
                    }
                }
                else
                {
                    item.propertyName = association.ResolvedExpression.ToString();
                }
                FieldFormattingDirective directive = null;
                if (association.OriginatingParameter != null)
                {
                    directive = association.OriginatingParameter.GetEntry("formatString") as FieldFormattingDirective;
                }
                item.formatPropertyField.propertyValue = base.GetExpressionDisplayValue(so, enumerationLimit, association.ResolvedExpression, directive);
                entry.listViewFieldList.Add(item);
            }
            base.activeAssociationList = null;
            return(entry);
        }
Example #5
0
        private WideViewEntry GenerateWideViewEntryFromProperties(PSObject so, int enumerationLimit)
        {
            if (base.activeAssociationList == null)
            {
                this.SetUpActiveProperty(so);
            }
            WideViewEntry       entry = new WideViewEntry();
            FormatPropertyField field = new FormatPropertyField();

            entry.formatPropertyField = field;
            if (base.activeAssociationList.Count > 0)
            {
                MshResolvedExpressionParameterAssociation association = base.activeAssociationList[0];
                FieldFormattingDirective directive = null;
                if (association.OriginatingParameter != null)
                {
                    directive = association.OriginatingParameter.GetEntry("formatString") as FieldFormattingDirective;
                }
                field.propertyValue = base.GetExpressionDisplayValue(so, enumerationLimit, association.ResolvedExpression, directive);
            }
            base.activeAssociationList = null;
            return(entry);
        }
        private TableHeaderInfo GenerateTableHeaderInfoFromProperties(PSObject so)
        {
            TableHeaderInfo thi = new TableHeaderInfo();

            thi.hideHeader = this.HideHeaders;

            for (int k = 0; k < this.activeAssociationList.Count; k++)
            {
                MshResolvedExpressionParameterAssociation a = this.activeAssociationList[k];
                TableColumnInfo ci = new TableColumnInfo();

                // set the label of the column
                if (a.OriginatingParameter != null)
                {
                    object key = a.OriginatingParameter.GetEntry(FormatParameterDefinitionKeys.LabelEntryKey);
                    if (key != AutomationNull.Value)
                    {
                        ci.propertyName = (string)key;
                    }
                }

                if (ci.propertyName == null)
                {
                    ci.propertyName = this.activeAssociationList[k].ResolvedExpression.ToString();
                }

                // set the width of the table
                if (a.OriginatingParameter != null)
                {
                    object key = a.OriginatingParameter.GetEntry(FormatParameterDefinitionKeys.WidthEntryKey);

                    if (key != AutomationNull.Value)
                    {
                        ci.width = (int)key;
                    }
                    else
                    {
                        ci.width = 0; // let Column Width Manager decide the width
                    }
                }
                else
                {
                    ci.width = 0; // let Column Width Manager decide the width
                }

                // set the alignment
                if (a.OriginatingParameter != null)
                {
                    object key = a.OriginatingParameter.GetEntry(FormatParameterDefinitionKeys.AlignmentEntryKey);

                    if (key != AutomationNull.Value)
                    {
                        ci.alignment = (int)key;
                    }
                    else
                    {
                        ci.alignment = ComputeDefaultAlignment(so, a.ResolvedExpression);
                    }
                }
                else
                {
                    ci.alignment = ComputeDefaultAlignment(so, a.ResolvedExpression);
                }

                thi.tableColumnInfoList.Add(ci);
            }

            return(thi);
        }