banking-bot/BankingBot/ActionManagers/AccountManagers/AccountManager.cs
2017-02-10 20:48:11 +00:00

35 lines
1.1 KiB
C#

using BankingBot.Contracts;
using System;
using System.Collections.Generic;
using BankingBot.Models;
using BankingBot.Enums;
using BankingBot.ScriptManagement;
namespace BankingBot.ActionManagers.AccountManagers
{
public class AccountManager : ActionManager, IAccountManager
{
protected IProviderAccountManager providerAccountManager;
private Provider _provider;
public AccountManager(IBrowserBot browserBot)
: base(browserBot)
{ }
public void Init(Provider provider)
{
_provider = provider;
// TODO: Implement DI to get rid of this new() crap
var scriptManager = new ScriptManager(BrowserBot);
var providerAccountManagerType = GetTypeFromInterface(provider, typeof(IProviderAccountManager));
providerAccountManager = (IProviderAccountManager)Activator.CreateInstance(providerAccountManagerType, BrowserBot, scriptManager);
}
public IEnumerable<Account> GetAccounts()
{
return providerAccountManager.GetAccounts();
}
}
}