public void Update(ItemStocks items) { var sortedList = from ItemStocks.StockItem item in items.Items orderby item.Qty select item; this.AddAll(sortedList.ToArray()); this.NotifyDataSetInvalidated(); }
void ParseItemStocks(string httpRes) { var xml = XDocument.Parse(httpRes); { XElement root = xml.Root; ItemStocks data = new ItemStocks(root); _savedInstance = data; } RunOnUiThread(() => { PopulateItems(_savedInstance); }); }
protected override void OnCreate(Bundle savedInstance) { base.OnCreate(savedInstance); SetContentView(R.Layouts.ItemStocksActivity_Layout); this.ActionBar.SetDisplayHomeAsUpEnabled(true); var itemStocks = LastNonConfigurationInstance as ItemStocks; if (itemStocks != null) { PopulateItems(itemStocks); _savedInstance = itemStocks; } else { RefreshItems(); } }
void PopulateItems(ItemStocks items) { var listView = FindViewById <ListView>(R.Ids.itemStocksListView); if (listView.Adapter == null) { listView.Adapter = new ItemStocksAdapter(this, items); } else { ((ItemStocksAdapter)listView.Adapter).Update(items); } listView.ItemClick += new EventHandler <ItemClickEventArgs>(listView_ItemClick); if (pd != null) { pd.Dismiss(); } }
void PopulateItems(ItemStocks items) { var listView = FindViewById<ListView>(R.Ids.itemStocksListView); if (listView.Adapter == null) { listView.Adapter = new ItemStocksAdapter(this, items); } else { ((ItemStocksAdapter)listView.Adapter).Update(items); } listView.ItemClick += new EventHandler<ItemClickEventArgs>(listView_ItemClick); if (pd != null) { pd.Dismiss(); } }
public ItemStocksAdapter(Context context, ItemStocks items) : base(context, R.Layouts.ItemStocksAdapter_Layout) { this.Update(items); }