FetionSDK加载飞信图像

 

这是09年时的成果,现在FetionSDK.dll已经不能使用。

——————————————————————————————————————————

// 加载飞信好友的图像 Portrait ( 它属于 Contact.ContactInfo.Portrait)

首先要得到一个有效的 Contact 实例

其次增加 Contact.ContactInfo. PropertiesChanged 事件

最后在事件代码里完成图片的下载

基本代码如下 :

IicUri uri = Uri.CreatUri(string MobileNo);
Contact contact = sdk.AccountManager.CurrentUser.ContactList.FindFindContactByMsisdnEx(uri.MobileNo);
If(contact==null)
{
         AsyncBizOperation op = new AsyncBizOperation();
         contact = sdk.AccountManager.CurrentUser.ContactList.FindOrCreateContact(uri.Raw, op);
}
// 添加事件
contact.PersonalInfo.PropertiesChanged += new EventHandler<PropertiesChangedEventArgs>(PersonalInfo_PropertiesChanged);
void PersonalInfo_PropertiesChanged(object sender, PropertiesChangedEventArgs e)
{
         // 这里应该是一个循环 , 等返回为 True 时才表示图像下载完毕
    while (!e.ContainsAnyOfProperties(new string[] { "nickname", "Provision", "Portrait" })){}
    pictureBox1.Image = ((ContactInfo)sender).Portrait; 
}
//最近几天发了有关基于FetionSDK.dll飞信开发的一些代码,都是比较凌乱,没有有机的组织在一起,但这
//都是一些基本的模块,若以后有时间我会将所有的代码组织一下,再发到博客上,敬请关注!

 

 

 

 

 

posted @ 2009-09-15 23:08  lxiongh  阅读(113)  评论(0编辑  收藏  举报