mirror of
https://github.com/mgroves/MonodroidStockPortfolio.git
synced 2025-01-12 03:00:20 +00:00
added a wait message when refreshing portfolio
This commit is contained in:
parent
86a9854c88
commit
1a30f7a44a
1 changed files with 14 additions and 0 deletions
|
@ -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();
|
||||
|
|
Loading…
Reference in a new issue