public ShoppingListPageViewModel(ShoppingFacade shoppingFacade, RetailersFacade retailersManager, INavigationService navigationService)
        {
            ShoppingListCategoryGroups = shoppingFacade.ShoppingList.GroupBy(item => item.Ingredient.Item.Category,
                                                                             (cat, list) => new ShoppingListCategoryGroup(cat, list),
                                                                             new IngredientItemCategoryEqualityComparer());

            PriceShoppingListCommand = new DelegateCommand(() =>
            {
                navigationService.Navigate(PageTokens.Pricing.ToString(), null);
            });
        }
示例#2
0
        public PricingPageViewModel(ShoppingFacade shoppingFacade, RetailersFacade retailersFacade, INavigationService navigationService)
        {
            RetailerShoppingSessionInfos = new ObservableCollection <RetailerShoppingSessionInfo>();

            foreach (var store in retailersFacade.UserStoresContainer)
            {
                RetailerShoppingSessionInfos.Add(new RetailerShoppingSessionInfo(
                                                     store.Retailer.Shopper.CreateRetailerShoppingSession(store), shoppingFacade.ShoppingList));
            }

            GoToOnlineShoppingCartCommand = new DelegateCommand <RetailerShoppingSessionInfo>(sessionInfo =>
            {
                navigationService.Navigate(PageTokens.OnlineCart.ToString(), sessionInfo);
            });
        }
        public AddStorePageViewModel(RetailersFacade retailersFacade)
        {
            _RetailersFacade = retailersFacade;

            SearchResults     = new ObservableCollection <IStore>();
            SuggestionResults = new ObservableCollection <IStore>();

            AddUserStoreCommand = new DelegateCommand(() =>
            {
                if (SelectedStore != null)
                {
                    retailersFacade.UserStoresContainer.Add(SelectedStore);
                }
            }, () => { return(SelectedStore != null); }).ObservesProperty(() => SelectedStore);
        }
示例#4
0
        public StoresPageViewModel(INavigationService navigationService, RetailersFacade retailersFacade)
        {
            _RetailersFacade = retailersFacade;
            UserStores       = _RetailersFacade.UserStoresContainer;

            AddStoreCommand = new DelegateCommand(() =>
            {
                navigationService.Navigate(PageTokens.AddStore.ToString(), null);
            });

            DeleteStoreCommand = new DelegateCommand(() =>
            {
                retailersFacade.UserStoresContainer.Remove(SelectedStore);
            }, () => { return(SelectedStore != null); }).ObservesProperty(() => SelectedStore);

            NavigateToStoreCommand = new DelegateCommand(async() =>
            {
                Uri uri = new Uri($@"ms-drive-to:?destination.latitude={SelectedStore.Latitude}&destination.longitude={SelectedStore.Longitude}&destination.name={SelectedStore.Retailer.Name}");
                await Windows.System.Launcher.LaunchUriAsync(uri);
            }, () => { return(SelectedStore != null); }).ObservesProperty(() => SelectedStore);
        }