當前位置: 首頁>>代碼示例>>C#>>正文


C# vCards.vCardProperty類代碼示例

本文整理匯總了C#中Thought.vCards.vCardProperty的典型用法代碼示例。如果您正苦於以下問題:C# vCardProperty類的具體用法?C# vCardProperty怎麽用?C# vCardProperty使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


vCardProperty類屬於Thought.vCards命名空間,在下文中一共展示了vCardProperty類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: Constructor_Name_Value

        public void Constructor_Name_Value()
        {

            // This function tests a constructor that accepts
            // a name and initial value.

            vCardProperty property = new vCardProperty("NAME", "VALUE");

            Assert.AreEqual(
                "NAME",
                property.Name,
                "The name is incorrect.");

            Assert.AreEqual(
                "VALUE",
                property.Value,
                "The value is incorrect.");

            Assert.IsNotNull(
                property.Subproperties,
                "The subproperties collection was not created.");

            Assert.IsEmpty(
                property.Subproperties,
                "The subproperties collection should be empty.");

        }
開發者ID:richardsalt,項目名稱:Thought.vCards,代碼行數:27,代碼來源:vCardPropertyTests.cs

示例2: Constructor

        public void Constructor()
        {

            vCardProperty property = new vCardProperty();

            Assert.IsNotNull(
                property.Subproperties,
                "The subproperties collection was not created.");

            Assert.IsEmpty(
                property.Subproperties,
                "The subproperties collection should be empty.");

            Assert.IsNull(
                property.Value,
                "The value should be null.");

        }
開發者ID:richardsalt,項目名稱:Thought.vCards,代碼行數:18,代碼來源:vCardPropertyTests.cs

示例3: Constructor_Name

        public void Constructor_Name()
        {

            vCardProperty property = new vCardProperty("NAME");

            Assert.AreEqual(
                "NAME",
                property.Name,
                "The name is incorrect.");

            Assert.IsNull(
                property.Value,
                "The value should be null.");

            Assert.IsNotNull(
                property.Subproperties,
                "The subproperties collection was not created.");

            Assert.IsEmpty(
                property.Subproperties,
                "The subproperties collection should be empty.");

        }
開發者ID:richardsalt,項目名稱:Thought.vCards,代碼行數:23,代碼來源:vCardPropertyTests.cs

示例4: EncodeProperty_Name_Subproperty_Subvalue_Subproperty_Value

        public void EncodeProperty_Name_Subproperty_Subvalue_Subproperty_Value()
        {

            vCardStandardWriter writer =
                new vCardStandardWriter();

            vCardProperty property =
                new vCardProperty("NAME", "VALUE");

            property.Subproperties.Add("SUB1", "SUBVALUE");
            property.Subproperties.Add("SUB2");

            Assert.AreEqual(
                "NAME;SUB1=SUBVALUE;SUB2:VALUE",
                writer.EncodeProperty(property));

        }
開發者ID:drlongnecker,項目名稱:Thought.vCards,代碼行數:17,代碼來源:vCardStandardWriterTests.cs

示例5: BuildProperties_PRODID

      /// <summary>
      ///     Builds PRODID properties.
      /// </summary>
      private void BuildProperties_PRODID(
          vCardPropertyCollection properties,
          vCard card)
      {

        if (!string.IsNullOrEmpty(card.ProductId))
        {
          vCardProperty property = new vCardProperty();
          property.Name = "PRODID";
          property.Value = card.ProductId;
          properties.Add(property);
        }

      }
開發者ID:aluxnimm,項目名稱:outlookcaldavsynchronizer,代碼行數:17,代碼來源:vCardImprovedWriter.cs

示例6: BuildProperties_ORG

      /// <summary>
      ///     Builds the ORG property.
      /// </summary>
      private void BuildProperties_ORG(
          vCardPropertyCollection properties,
          vCard card)
      {

        // The ORG property specifies the name of the
        // person's company or organization. Example:
        //
        // ORG:FairMetric LLC

        if (!string.IsNullOrEmpty(card.Organization))
        {

          vCardProperty property;

          // Add department also
          if (!string.IsNullOrEmpty(card.Department))
          {
            vCardValueCollection values = new vCardValueCollection(';');
            values.Add(card.Organization);
            values.Add(card.Department);
            property = new vCardProperty("ORG", values);
          }
          else
          {
            property = new vCardProperty("ORG", card.Organization);
          }

          properties.Add(property);

        }

      }
開發者ID:aluxnimm,項目名稱:outlookcaldavsynchronizer,代碼行數:36,代碼來源:vCardImprovedWriter.cs

