This article undates for the lastest blog about fetion_friend's portrait downing.
As we all know,we can preview stranger's portrait(photo) when we use the funtion
of addBuddy() in fetion. But maybe you don't know how it works,how it can be realized.
Today,I will tell you how it work,and how it will be achieved.
It's a amazing thing what I want to do now.Because we can preview stranger's photo
before you add him to be your friend.(This is the point.You know,someone may put his real
photo as his fetion's portrait. Just like this guy.)
Here is the demo link: http://www.humyo.cz/F/9852133-1550241075
or http://files.cnblogs.com/lxiongh/fetionPortraitDemo.rar
How it realize? Now I tell me, the code is below:
(The code must be changed to fit your code. Enjoying it. For any questions,contact me.)
IicUri uri ;
Contact contact ;
this .LastContact = null ;
AsyncBizOperation op = new AsyncBizOperation ();
op .IsImpsErrorHandled = true ;
if (isMobileNo )
{
if (this .textBoxMobileNo .Text .Length != 11 )
{ return ; }
if (!ImpsHelper .IsCmccMobileNo (this .textBoxMobileNo .Text ))
{
this ._frameworkWindow .UnifiedMessageBox .ShowWarning (this , StringTable .Contact .InvalidMobileNo );
return ;
}
uri = IicUri .CreateTelUri (this .textBoxMobileNo .Text .Trim ());
contact = this ._user .ContactList .FindContactByMsisdnEx (uri .MobileNo );
if (contact == null )
{
contact = this ._user .ContactList .FindOrCreateContact (uri .Raw , op );
}
else if ((contact .BelongToGroups .Count >= 1 ) && !this ._initTargetGroupId .HasValue )
{
this ._initTargetGroupId = new int ? (contact .BelongToGroups [0 ]); this .initGroup ();
}
}
else
{
if (this .textBoxSID .Text .Length < 3 ) { return ; } long sid = Convert .ToInt64 (this .textBoxSID .Text .Trim ());
uri = IicUri .CreateSidUri (sid ); contact = this ._user .ContactList .FindContact (uri .Raw );
if (contact == null ) { this ._user .ContactList .AsyncGetUri (sid , op );
op .Successed += new EventHandler (this .op_GetUriSuccessed ); }
else if ((contact .BelongToGroups .Count >= 1 ) && !this ._initTargetGroupId .HasValue )
{
this ._initTargetGroupId = new int ? (contact .BelongToGroups [0 ]); this .initGroup ();
}
}
if (contact != null )
{
this ._user .ContactList .AsyncGetContactsInfo (contact , new AsyncBizOperation (), null , false , new string []
{ "nickname" , "provisioning" , "portrait-crc" , "user-id" }
);
this .LastContact = contact ;
}