using System.Collections.Generic; using System.Linq; using Android.App; using Android.Content; using Android.OS; using Android.Widget; using MonoStockPortfolio.Core.Config; using MonoStockPortfolio.Entities; using MonoStockPortfolio.Framework; using MonoStockPortfolio.Core; namespace MonoStockPortfolio.Activites { [Activity(Label = "Config", Name = "monostockportfolio.activites.ConfigActivity")] public class ConfigActivity : Activity { [IoC] private IConfigRepository _repo; [LazyView(Resource.Id.configList)] private ListView ConfigList; [LazyView(Resource.Id.btnSaveConfig)] private Button SaveConfigButton; protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); SetContentView(Resource.Layout.config); var allitems = StockDataItem.Volume.GetValues().ToList(); var allitemsLabels = allitems.Select(i => i.GetStringValue()).ToList(); var checkeditems = _repo.GetStockItems(); var configAdapter = new ArrayAdapter(this, Android.Resource.Layout.SimpleListItemMultipleChoice, allitemsLabels); ConfigList.Adapter = configAdapter; ConfigList.ChoiceMode = ChoiceMode.Multiple; for(int i=0;i().ToList(); var newConfig = new List(); for (int i = 0; i < ConfigList.Count; i++) { if(ConfigList.IsItemChecked(i)) { newConfig.Add(allitems[i]); } } _repo.UpdateStockItems(newConfig); this.LongToast("Configuration updated!"); } public static Intent GotoIntent(Context context) { var intent = new Intent(); intent.SetClassName(context, ManifestNames.GetName()); return intent; } } }