public ShoppingCartTabUserControlViewModel(IShoppingCartRepository shoppingCartRepository, IEventAggregator eventAggregator, IAlertMessageService alertMessageService, IResourceLoader resourceLoader, IAccountService accountService)
{
// ItemCount will be set using async method call.
_itemCount = 0;
_shoppingCartRepository = shoppingCartRepository;
_alertMessageService = alertMessageService;
_resourceLoader = resourceLoader;
_accountService = accountService;
if (eventAggregator != null)
{
// Documentation on loosely coupled communication is at http://go.microsoft.com/fwlink/?LinkID=288820&clcid=0x409
eventAggregator.GetEvent<ShoppingCartUpdatedEvent>().Subscribe(UpdateItemCountAsync);
eventAggregator.GetEvent<ShoppingCartItemUpdatedEvent>().Subscribe(UpdateItemCountAsync);
}
// Start process of updating item count.
UpdateItemCountAsync(null);
}