本文整理汇总了C#中vCardPropertyCollection.Add方法的典型用法代码示例。如果您正苦于以下问题:C# vCardPropertyCollection.Add方法的具体用法?C# vCardPropertyCollection.Add怎么用?C# vCardPropertyCollection.Add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类vCardPropertyCollection
的用法示例。
在下文中一共展示了vCardPropertyCollection.Add方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: BuildProperties_IMPP
private void BuildProperties_IMPP (
vCardPropertyCollection properties,
vCard card)
{
// Build IMPP and X-AIM properties
foreach (vCardIMPP impp in card.IMs)
{
if (!string.IsNullOrEmpty(impp.Handle))
{
vCardProperty propertyIMPP;
vCardProperty propertyXAIM;
if (impp.ServiceType == IMServiceType.AIM)
{
propertyIMPP = new vCardProperty("IMPP", "aim:"+impp.Handle);
propertyIMPP.Subproperties.Add("X-SERVICE-TYPE", "AIM");
if (impp.ItemType == ItemType.HOME)
propertyIMPP.Subproperties.Add("TYPE", "HOME");
if (impp.ItemType == ItemType.WORK)
propertyIMPP.Subproperties.Add("TYPE", "WORK");
if (impp.IsPreferred)
propertyIMPP.Subproperties.Add("TYPE", "PREF");
properties.Add(propertyIMPP);
propertyXAIM = new vCardProperty("X-AIM", impp.Handle);
properties.Add(propertyXAIM);
}
}
}
}
示例2: BuildProperties_PHOTO
private void BuildProperties_PHOTO(
vCardPropertyCollection properties,
vCard card)
{
foreach (vCardPhoto photo in card.Photos)
{
if (photo.Url == null)
{
// This photo does not have a URL associated
// with it. Therefore a property can be
// generated only if the image data is loaded.
// Otherwise there is not enough information.
if (photo.IsLoaded)
{
properties.Add(
new vCardProperty("PHOTO", photo.GetBytes()));
}
}
else
{
// This photo has a URL associated with it. The
// PHOTO property can either be linked as an image
// or embedded, if desired.
bool doEmbedded =
photo.Url.IsFile ? this.embedLocalImages : this.embedInternetImages;
if (doEmbedded)
{
// According to the settings of the card writer,
// this linked image should be embedded into the
// vCard data. Attempt to fetch the data.
try
{
//photo.Fetch(); // PCL
}
catch
{
// An error was encountered. The image can
// still be written as a link, however.
doEmbedded = false;
}
}
// At this point, doEmbedded is true only if (a) the
// writer was configured to embed the image, and (b)
// the image was successfully downloaded.
if (doEmbedded)
{
properties.Add(
new vCardProperty("PHOTO", photo.GetBytes()));
}
else
{
vCardProperty uriPhotoProperty =
new vCardProperty("PHOTO");
// Set the VALUE property to indicate that
// the data for the photo is a URI.
uriPhotoProperty.Subproperties.Add("VALUE", "URI");
uriPhotoProperty.Value = photo.Url.ToString();
properties.Add(uriPhotoProperty);
}
}
}
}
示例3: 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);
}
}
示例4: BuildProperties_NAME
private void BuildProperties_NAME(
vCardPropertyCollection properties,
vCard card)
{
if (!string.IsNullOrEmpty(card.DisplayName))
{
vCardProperty property =
new vCardProperty("NAME", card.DisplayName);
properties.Add(property);
}
}
示例5: BuildProperties_NOTE
/// <summary>
/// Builds the NOTE property.
/// </summary>
private void BuildProperties_NOTE(
vCardPropertyCollection properties,
vCard card)
{
foreach (vCardNote note in card.Notes)
{
if (!string.IsNullOrEmpty(note.Text))
{
vCardProperty property = new vCardProperty();
property.Name = "NOTE";
property.Value = note.Text;
if (!string.IsNullOrEmpty(note.Language))
{
property.Subproperties.Add("language", note.Language);
}
property.Subproperties.Add("ENCODING", "QUOTED-PRINTABLE");
properties.Add(property);
}
}
}
示例6: BuildProperties_KEY
/// <summary>
/// Builds KEY properties.
/// </summary>
private void BuildProperties_KEY(
vCardPropertyCollection properties,
vCard card)
{
// A KEY field contains an embedded security certificate.
foreach (vCardCertificate certificate in card.Certificates)
{
vCardProperty property = new vCardProperty();
property.Name = "KEY";
property.Value = certificate.Data;
property.Subproperties.Add(certificate.KeyType);
properties.Add(property);
}
}
示例7: BuildProperties_MAILER
/// <summary>
/// Builds the MAILER property.
/// </summary>
private void BuildProperties_MAILER(
vCardPropertyCollection properties,
vCard card)
{
// The MAILER property indicates the software that
// generated the vCard. See section 2.4.3 of the
// vCard 2.1 specification. Support is not widespread.
if (!string.IsNullOrEmpty(card.Mailer))
{
vCardProperty property =
new vCardProperty("MAILER", card.Mailer);
properties.Add(property);
}
}
示例8: BuildProperties_TZ
private void BuildProperties_TZ(
vCardPropertyCollection properties,
vCard card)
{
if (!string.IsNullOrEmpty(card.TimeZone))
{
properties.Add(new vCardProperty("TZ", card.TimeZone));
}
}
示例9: 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("WORK");
properties.Add(property);
}
}
}
示例10: 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("BBS");
if (phone.IsCar)
property.Subproperties.Add("CAR");
if (phone.IsCellular)
property.Subproperties.Add("CELL");
if (phone.IsFax)
property.Subproperties.Add("FAX");
if (phone.IsHome)
property.Subproperties.Add("HOME");
if (phone.IsISDN)
property.Subproperties.Add("ISDN");
if (phone.IsMessagingService)
property.Subproperties.Add("MSG");
if (phone.IsModem)
property.Subproperties.Add("MODEM");
if (phone.IsPager)
property.Subproperties.Add("PAGER");
if (phone.IsPreferred)
property.Subproperties.Add("PREF");
if (phone.IsVideo)
property.Subproperties.Add("VIDEO");
if (phone.IsVoice)
property.Subproperties.Add("VOICE");
if (phone.IsWork)
property.Subproperties.Add("WORK");
property.Value = phone.FullNumber;
properties.Add(property);
}
}
示例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);
}
}
示例12: 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);
}
}
示例13: 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);
}
}
示例14: BuildProperties_NOTE
/// <summary>
/// Builds the NOTE property.
/// </summary>
private void BuildProperties_NOTE(
vCardPropertyCollection properties,
vCard card)
{
foreach (vCardNote note in card.Notes)
{
if (!string.IsNullOrEmpty(note.Text))
{
vCardProperty property = new vCardProperty();
property.Name = "NOTE";
property.Value = note.Text.Replace("\r\n","\n");
if (!string.IsNullOrEmpty(note.Language))
{
property.Subproperties.Add("language", note.Language);
}
// Don't use QUOTED-PRINTABLE since it is deprecated
//property.Subproperties.Add("ENCODING", "QUOTED-PRINTABLE");
properties.Add(property);
}
}
}
示例15: BuildProperties_FN
private void BuildProperties_FN(
vCardPropertyCollection properties,
vCard card)
{
// The FN property indicates the formatted
// name of the person. This can be something
// like "John Smith".
if (!string.IsNullOrEmpty(card.FormattedName))
{
vCardProperty property =
new vCardProperty("FN", card.FormattedName);
properties.Add(property);
}
}