当前位置: 首页>>代码示例>>C#>>正文


C# vCardProperty.ToString方法代码示例

本文整理汇总了C#中Thought.vCards.vCardProperty.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# vCardProperty.ToString方法的具体用法?C# vCardProperty.ToString怎么用?C# vCardProperty.ToString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Thought.vCards.vCardProperty的用法示例。


在下文中一共展示了vCardProperty.ToString方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ReadInto_X_WAB_GENDER

        /// <summary>
        ///     Reads the X-WAB-GENDER property.
        /// </summary>
        private void ReadInto_X_WAB_GENDER(vCard card, vCardProperty property)
        {

            // The X-WAB-GENDER property is a custom property generated by
            // Microsoft Outlook 2003.  It contains the value 1 for females
            // or 2 for males.  It is not known if other PIM clients 
            // recognize this value.

            int genderId;

            if (int.TryParse(property.ToString(), out genderId))
            {
                switch (genderId)
                {
                    case 1:
                        card.Gender = vCardGender.Female;
                        break;

                    case 2:
                        card.Gender = vCardGender.Male;
                        break;
                }
            }

        }
开发者ID:richardsalt,项目名称:Thought.vCards,代码行数:28,代码来源:vCardStandardReader.cs

示例2: ReadInto_UID

 /// <summary>
 ///     Reads the UID property.
 /// </summary>
 private void ReadInto_UID(vCard card, vCardProperty property)
 {
     card.UniqueId = property.ToString();
 }
开发者ID:richardsalt,项目名称:Thought.vCards,代码行数:7,代码来源:vCardStandardReader.cs

示例3: ReadInto_URL

        /// <summary>
        ///     Reads the URL property.
        /// </summary>
        private void ReadInto_URL(vCard card, vCardProperty property)
        {

            vCardWebsite webSite = new vCardWebsite();

            webSite.Url = property.ToString();

            if (property.Subproperties.Contains("HOME"))
                webSite.IsPersonalSite = true;

            if (property.Subproperties.Contains("WORK"))
                webSite.IsWorkSite = true;

            card.Websites.Add(webSite);

        }
开发者ID:richardsalt,项目名称:Thought.vCards,代码行数:19,代码来源:vCardStandardReader.cs

示例4: ReadInto_TITLE

        /// <summary>
        ///     Reads the TITLE property.
        /// </summary>
        private void ReadInto_TITLE(vCard card, vCardProperty property)
        {

            // The TITLE property defines the job title of the
            // person.  This should not be confused by the name
            // prefix (e.g. "Mr"), which is called "Title" in
            // some vCard-compatible software like Outlook.

            card.Title = property.ToString();

        }
开发者ID:richardsalt,项目名称:Thought.vCards,代码行数:14,代码来源:vCardStandardReader.cs

示例5: ReadInto_TZ

 /// <summary>
 ///     Reads a TZ property.
 /// </summary>
 private void ReadInto_TZ(vCard card, vCardProperty property)
 {
     card.TimeZone = property.ToString();
 }
开发者ID:richardsalt,项目名称:Thought.vCards,代码行数:7,代码来源:vCardStandardReader.cs

示例6: ReadInto_PRODID

        /// <summary>
        ///     Reads the PRODID property.
        /// </summary>
        private void ReadInto_PRODID(vCard card, vCardProperty property)
        {

            // The PRODID property contains the name of the
            // software that generated the vCard.  This is not
            // a common property.  Also note: this library
            // does not automatically generate a PRODID when
            // creating a vCard file.  The developer can set
            // the PRODID (via the ProductId parameter) to
            // anything desired.

            card.ProductId = property.ToString();

        }
开发者ID:richardsalt,项目名称:Thought.vCards,代码行数:17,代码来源:vCardStandardReader.cs

示例7: ReadInto_TEL

        /// <summary>
        ///     Reads the TEL property.
        /// </summary>
        private void ReadInto_TEL(vCard card, vCardProperty property)
        {

            vCardPhone phone = new vCardPhone();

            // The full telephone number is stored as the 
            // value of the property.  Currently no formatted
            // rules are applied since the vCard specification
            // is somewhat confusing on this matter.

            phone.FullNumber = property.ToString();
            if (string.IsNullOrEmpty(phone.FullNumber))
                return;

            foreach (vCardSubproperty sub in property.Subproperties)
            {

                // If this subproperty is a TYPE subproperty
                // and it has a value, then it is expected
                // to contain a comma-delimited list of phone types.

                if (
                    (string.Compare(sub.Name, "TYPE", StringComparison.OrdinalIgnoreCase) == 0) &&
                    (!string.IsNullOrEmpty(sub.Value)))
                {
                    // This is a vCard 3.0 subproperty.  It defines the
                    // the list of phone types in a comma-delimited list.
                    // Note that the vCard specification allows for
                    // multiple TYPE subproperties (why ?!).

                    phone.PhoneType |=
                        ParsePhoneType(sub.Value.Split(new char[] { ',' }));

                }
                else
                {

                    // The other subproperties in a TEL property
                    // define the phone type.  The only exception
                    // are meta fields like ENCODING, CHARSET, etc,
                    // but these are probably rare with TEL.

                    phone.PhoneType |= ParsePhoneType(sub.Name);

                }

            }

            card.Phones.Add(phone);

        }
