mirror of
https://github.com/mgroves/MonodroidStockPortfolio.git
synced 2025-01-01 03:00:17 +00:00
36 lines
No EOL
1.1 KiB
C#
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!");
|
|
}
|
|
}
|
|
} |