public ShoppingCartPageViewModel(IShoppingCartRepository shoppingCartRepository,
INavigationService navigationService,
IAccountService accountService,
ISignInUserControlViewModel signInUserControlViewModel,
IResourceLoader resourceLoader,
IAlertMessageService alertMessageService,
ICheckoutDataRepository checkoutDataRepository,
IOrderRepository orderRepository,
IEventAggregator eventAggregator)
{
_shoppingCartRepository = shoppingCartRepository;
_navigationService = navigationService;
_accountService = accountService;
_signInUserControlViewModel = signInUserControlViewModel;
_resourceLoader = resourceLoader;
_alertMessageService = alertMessageService;
_checkoutDataRepository = checkoutDataRepository;
_orderRepository = orderRepository;
CheckoutCommand = DelegateCommand.FromAsyncHandler(CheckoutAsync, CanCheckout);
RemoveCommand = DelegateCommand<ShoppingCartItemViewModel>.FromAsyncHandler(Remove);
IncrementCountCommand = DelegateCommand.FromAsyncHandler(IncrementCount);
DecrementCountCommand = DelegateCommand.FromAsyncHandler(DecrementCount, CanDecrementCount);
// Subscribe to the ShoppingCartUpdated event
if (eventAggregator != null)
{
eventAggregator.GetEvent<ShoppingCartUpdatedEvent>().Subscribe(UpdateShoppingCartAsync);
}
}