Guest User

Untitled

a guest
May 25th, 2018
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.53 KB | None | 0 0
  1. using System;
  2. using MonoTouch.CoreFoundation;
  3. using MonoTouch.Foundation;
  4. using MonoTouch.UIKit;
  5. using MonoTouch.Dialog;
  6.  
  7.  
  8. namespace FbGroups
  9. {
  10. public class UrlImageStringElement<TKey> : ImageStringElement, MonoTouch.UrlImageStore.IUrlImageUpdated<TKey>
  11. {
  12. UITableViewCell cell = null;
  13. UITableView tableView = null;
  14.  
  15. MonoTouch.UrlImageStore.UrlImageStore<TKey> imgStore = null;
  16.  
  17. public UrlImageStringElement (MonoTouch.UrlImageStore.UrlImageStore<TKey> imageStore,
  18. string caption,
  19. NSAction tapped,
  20. string imageUrl,
  21. TKey id) : base(caption, tapped, imageStore.DefaultImage)
  22. {
  23. this.imgStore = imageStore;
  24. this.Id = id;
  25. this.ImageUrl = imageUrl;
  26. }
  27.  
  28. public UrlImageStringElement(MonoTouch.UrlImageStore.UrlImageStore<TKey> imageStore,
  29. string caption,
  30. string imageUrl,
  31. TKey id) : base(caption, imageStore.DefaultImage)
  32. {
  33. this.imgStore = imageStore;
  34. this.Id = id;
  35. this.ImageUrl = imageUrl;
  36. }
  37.  
  38. public void UrlImageUpdated (TKey id)
  39. {
  40. if (this.Id.Equals(id))
  41. {
  42. var img = this.imgStore.GetImage(id);
  43. this.cell.BeginInvokeOnMainThread(delegate {
  44. this.cell.ImageView.Image = img;
  45. this.tableView.ReloadData(); });
  46. }
  47. }
  48.  
  49. public override UITableViewCell GetCell (MonoTouch.UIKit.UITableView tv)
  50. {
  51. cell = base.GetCell (tv);
  52. tableView = tv;
  53.  
  54. this.cell.ImageView.Image = this.imgStore.RequestImage(this.Id, this.ImageUrl, this);
  55.  
  56. return cell;
  57. }
  58.  
  59. public TKey Id
  60. {
  61. get;set;
  62. }
  63.  
  64. public string ImageUrl
  65. {
  66. get;set;
  67. }
  68. }
  69. }
Add Comment
Please, Sign In to add comment