本文整理汇总了C#中Contact.GetPicture方法的典型用法代码示例。如果您正苦于以下问题:C# Contact.GetPicture方法的具体用法?C# Contact.GetPicture怎么用?C# Contact.GetPicture使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Contact
的用法示例。
在下文中一共展示了Contact.GetPicture方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ParticipantItemModel
public ParticipantItemModel(Contact contact, string email)
{
this._Email = email;
this._DisplayName = contact.DisplayName;
this._ContactPicture = GetSourceImageFromContactPicture(contact.GetPicture());
this._Paid = false;
}
示例2: FormatJsonPhotos
/// <summary>
/// Formats contact photos to JSON string.
/// </summary>
/// <param name="con">Contact object</param>
/// <returns>JSON string</returns>
private static string FormatJsonPhotos(Contact con)
{
// we return single photo since contact object instance contains single picture only
var photoStream = con.GetPicture();
if (photoStream == null) {
return "";
}
return String.Format("{{value:\"{0}\", type: \"data\", pref: false}}", GetImageContent(photoStream));
}
示例3: UpdateContactPictures
public void UpdateContactPictures(Contact contactToUpdate, string email)
{
ContactPictureItemModel<string, byte[]> contact = this.GetContactPictureItem(email);
if (contact != null)
{
contact.Value = GetByteArrayFromImageStream(contactToUpdate.GetPicture());
}
else
{
//ContactPictures.Add(email, GetByteArrayFromImageStream(contact.GetPicture()));
ContactPictures.Add(new ContactPictureItemModel<string, byte[]>(email, GetByteArrayFromImageStream(contactToUpdate.GetPicture())));
}
}
示例4: AddPerson
//returns false if the item already exists in the list
public bool AddPerson(Contact contact)
{
ItemViewModel a = new ItemViewModel();
BitmapImage img = new BitmapImage();
System.IO.Stream imageStream = contact.GetPicture();
if (imageStream == null)
{
img.SetSource(App.GetResourceStream(new Uri(@"Assets/AppBar/questionmark.png", UriKind.Relative)).Stream);
}
else
img.SetSource(imageStream);
a.ProfileBitMap = img;
a.LineOne = contact.DisplayName;
SaveToJpeg(imageStream, contact.DisplayName + ".jpg");
// set name to be displayed in GUI
string name = contact.DisplayName;
if(name.Length >= 9){
name = name.Substring(0,9);
}
a.Name = name;
a.Amount = 0;
a.LineTwo = "I am in dept to: ";
// check if the item exists.
foreach(ItemViewModel item in Items)
{
if (item.LineOne.Equals(a.LineOne))
{
return false;
}
}
// set different bg color of each item in the list.
if (Items.Count % 2 == 0)
{
a.BgColor = "#7FBCD8";
}
else
{
a.BgColor = "#568EB1";
}
// set own profilePic if it exists
if (PicOfMyself == null)
{
BitmapImage myPic = new BitmapImage();
myPic.SetSource(App.GetResourceStream(new Uri(@"Assets/AppBar/questionmark.png", UriKind.Relative)).Stream);
PicOfMyself = myPic;
}
a.PicOfMyself = PicOfMyself;
this.Items.Add(a);
return true;
}