开发者ID:richardsalt,项目名称:Thought.vCards,代码行数:54,代码来源:vCardStandardReader.cs

示例8: ReadInto_NAME

        /// <summary>
        ///     Reads the NAME property.
        /// </summary>
        private void ReadInto_NAME(vCard card, vCardProperty property)
        {

            // The NAME property is used to define the displayable
            // name of the vCard.  Because it is intended for display
            // purposes, any whitespace at the beginning or end of
            // the name is trimmed.

            card.DisplayName = property.ToString().Trim();
        }
开发者ID:richardsalt,项目名称:Thought.vCards,代码行数:13,代码来源:vCardStandardReader.cs

示例9: ReadInto_PHOTO

        /// <summary>
        ///     Reads the PHOTO property.
        /// </summary>
        private void ReadInto_PHOTO(vCard card, vCardProperty property)
        {

            // The PHOTO property contains an embedded (encoded) image
            // or a link to an image.  A URL (linked) image is supposed
            // to be indicated with the VALUE=URI subproperty.

            string valueType = property.Subproperties.GetValue("VALUE");

            if (string.Compare(valueType, "URI", StringComparison.OrdinalIgnoreCase) == 0)
            {

                // This image has been defined as a URI/URL link, 
                // rather than being encoded directly in the vCard.

                card.Photos.Add(
                    new vCardPhoto(new Uri(property.ToString())));


            }
            else
            {
                card.Photos.Add(new vCardPhoto((byte[])property.Value));
            }
        }
开发者ID:richardsalt,项目名称:Thought.vCards,代码行数:28,代码来源:vCardStandardReader.cs

示例10: ReadInto_CLASS

        /// <summary>
        ///     Reads the CLASS property.
        /// </summary>
        private void ReadInto_CLASS(vCard card, vCardProperty property)
        {

            if (property.Value == null)
                return;

            switch (property.ToString().ToUpperInvariant())
            {
                case "PUBLIC":
                    card.AccessClassification = vCardAccessClassification.Public;
                    break;

                case "PRIVATE":
                    card.AccessClassification = vCardAccessClassification.Private;
                    break;

                case "CONFIDENTIAL":
                    card.AccessClassification = vCardAccessClassification.Confidential;
                    break;
            }

        }
开发者ID:richardsalt,项目名称:Thought.vCards,代码行数:25,代码来源:vCardStandardReader.cs

示例11: ReadInto_N

        /// <summary>
        ///     Reads the N property.
        /// </summary>
        private void ReadInto_N(vCard card, vCardProperty property)
        {

            // The N property defines the name of the person. The
            // propery value has several components, such as the
            // given name, family name, and suffix.  This is a 
            // core field found in almost all vCards.
            //
            // Each component is supposed to be separated with
            // a semicolon.  However, some vCard writers do not
            // write out training semicolons.  For example, the
            // last two components are the prefix (e.g. Mr.)
            // and suffix (e.g. Jr) of the name.  The semicolons
            // will be missing in some vCards if these components
            // are blank.

            string[] names = property.ToString().Split(';');

            // The first value is the family (last) name.
            card.FamilyName = names[0];
            if (names.Length == 1)
                return;

            // The next value is the given (first) name.
            card.GivenName = names[1];
            if (names.Length == 2)
                return;

            // The next value contains the middle name.
            card.AdditionalNames = names[2];
            if (names.Length == 3)
                return;

            // The next value contains the prefix, e.g. Mr.
            card.NamePrefix = names[3];
            if (names.Length == 4)
                return;

            // The last value contains the suffix, e.g. Jr.
            card.NameSuffix = names[4];

        }
开发者ID:richardsalt,项目名称:Thought.vCards,代码行数:45,代码来源:vCardStandardReader.cs

