示例#1
0
        private bool RenderPhoneNumberColumn(TextWriter writer, int itemIndex)
        {
            PhoneNumberType    itemPropertyInt = (PhoneNumberType)this.dataSource.GetItemPropertyInt(itemIndex, ContactSchema.SelectedPreferredPhoneNumber, 1);
            PropertyDefinition propertyDefinitionFromPhoneNumberType = ContactUtilities.GetPropertyDefinitionFromPhoneNumberType(itemPropertyInt);
            string             text = this.dataSource.GetItemProperty(itemIndex, propertyDefinitionFromPhoneNumberType) as string;

            this.propertyIconMap = ContactsListViewContents.PropertyIconMap;
            if (text != null && text.Length > 0)
            {
                ThemeFileId themeFileId = this.propertyIconMap[propertyDefinitionFromPhoneNumberType];
                if (themeFileId == ThemeFileId.None)
                {
                    writer.Write("<span class=\"phpd\">&nbsp;</span>");
                }
                else
                {
                    writer.Write("<img class=\"cPh\" src=\"");
                    this.userContext.RenderThemeFileUrl(writer, themeFileId);
                    writer.Write("\"");
                    Strings.IDs localizedID;
                    if (ContactsListViewContents.PropertyAltMap.TryGetValue(propertyDefinitionFromPhoneNumberType, out localizedID))
                    {
                        writer.Write(" alt=\"");
                        writer.Write(LocalizedStrings.GetHtmlEncoded(localizedID));
                        writer.Write("\"");
                    }
                    writer.Write(">");
                }
                Utilities.CropAndRenderText(writer, text, 24);
                return(true);
            }
            foreach (KeyValuePair <PropertyDefinition, ThemeFileId> keyValuePair in this.propertyIconMap)
            {
                string text2 = this.dataSource.GetItemProperty(itemIndex, keyValuePair.Key) as string;
                if (text2 != null && text2.Length > 0)
                {
                    ThemeFileId value = keyValuePair.Value;
                    if (value == ThemeFileId.None)
                    {
                        writer.Write("<span class=\"phpd\">&nbsp;</span>");
                    }
                    else
                    {
                        writer.Write("<img class=\"cPh\" src=\"");
                        this.userContext.RenderThemeFileUrl(writer, value);
                        writer.Write("\">");
                    }
                    Utilities.CropAndRenderText(writer, text2, 24);
                    return(true);
                }
            }
            return(false);
        }