Esempio n. 1
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);
        }
        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);
        }
        private TableHeaderInfo GenerateTableHeaderInfoFromDataBaseInfo(PSObject so)
        {
            TableHeaderInfo thi = new TableHeaderInfo();

            bool dummy;
            List <TableRowItemDefinition> activeRowItemDefinitionList = GetActiveTableRowDefinition(_tableBody, so, out dummy);

            thi.hideHeader   = this.HideHeaders;
            thi.repeatHeader = this.RepeatHeader;

            int col = 0;

            foreach (TableRowItemDefinition rowItem in activeRowItemDefinitionList)
            {
                TableColumnInfo             ci        = new TableColumnInfo();
                TableColumnHeaderDefinition colHeader = null;
                if (_tableBody.header.columnHeaderDefinitionList.Count > 0)
                {
                    colHeader = _tableBody.header.columnHeaderDefinitionList[col];
                }

                if (colHeader != null)
                {
                    ci.width     = colHeader.width;
                    ci.alignment = colHeader.alignment;
                    if (colHeader.label != null)
                    {
                        ci.label = this.dataBaseInfo.db.displayResourceManagerCache.GetTextTokenString(colHeader.label);
                    }
                }

                if (ci.alignment == TextAlignment.Undefined)
                {
                    ci.alignment = rowItem.alignment;
                }

                if (ci.label == null)
                {
                    FormatToken token = null;
                    if (rowItem.formatTokenList.Count > 0)
                    {
                        token = rowItem.formatTokenList[0];
                    }
                    if (token != null)
                    {
                        FieldPropertyToken fpt = token as FieldPropertyToken;
                        if (fpt != null)
                        {
                            ci.label = fpt.expression.expressionValue;
                        }
                        else
                        {
                            TextToken tt = token as TextToken;
                            if (tt != null)
                            {
                                ci.label = this.dataBaseInfo.db.displayResourceManagerCache.GetTextTokenString(tt);
                            }
                        }
                    }
                    else
                    {
                        ci.label = string.Empty;
                    }
                }

                thi.tableColumnInfoList.Add(ci);
                col++;
            }

            return(thi);
        }
        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;
        }
        private TableHeaderInfo GenerateTableHeaderInfoFromDataBaseInfo(PSObject so)
        {
            TableHeaderInfo thi = new TableHeaderInfo();

            bool dummy;
            List<TableRowItemDefinition> activeRowItemDefinitionList = GetActiveTableRowDefinition(_tableBody, so, out dummy);
            thi.hideHeader = this.HideHeaders;

            int col = 0;
            foreach (TableRowItemDefinition rowItem in activeRowItemDefinitionList)
            {
                TableColumnInfo ci = new TableColumnInfo();
                TableColumnHeaderDefinition colHeader = null;
                if (_tableBody.header.columnHeaderDefinitionList.Count > 0)
                    colHeader = _tableBody.header.columnHeaderDefinitionList[col];

                if (colHeader != null)
                {
                    ci.width = colHeader.width;
                    ci.alignment = colHeader.alignment;
                    if (colHeader.label != null)
                        ci.label = this.dataBaseInfo.db.displayResourceManagerCache.GetTextTokenString(colHeader.label);
                }

                if (ci.alignment == TextAlignment.Undefined)
                {
                    ci.alignment = rowItem.alignment;
                }

                if (ci.label == null)
                {
                    FormatToken token = null;
                    if (rowItem.formatTokenList.Count > 0)
                        token = rowItem.formatTokenList[0];
                    if (token != null)
                    {
                        FieldPropertyToken fpt = token as FieldPropertyToken;
                        if (fpt != null)
                        {
                            ci.label = fpt.expression.expressionValue;
                        }
                        else
                        {
                            TextToken tt = token as TextToken;
                            if (tt != null)
                            {
                                ci.label = this.dataBaseInfo.db.displayResourceManagerCache.GetTextTokenString(tt);
                            }
                        }
                    }
                    else
                    {
                        ci.label = "";
                    }
                }

                thi.tableColumnInfoList.Add(ci);
                col++;
            }
            return thi;
        }