示例12: ReadInto_CATEGORIES

        /// <summary>
        ///     Reads the CATEGORIES property.
        /// </summary>
        private void ReadInto_CATEGORIES(vCard card, vCardProperty property)
        {

            // The CATEGORIES value is expected to be a comma-delimited list.

            string[] cats = property.ToString().Split(new char[] { ',' });

            // Add each non-blank line to the categories collection.

            foreach (string cat in cats)
            {
                if (cat.Length > 0)
                    card.Categories.Add(cat);
            }

        }
开发者ID:richardsalt,项目名称:Thought.vCards,代码行数:19,代码来源:vCardStandardReader.cs

示例13: ReadInto_BDAY

        /// <summary>
        ///     Reads the BDAY property.
        /// </summary>
        private void ReadInto_BDAY(vCard card, vCardProperty property)
        {

            DateTime bday;
            if (DateTime.TryParse(property.ToString(), out bday))
            {
                card.BirthDate = bday;
            }
            else
            {

                // Microsoft Outlook writes the birthdate in YYYYMMDD, e.g. 20091015
                // for October 15, 2009.

                if (DateTime.TryParseExact(
                    property.ToString(),
                    "yyyyMMdd",
                    CultureInfo.InvariantCulture,
                    DateTimeStyles.None,
                    out bday))
                {
                    card.BirthDate = bday;
                }
                else
                {
                    card.BirthDate = null;
                }
            }

        }
开发者ID:richardsalt,项目名称:Thought.vCards,代码行数:33,代码来源:vCardStandardReader.cs

示例14: ReadInto_XSocialProfile

        private void ReadInto_XSocialProfile(vCard card, vCardProperty property)
        {

            vCardSocialProfile sp = new vCardSocialProfile();
 

            sp.ProfileUrl = property.ToString();
            if (string.IsNullOrEmpty(sp.ProfileUrl))
                return;

            foreach (vCardSubproperty subproperty in property.Subproperties)
            {

                switch (subproperty.Name.ToUpperInvariant())
                {

                    case "X-USER":

                        sp.Username = subproperty.Value;

                        break;

                    case "TYPE":
              

                        string[] typeValues =
                            subproperty.Value.Split(new char[] { ',' });

                        foreach (string typeValue in typeValues)
                        {

                            SocialProfileServiceType? profileType = SocialProfileTypeUtils.GetSocialProfileServiceType(typeValue);


                                if (profileType.HasValue)
                                {
                                    sp.ServiceType = profileType.Value;


                                }
 

                 

                        }
                        break;

                }

            }

            card.SocialProfiles.Add(sp);

        }
开发者ID:bobeverland,项目名称:Thought.vCards,代码行数:54,代码来源:vCardStandardReader.cs

示例15: ReadInto_IMPP

        private void ReadInto_IMPP(vCard card, vCardProperty property)
        {

            vCardIMPP im = new vCardIMPP();

            // The full telephone number is stored as the 
            // value of the property.  Currently no formatted
            // rules are applied since the vCard specification
            // is somewhat confusing on this matter.

            im.Handle = property.ToString();
            if (string.IsNullOrEmpty(im.Handle))
                return;

            foreach (vCardSubproperty subproperty in property.Subproperties)
            {

                switch (subproperty.Name.ToUpperInvariant())
                {

                    case "PREF":

                        // The PREF subproperty indicates the email
                        // address is the preferred email address to
                        // use when contacting the person.

                        im.IsPreferred = true;
                        break;

                    case "TYPE":
                    case "X-SERVICE-TYPE":
                        // The TYPE subproperty is new in vCard 3.0.
                        // It identifies the type and can also indicate
                        // the PREF attribute.

                        string[] typeValues =
                            subproperty.Value.Split(new char[] { ',' });

                        foreach (string typeValue in typeValues)
                        {
                            if (string.Compare("PREF", typeValue, StringComparison.OrdinalIgnoreCase) == 0)
                            {
                                im.IsPreferred = true;
                            }
                            else
                            {

                                IMServiceType? imServiceType= IMTypeUtils.GetIMServiceType(typeValue);

                                if (imServiceType.HasValue)
                                {
                                    im.ServiceType = imServiceType.Value;

                                    //fix handle
                                    im.Handle = IMTypeUtils.StripHandlePrefix(im.ServiceType, im.Handle);

                                }
                                else
                                {
                                    ItemType? itemType = DecodeItemType(typeValue);

                                    if (itemType.HasValue)
                                    {
                                        im.ItemType = itemType.Value;
                                    }

                                }
  
                            }

                        }
                        break;

                }

            }

            card.IMs.Add(im);
             
        }
开发者ID:bobeverland,项目名称:Thought.vCards,代码行数:80,代码来源:vCardStandardReader.cs


注:本文中的Thought.vCards.vCardProperty.ToString方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。