2011-01-02 22:27:28 +00:00
|
|
|
|
using System;
|
|
|
|
|
using Android.Content;
|
2011-01-03 02:00:10 +00:00
|
|
|
|
using MonoStockPortfolio.Core.Config;
|
2011-01-02 22:27:28 +00:00
|
|
|
|
using MonoStockPortfolio.Core.PortfolioRepositories;
|
|
|
|
|
using MonoStockPortfolio.Core.Services;
|
|
|
|
|
using MonoStockPortfolio.Core.StockData;
|
2011-03-06 15:21:31 +00:00
|
|
|
|
using MonoStockPortfolio.Presenters;
|
2011-01-02 22:27:28 +00:00
|
|
|
|
|
|
|
|
|
namespace MonoStockPortfolio.Framework
|
|
|
|
|
{
|
|
|
|
|
public static class ServiceLocator
|
|
|
|
|
{
|
|
|
|
|
public static Context Context { get; set; }
|
|
|
|
|
|
2011-02-06 01:48:55 +00:00
|
|
|
|
static ServiceLocator()
|
2011-01-02 22:27:28 +00:00
|
|
|
|
{
|
2011-03-06 15:21:31 +00:00
|
|
|
|
IttyBittyIoC.Register<IMainPresenter>(() => new MainPresenter(new AndroidSqlitePortfolioRepository(Context)));
|
2011-02-17 01:26:22 +00:00
|
|
|
|
IttyBittyIoC.Register<IStockDataProvider>(() => new YahooStockDataProvider());
|
2011-02-26 15:13:52 +00:00
|
|
|
|
IttyBittyIoC.Register<IPortfolioService>(() => new PortfolioService(new AndroidSqlitePortfolioRepository(Context), new YahooStockDataProvider()));
|
2011-02-06 01:48:55 +00:00
|
|
|
|
IttyBittyIoC.Register<IPortfolioRepository>(() => new AndroidSqlitePortfolioRepository(Context));
|
|
|
|
|
IttyBittyIoC.Register<IConfigRepository>(() => new AndroidSqliteConfigRepository(Context));
|
2011-01-02 22:27:28 +00:00
|
|
|
|
}
|
|
|
|
|
|
2011-02-06 01:48:55 +00:00
|
|
|
|
public static object Get(Type serviceType)
|
2011-01-02 22:27:28 +00:00
|
|
|
|
{
|
2011-02-06 01:48:55 +00:00
|
|
|
|
return IttyBittyIoC.Resolve(serviceType);
|
2011-01-02 22:27:28 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|