Esempio n. 6
0
        private TableHeaderInfo GenerateTableHeaderInfoFromDataBaseInfo(PSObject so)
        {
            bool            flag;
            TableHeaderInfo info = new TableHeaderInfo();
            List <TableRowItemDefinition> list = this.GetActiveTableRowDefinition(this.tableBody, so, out flag);

            info.hideHeader = this.HideHeaders;
            int num = 0;

            foreach (TableRowItemDefinition definition in list)
            {
                TableColumnInfo             item        = new TableColumnInfo();
                TableColumnHeaderDefinition definition2 = null;
                if (this.tableBody.header.columnHeaderDefinitionList.Count > 0)
                {
                    definition2 = this.tableBody.header.columnHeaderDefinitionList[num];
                }
                if (definition2 != null)
                {
                    item.width     = definition2.width;
                    item.alignment = definition2.alignment;
                    if (definition2.label != null)
                    {
                        item.label = base.dataBaseInfo.db.displayResourceManagerCache.GetTextTokenString(definition2.label);
                    }
                }
                if (item.alignment == 0)
                {
                    item.alignment = definition.alignment;
                }
                if (item.label == null)
                {
                    FormatToken token = null;
                    if (definition.formatTokenList.Count > 0)
                    {
                        token = definition.formatTokenList[0];
                    }
                    if (token != null)
                    {
                        FieldPropertyToken token2 = token as FieldPropertyToken;
                        if (token2 != null)
                        {
                            item.label = token2.expression.expressionValue;
                        }
                        else
                        {
                            TextToken tt = token as TextToken;
                            if (tt != null)
                            {
                                item.label = base.dataBaseInfo.db.displayResourceManagerCache.GetTextTokenString(tt);
                            }
                        }
                    }
                    else
                    {
                        item.label = "";
                    }
                }
                info.tableColumnInfoList.Add(item);
                num++;
            }
            return(info);
        }
Esempio n. 7
0
 private TableHeaderInfo GenerateTableHeaderInfoFromDataBaseInfo(PSObject so)
 {
     bool flag;
     TableHeaderInfo info = new TableHeaderInfo();
     List<TableRowItemDefinition> list = this.GetActiveTableRowDefinition(this.tableBody, so, out flag);
     info.hideHeader = this.HideHeaders;
     int num = 0;
     foreach (TableRowItemDefinition definition in list)
     {
         TableColumnInfo item = new TableColumnInfo();
         TableColumnHeaderDefinition definition2 = null;
         if (this.tableBody.header.columnHeaderDefinitionList.Count > 0)
         {
             definition2 = this.tableBody.header.columnHeaderDefinitionList[num];
         }
         if (definition2 != null)
         {
             item.width = definition2.width;
             item.alignment = definition2.alignment;
             if (definition2.label != null)
             {
                 item.label = base.dataBaseInfo.db.displayResourceManagerCache.GetTextTokenString(definition2.label);
             }
         }
         if (item.alignment == 0)
         {
             item.alignment = definition.alignment;
         }
         if (item.label == null)
         {
             FormatToken token = null;
             if (definition.formatTokenList.Count > 0)
             {
                 token = definition.formatTokenList[0];
             }
             if (token != null)
             {
                 FieldPropertyToken token2 = token as FieldPropertyToken;
                 if (token2 != null)
                 {
                     item.label = token2.expression.expressionValue;
                 }
                 else
                 {
                     TextToken tt = token as TextToken;
                     if (tt != null)
                     {
                         item.label = base.dataBaseInfo.db.displayResourceManagerCache.GetTextTokenString(tt);
                     }
                 }
             }
             else
             {
                 item.label = "";
             }
         }
         info.tableColumnInfoList.Add(item);
         num++;
     }
     return info;
 }
Esempio n. 8
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;
 }