mirror of
https://github.com/mgroves/MonodroidStockPortfolio.git
synced 2024-11-14 19:29:26 +00:00
handle internet errors nicer
This commit is contained in:
parent
63c387220d
commit
3d2b33e3fc
6 changed files with 30 additions and 5 deletions
|
@ -84,11 +84,18 @@ namespace MonoStockPortfolio.Activites.EditPositionScreen
|
|||
|
||||
private string ValidateTicker(string ticker)
|
||||
{
|
||||
if (_stockService.IsValidTicker(ticker))
|
||||
try
|
||||
{
|
||||
return string.Empty;
|
||||
if (_stockService.IsValidTicker(ticker))
|
||||
{
|
||||
return string.Empty;
|
||||
}
|
||||
return "Invalid Ticker Name";
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return "Unable to load stock information from the web";
|
||||
}
|
||||
return "Invalid Ticker Name";
|
||||
}
|
||||
|
||||
private string ValidateNotRepeatTicker(string ticker)
|
||||
|
|
|
@ -13,5 +13,6 @@ namespace MonoStockPortfolio.Activites.PortfolioScreen
|
|||
void UpdateHeader(IEnumerable<StockDataItem> configItems);
|
||||
void ShowProgressDialog(string loadingMessage);
|
||||
void HideProgressDialog();
|
||||
void FlashMessage(string toastMessage);
|
||||
}
|
||||
}
|
|
@ -110,6 +110,12 @@ namespace MonoStockPortfolio.Activites.PortfolioScreen
|
|||
}
|
||||
}
|
||||
|
||||
[OnGuiThread]
|
||||
public void FlashMessage(string toastMessage)
|
||||
{
|
||||
this.LongToast(toastMessage);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private void WireUpEvents()
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Android.Runtime;
|
||||
|
@ -105,7 +106,16 @@ namespace MonoStockPortfolio.Activites.PortfolioScreen
|
|||
{
|
||||
_currentView.ShowProgressDialog("Loading...Please wait...");
|
||||
|
||||
_positions = GetPositions();
|
||||
try
|
||||
{
|
||||
_positions = GetPositions();
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
_currentView.FlashMessage("Unable to load stock data from the web");
|
||||
_positions = new List<PositionResultsViewModel>();
|
||||
}
|
||||
|
||||
if (_positions.Any())
|
||||
{
|
||||
_currentView.RefreshList(_positions, GetConfigItems());
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
<AndroidApplication>true</AndroidApplication>
|
||||
<AndroidStoreUncompressedFileExtensions />
|
||||
<TargetFrameworkVersion>v2.1</TargetFrameworkVersion>
|
||||
<MandroidI18n />
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Runtime Version:4.0.30319.1
|
||||
// Runtime Version:4.0.30319.225
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
|
|
Loading…
Reference in a new issue