using System; using System.Collections.Generic; using System.Linq; using Android.App; using Android.Content; using Android.Graphics; using Android.OS; using Android.Util; using Android.Widget; using MonoStockPortfolio.Core; using MonoStockPortfolio.Core.Services; namespace MonoStockPortfolio { [Activity(Label = "Portfolio")] public class PortfolioActivity : Activity { public static string ClassName { get { return "monostockportfolio.PortfolioActivity"; } } public static string Extra_PortfolioID { get { return "monoStockPortfolio.PortfolioActivity.PortfolioID"; } } private IPortfolioService _svc; private IEnumerable[] longClickOptions; private long ThisPortofolioId { get { return Intent.GetLongExtra(Extra_PortfolioID, -1); } } protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); try { SetContentView(Resource.layout.portfolio); _svc = new PortfolioService(this); Refresh(); WireUpEvents(); SetTitle(); } catch (Exception ex) { Log.E("EXCEPTION", ex.ToString()); Toast.MakeText(this, ex.ToString(), ToastLength.Long); } } private void Refresh() { var tickers = _svc.GetDetailedItems(ThisPortofolioId, GetStockItemsFromConfig()); if (tickers.Any()) { var tableLayout = FindViewById(Resource.id.quoteTable); tableLayout.RemoveAllViews(); WriteTickerHeader(tickers.First()); foreach (var ticker in tickers) { WriteTickerRow(ticker); } } } private void WireUpEvents() { var addPositionButton = FindViewById