示例7: BuildProperties_NICKNAME

      /// <summary>
      ///     Builds the NICKNAME property.
      /// </summary>
      private void BuildProperties_NICKNAME(
          vCardPropertyCollection properties,
          vCard card)
      {

        // The NICKNAME property specifies the familiar name
        // of the person, such as Jim.  This is defined in
        // section 3.1.3 of RFC 2426.  Multiple names can
        // be listed, separated by commas.

        if (card.Nicknames.Count > 0)
        {

          // A NICKNAME property is a comma-separated
          // list of values.  Create a value list and
          // add the nicknames collection to it.

          vCardValueCollection values = new vCardValueCollection(',');
          values.Add(card.Nicknames);

          // Create the new properties with each name separated
          // by a comma.

          vCardProperty property =
              new vCardProperty("NICKNAME", values);

          properties.Add(property);

        }

      }
開發者ID:aluxnimm,項目名稱:outlookcaldavsynchronizer,代碼行數:34,代碼來源:vCardImprovedWriter.cs

示例8: BuildProperties_N

      private void BuildProperties_N(
          vCardPropertyCollection properties,
          vCard card)
      {

        // The property has the following components: Family Name,
        // Given Name, Additional Names, Name Prefix, and Name
        // Suffix.  Example:
        //
        //   N:Pinch;David
        //   N:Pinch;David;John
        //
        // The N property is required (see section 3.1.2 of RFC 2426).

        vCardValueCollection values = new vCardValueCollection(';');
        values.Add(card.FamilyName);
        values.Add(card.GivenName);
        values.Add(card.AdditionalNames);
        values.Add(card.NamePrefix);
        values.Add(card.NameSuffix);

        vCardProperty property = new vCardProperty("N", values);

        properties.Add(property);

      }
開發者ID:aluxnimm,項目名稱:outlookcaldavsynchronizer,代碼行數:26,代碼來源:vCardImprovedWriter.cs

示例9: BuildProperties_LABEL

      private void BuildProperties_LABEL(
          vCardPropertyCollection properties,
          vCard card)
      {

        foreach (vCardDeliveryLabel label in card.DeliveryLabels)
        {

          if (label.Text.Length > 0)
          {

            vCardProperty property = new vCardProperty("LABEL", label.Text);

            if (label.IsDomestic)
              property.Subproperties.Add("TYPE", "DOM");

            if (label.IsInternational)
              property.Subproperties.Add("TYPE", "INTL");

            if (label.IsParcel)
              property.Subproperties.Add("TYPE", "PARCEL");

            if (label.IsPostal)
              property.Subproperties.Add("TYPE", "POSTAL");

            if (label.IsHome)
              property.Subproperties.Add("TYPE", "HOME");

            if (label.IsWork)
              property.Subproperties.Add("TYPE", "WORK");

            // Don't use QUOTED-PRINTABLE.
            //property.Subproperties.Add("ENCODING", "QUOTED-PRINTABLE");
            properties.Add(property);


          }

        }

      }
開發者ID:aluxnimm,項目名稱:outlookcaldavsynchronizer,代碼行數:41,代碼來源:vCardImprovedWriter.cs

示例10: BuildProperties_URL

      private void BuildProperties_URL(
          vCardPropertyCollection properties,
          vCard card)
      {

        foreach (vCardWebsite webSite in card.Websites)
        {

          if (!string.IsNullOrEmpty(webSite.Url))
          {
            vCardProperty property =
                new vCardProperty("URL", webSite.Url.ToString());

            if (webSite.IsWorkSite)
              property.Subproperties.Add("TYPE", "WORK");

            // Add Subproperty for HOME aswell
            if (webSite.IsPersonalSite)
              property.Subproperties.Add("TYPE", "HOME");

            properties.Add(property);
          }

        }

      }
開發者ID:aluxnimm,項目名稱:outlookcaldavsynchronizer,代碼行數:26,代碼來源:vCardImprovedWriter.cs

示例11: BuildProperties_TITLE

      private void BuildProperties_TITLE(
          vCardPropertyCollection properties,
          vCard card)
      {

        // The TITLE property specifies the job title of 
        // the person.  Example:
        //
        // TITLE:Systems Analyst
        // TITLE:President

        if (!string.IsNullOrEmpty(card.Title))
        {
          vCardProperty property =
              new vCardProperty("TITLE", card.Title);

          properties.Add(property);
        }

      }
開發者ID:aluxnimm,項目名稱:outlookcaldavsynchronizer,代碼行數:20,代碼來源:vCardImprovedWriter.cs

