MonodroidStockPortfolio/MonoStockPortfolio/Activites/ConfigScreen/ConfigPresenter.cs
2011-03-22 00:18:30 -04:00

36 lines
No EOL
1.1 KiB
C#

using System.Collections.Generic;
using System.Linq;
using MonoStockPortfolio.Core.Config;
using MonoStockPortfolio.Entities;
using MonoStockPortfolio.Core;
namespace MonoStockPortfolio.Activites.ConfigScreen
{
public class ConfigPresenter : IConfigPresenter
{
private IConfigView _currentView;
private readonly IConfigRepository _configRepository;
public ConfigPresenter(IConfigRepository configRepository)
{
_configRepository = configRepository;
}
public void Initialize(IConfigView configView)
{
_currentView = configView;
var allitems = StockDataItem.Volume.GetValues<StockDataItem>().ToList();
var checkeditems = _configRepository.GetStockItems();
_currentView.PrepopulateConfiguration(allitems, checkeditems);
}
public void SaveConfig(List<StockDataItem> checkedItems)
{
_configRepository.UpdateStockItems(checkedItems);
_currentView.ShowToastMessage("Configuration updated!");
}
}
}