2011-01-02 22:27:28 +00:00
|
|
|
|
using System;
|
|
|
|
|
using Android.Content;
|
2011-03-11 02:32:51 +00:00
|
|
|
|
using MonoStockPortfolio.Activites.Main;
|
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;
|
|
|
|
|
|
|
|
|
|
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 18:46:04 +00:00
|
|
|
|
// presenters
|
2011-03-06 15:21:31 +00:00
|
|
|
|
IttyBittyIoC.Register<IMainPresenter>(() => new MainPresenter(new AndroidSqlitePortfolioRepository(Context)));
|
2011-03-06 18:46:04 +00:00
|
|
|
|
|
|
|
|
|
// services/repositories
|
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
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|