Created
May 19, 2010 03:22
-
-
Save Redth/405911 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment