Not logged in. · Lost password · Register
Forum: MatriX RSS
Avatar
AliVireTechnologies1 #1
Member since Jun 2013 · 58 posts
Group memberships: Members
Show profile · Link to this post
Subject: Showing Image on contact List Issue
I want to show image on contact list em using the following method in roster list but it is quit annoying that it is taking time and callback method taking time, call back method is executing after the end of all roster list items is there any faster way of getting image from vcard data, I don't want to save bitmap image in dictionary or any observation collection object ,

  1. private void GetVcard(Jid jid)
  2. {
  3.     var viq = new VcardIq {To=jid, Type = Matrix.Xmpp.IqType.get };
  4.     Model.Utility.xmppClient.IqFilter.SendIq(viq, VcardResponse);
  5. }
  6.  
  7. private void VcardResponse(object sender, IqEventArgs e)
  8. {
  9.     if (e.Iq.Type == Matrix.Xmpp.IqType.result)
  10.     {
  11.         var vc = e.Iq.Query as Vcard;
  12.  
  13.         if (null != vc.Photo)
  14.         {
  15.  
  16.             try
  17.             {
  18.                 ContactPhoto = vc.Photo.Image.UriSource;
  19.             }
  20.             catch (Exception ex)
  21.             {
  22.  
  23.             }
  24.         }
  25.         else
  26.         {
  27.  
  28.             ContactPhoto = new System.Uri("/Assets/Avatar.png", UriKind.Relative);
  29.         }
  30.     }
  31. }
This post was edited 3 times, last on 2015-08-10, 11:35 by Alex.
Avatar
Alex #2
Member since Feb 2003 · 4322 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
you get the vcard and the picture as fast as your server is responding and your internet connection transmits the data.
You should not request the pictures on every login. You should cache them in the storage of your app and request them only once until they change.
see also: http://xmpp.org/extensions/xep-0153.html

Alex
Close Smaller – Larger + Reply to this post:
Verification code: VeriCode Please enter the word from the image into the text field below. (Type the letters only, lower case is okay.)
Smileys: :-) ;-) :-D :-p :blush: :cool: :rolleyes: :huh: :-/ <_< :-( :'( :#: :scared: 8-( :nuts: :-O
Special characters:
Forum: MatriX RSS