示例12: BuildProperties_TEL

      /// <summary>
      ///     Builds TEL properties.
      /// </summary>
      private void BuildProperties_TEL(
          vCardPropertyCollection properties,
          vCard card)
      {

        // The TEL property indicates a telephone number of
        // the person (including non-voice numbers like fax
        // and BBS numbers).
        //
        // TEL;VOICE;WORK:1-800-929-5805

        foreach (vCardPhone phone in card.Phones)
        {

          // A telephone entry has the property name TEL and
          // can have zero or more subproperties like FAX
          // or HOME.  Examples:
          //
          //   TEL;HOME:+1-612-555-1212
          //   TEL;FAX;HOME:+1-612-555-1212

          vCardProperty property = new vCardProperty();

          property.Name = "TEL";

          if (phone.IsBBS)
            property.Subproperties.Add("TYPE", "BBS");

          if (phone.IsCar)
            property.Subproperties.Add("TYPE", "CAR");

          if (phone.IsCellular)
            property.Subproperties.Add("TYPE", "CELL");

          if (phone.IsFax)
          {
            if (!phone.IsHome && !phone.IsWork)
            {
              property.Subproperties.Add("TYPE", "OTHER");
            }
            property.Subproperties.Add("TYPE", "FAX");
          }

          if (phone.IsHome)
            property.Subproperties.Add("TYPE", "HOME");

          if (phone.IsISDN)
            property.Subproperties.Add("TYPE", "ISDN");

          if (phone.IsMessagingService)
            property.Subproperties.Add("TYPE", "MSG");

          if (phone.IsModem)
            property.Subproperties.Add("TYPE", "MODEM");

          if (phone.IsPager)
            property.Subproperties.Add("TYPE", "PAGER");

          if (phone.IsPreferred)
            property.Subproperties.Add("TYPE", "PREF");

          if (phone.IsVideo)
            property.Subproperties.Add("TYPE", "VIDEO");

          if (phone.IsVoice)
          {
            if (!phone.IsHome && !phone.IsWork)
            {
              property.Subproperties.Add("TYPE", "OTHER");
            }
            property.Subproperties.Add("TYPE", "VOICE");

          }

          if (phone.IsWork)
            property.Subproperties.Add("TYPE", "WORK");

          if (phone.IsMain)
            property.Subproperties.Add("TYPE", "MAIN");

          property.Value = phone.FullNumber;
          properties.Add(property);

        }

      }
開發者ID:aluxnimm,項目名稱:outlookcaldavsynchronizer,代碼行數:89,代碼來源:vCardImprovedWriter.cs

示例13: BuildProperties_SOURCE

      /// <summary>
      ///     Builds SOURCE properties.
      /// </summary>
      private void BuildProperties_SOURCE(
          vCardPropertyCollection properties,
          vCard card)
      {

        foreach (vCardSource source in card.Sources)
        {

          vCardProperty property = new vCardProperty();

          property.Name = "SOURCE";
          property.Value = source.Uri.ToString();

          if (!string.IsNullOrEmpty(source.Context))
            property.Subproperties.Add("CONTEXT", source.Context);

          properties.Add(property);

        }

      }
開發者ID:aluxnimm,項目名稱:outlookcaldavsynchronizer,代碼行數:24,代碼來源:vCardImprovedWriter.cs

示例14: BuildProperties_ROLE

      /// <summary>
      ///     Builds the ROLE property.
      /// </summary>
      private void BuildProperties_ROLE(
          vCardPropertyCollection properties,
          vCard card)
      {

        // The ROLE property identifies the role of
        // the person at his/her organization.

        if (!string.IsNullOrEmpty(card.Role))
        {

          vCardProperty property =
              new vCardProperty("ROLE", card.Role);

          properties.Add(property);

        }

      }
開發者ID:aluxnimm,項目名稱:outlookcaldavsynchronizer,代碼行數:22,代碼來源:vCardImprovedWriter.cs

示例15: BuildProperties_REV

      /// <summary>
      ///     Builds the REV property.
      /// </summary>
      private void BuildProperties_REV(
          vCardPropertyCollection properties,
          vCard card)
      {

        if (card.RevisionDate.HasValue)
        {

          vCardProperty property =
              new vCardProperty("REV", card.RevisionDate.Value.ToString());

          properties.Add(property);

        }

      }
開發者ID:aluxnimm,項目名稱:outlookcaldavsynchronizer,代碼行數:19,代碼來源:vCardImprovedWriter.cs


注:本文中的Thought.vCards.vCardProperty類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。