Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using MonoTouch.CoreFoundation;
- using MonoTouch.Foundation;
- using MonoTouch.UIKit;
- using MonoTouch.Dialog;
- namespace FbGroups
- {
- public class UrlImageStringElement<TKey> : ImageStringElement, MonoTouch.UrlImageStore.IUrlImageUpdated<TKey>
- {
- UITableViewCell cell = null;
- UITableView tableView = null;
- MonoTouch.UrlImageStore.UrlImageStore<TKey> imgStore = null;
- public UrlImageStringElement (MonoTouch.UrlImageStore.UrlImageStore<TKey> imageStore,
- string caption,
- NSAction tapped,
- string imageUrl,
- TKey id) : base(caption, tapped, imageStore.DefaultImage)
- {
- this.imgStore = imageStore;
- this.Id = id;
- this.ImageUrl = imageUrl;
- }
- public UrlImageStringElement(MonoTouch.UrlImageStore.UrlImageStore<TKey> imageStore,
- string caption,
- string imageUrl,
- TKey id) : base(caption, imageStore.DefaultImage)
- {
- this.imgStore = imageStore;
- this.Id = id;
- this.ImageUrl = imageUrl;
- }
- public void UrlImageUpdated (TKey id)
- {
- if (this.Id.Equals(id))
- {
- var img = this.imgStore.GetImage(id);
- this.cell.BeginInvokeOnMainThread(delegate {
- this.cell.ImageView.Image = img;
- this.tableView.ReloadData(); });
- }
- }
- public override UITableViewCell GetCell (MonoTouch.UIKit.UITableView tv)
- {
- cell = base.GetCell (tv);
- tableView = tv;
- this.cell.ImageView.Image = this.imgStore.RequestImage(this.Id, this.ImageUrl, this);
- return cell;
- }
- public TKey Id
- {
- get;set;
- }
- public string ImageUrl
- {
- get;set;
- }
- }
- }
Add Comment
Please, Sign In to add comment