예제 #1
0
        public ItemDetailPageViewModel(IProductCatalogRepository productCatalogRepository, IShoppingCartRepository shoppingCartRepository, IAlertMessageService alertMessageService, IResourceLoader resourceLoader, ISecondaryTileService secondaryTileService)
        {
            _productCatalogRepository = productCatalogRepository;
            _shoppingCartRepository   = shoppingCartRepository;
            _alertService             = alertMessageService;
            _resourceLoader           = resourceLoader;
            _secondaryTileService     = secondaryTileService;

            PinProductCommand   = new DelegateCommand(async() => await PinProduct(), () => SelectedProduct != null);
            UnpinProductCommand = new DelegateCommand(async() => await UnpinProduct(), () => SelectedProduct != null);
        }
        public ItemDetailPageViewModel(IProductCatalogRepository productCatalogRepository, IShoppingCartRepository shoppingCartRepository, IAlertMessageService alertMessageService, IResourceLoader resourceLoader, ISecondaryTileService secondaryTileService)
        {
            _productCatalogRepository = productCatalogRepository;
            _shoppingCartRepository = shoppingCartRepository;
            _alertService = alertMessageService;
            _resourceLoader = resourceLoader;
            _secondaryTileService = secondaryTileService;

            PinProductCommand = DelegateCommand.FromAsyncHandler(PinProduct, () => SelectedProduct != null);
            UnpinProductCommand = DelegateCommand.FromAsyncHandler(UnpinProduct, () => SelectedProduct != null);
        }
예제 #3
0
 public ViewCardViewModel([NotNull] INavigationService navigation, [NotNull] BaseCardProvider cardProvider,
     [NotNull] ISecondaryTileService secondaryTileService,
     [NotNull] StatisticsService statistics, From from, int id)
 {
     if (navigation == null) throw new ArgumentNullException("navigation");
     if (cardProvider == null) throw new ArgumentNullException("cardProvider");
     if (secondaryTileService == null) throw new ArgumentNullException("secondaryTileService");
     if (statistics == null) throw new ArgumentNullException("statistics");
     _navigation = navigation;
     _secondaryTileService = secondaryTileService;
     _statistics = statistics;
     Card = cardProvider.GetById(id).ToViewModel();
     _statistics.PublishViewCardPageLoaded(from == From.Tile);
 }
예제 #4
0
 public EditCardViewModel([NotNull] INavigationService navigation, [NotNull] BaseCardProvider cardProvider,
     [NotNull] ISecondaryTileService secondaryTileService,
     [NotNull] StatisticsService statistics,
     [NotNull] IUiStringsProvider stringsProvider, int id)
 {
     if (navigation == null) throw new ArgumentNullException("navigation");
     if (cardProvider == null) throw new ArgumentNullException("cardProvider");
     if (secondaryTileService == null) throw new ArgumentNullException("secondaryTileService");
     if (statistics == null) throw new ArgumentNullException("statistics");
     if (stringsProvider == null) throw new ArgumentNullException("stringsProvider");
     _navigation = navigation;
     _cardProvider = cardProvider;
     _secondaryTileService = secondaryTileService;
     _statistics = statistics;
     _stringsProvider = stringsProvider;
     Card = _cardProvider.GetById(id).ToViewModel();
     _statistics.PublishEditPageLoaded();
 }