public void Set(ContactDetails details) { _latest = details; foreach (var monitor in _monitors) { monitor.Set(details); } }
public void RecordDetails(string jid, string hash, ContactDetails details) { _infoDA.AddRecord(jid, hash, details.Fullname, details.Birthday.Ticks, details.Description, details.Url, details.PhotoType, details.PhotoBin); }
public ContactDetails GetLatestInfo(string jid) { var tuple = _infoDA.GetLatest(jid); if (tuple == null) { return null; } var result = new ContactDetails(); result.Fullname = tuple.Item1; result.Url = tuple.Item2; result.Birthday = new DateTime(tuple.Item3); result.Description = tuple.Item4; result.PhotoType = tuple.Item5; result.PhotoBin = tuple.Item6; return result; }
private void OnIq(object arg1, IQ arg2) { if (arg2.Id != _id || arg2.Type != IqType.result) { return; } _connection.OnIq -= _onIq.Exec; var vcard = arg2.Vcard; if (vcard == null) { _task.SetResult(null); return; } var description = vcard.Description; var birthday = vcard.Birthday; var fullname = vcard.Fullname; var url = vcard.Url; var photoType = vcard .With(vcard1 => vcard.Photo) .With(p => p.GetTag("TYPE")); var photoBin = vcard .With(vcard1 => vcard.Photo) .With(p => p.GetTag("BINVAL")) .With(p => p.Split('\r', '\n')) .With(p => p.FirstOrDefault()) .With(Convert.FromBase64String); var conactDetails = new ContactDetails() { Fullname = fullname, Birthday = birthday, PhotoType = photoType, PhotoBin = photoBin, Description = description, Url = url }; _task.SetResult(conactDetails); }
public void Set(ContactDetails details) { if (details == null) { return; } if (details.PhotoBin == null) { return; } using (var ms = new MemoryStream(details.PhotoBin)) { var p = new BitmapImage(); p.BeginInit(); p.StreamSource = ms; p.CacheOption = BitmapCacheOption.OnLoad; p.EndInit(); Photo = p; } }
public ConactDetailsProvider(string key, ContactDetails latest) { _latest = latest; _key = key; }