added a wait message when refreshing portfolio

This commit is contained in:
mgroves 2010-12-26 22:00:49 -05:00
parent 86a9854c88
commit 1a30f7a44a

View file

@ -33,6 +33,8 @@ namespace MonoStockPortfolio
private void Refresh()
{
ShowMessage("Please wait!");
Action refresh = () =>
{
var tickers = _svc.GetDetailedItems(ThisPortofolioId, GetStockItemsFromConfig());
@ -40,11 +42,23 @@ namespace MonoStockPortfolio
{
RunOnUiThread(() => RefreshUI(tickers));
}
else
{
RunOnUiThread(() => ShowMessage("Please add a position!"));
}
};
var background = new Thread(() => refresh());
background.Start();
}
private void ShowMessage(string message)
{
QuoteTable.RemoveAllViews();
var pleaseWaitMessage = new TextView(this);
pleaseWaitMessage.Text = message;
QuoteTable.AddView(pleaseWaitMessage);
}
private void RefreshUI(IEnumerable<IDictionary<StockDataItem, string>> tickers)
{
QuoteTable.RemoveAllViews();