mirror of
https://github.com/mgroves/MonodroidStockPortfolio.git
synced 2025-01-01 03:00:17 +00:00
32 lines
No EOL
1.2 KiB
C#
32 lines
No EOL
1.2 KiB
C#
using System;
|
|
using Android.Content;
|
|
using MonoStockPortfolio.Activites.Main;
|
|
using MonoStockPortfolio.Core.Config;
|
|
using MonoStockPortfolio.Core.PortfolioRepositories;
|
|
using MonoStockPortfolio.Core.Services;
|
|
using MonoStockPortfolio.Core.StockData;
|
|
|
|
namespace MonoStockPortfolio.Framework
|
|
{
|
|
public static class ServiceLocator
|
|
{
|
|
public static Context Context { get; set; }
|
|
|
|
static ServiceLocator()
|
|
{
|
|
// presenters
|
|
IttyBittyIoC.Register<IMainPresenter>(() => new MainPresenter(new AndroidSqlitePortfolioRepository(Context)));
|
|
|
|
// services/repositories
|
|
IttyBittyIoC.Register<IStockDataProvider>(() => new YahooStockDataProvider());
|
|
IttyBittyIoC.Register<IPortfolioService>(() => new PortfolioService(new AndroidSqlitePortfolioRepository(Context), new YahooStockDataProvider()));
|
|
IttyBittyIoC.Register<IPortfolioRepository>(() => new AndroidSqlitePortfolioRepository(Context));
|
|
IttyBittyIoC.Register<IConfigRepository>(() => new AndroidSqliteConfigRepository(Context));
|
|
}
|
|
|
|
public static object Get(Type serviceType)
|
|
{
|
|
return IttyBittyIoC.Resolve(serviceType);
|
|
}
|
|
}
|
|
} |