Skip to content

Instantly share code, notes, and snippets.

@androidcn
Created May 5, 2013 13:15
Show Gist options
  • Save androidcn/5520805 to your computer and use it in GitHub Desktop.
Save androidcn/5520805 to your computer and use it in GitHub Desktop.
public class TableSourse<T>:UITableViewSource{
protected List<T> listItems;
public TableSourse(UIViewController comeView,List<T> comeListItems)
{
this.orgView=comeView;
listItems=comeListItems;
}
public override UITableViewCell GetCell (UITableView tableView, NSIndexPath indexPath)
{
if (orgView.NibName.Contains ("First")) {
//listItems as Shanghai
//
listItems [indexPath.Row].GoldName;
}
else
{
//listItems as Foreign
listItems [indexPath.Row].SecName;
}
}
}
public void Main:UIViewController{
List<Shanghai> sh=new List<ShangHai>();
sh=getGold();
tableSHGold.Source=new tableSource(this,sh);
List<Foreign> fo=new List<Foreign>();
fo=getFoGold();
tablefoGold.Source=new tableSource(this,fo);
}
public class Shanghai
{
public Shanghai ()
{
}
[SQLite.PrimaryKey]
public string GoldType{get;set;}
public string GoldName{get;set;}
public DateTime NewTime{get;set;}
public decimal HighPrice{get;set;}
public decimal NewPrice{get;set;}
public decimal OpenPrice{get;set;}
public decimal LowPrice{get;set;}
public decimal LastPrice{get;set;}
public decimal BuyPrice{get;set;}
public decimal SellPrice{get;set;}
}
public class Foreign
{
public Foreign ()
{
}
[SQLite.PrimaryKey]
public string SecCod{get;set;}
public string SecName{get;set;}
public string PriceTime{get;set;}
public decimal BuyNum{get;set;}
public decimal SelNum{get;set;}
public decimal SelPri{get;set;}
public decimal BuyPri{get;set;}
public string Currency{get;set;}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment