public MenuViewModel(INavigationService navigationService, IEventAggregator eventAggregator, ISessionStateService sessionStateService, RecipesFacade recipesFacade) { _navigationService = navigationService; _sessionStateService = sessionStateService; _recipesFacade = recipesFacade; eventAggregator.GetEvent <NavigationStateChangedEvent>().Subscribe(OnNavigationStateChanged); MenuItems = new ObservableCollection <MenuViewItem>(new[] { new MenuViewItem("Recettes", "\ued56", PageTokens.Recipes), new MenuViewItem("Sélection", "\uf0e3", PageTokens.SelectedRecipes), new MenuViewItem("Liste des courses", "\ue7bf", PageTokens.ShoppingList), new MenuViewItem("Favories", "\ue113", PageTokens.FavoriteRecipes), new MenuViewItem("Drives", "\uec47", PageTokens.Stores) }); SettingsMenuItem = new MenuViewItem("Paramètres", "\ue713", PageTokens.Settings); UpdateSelectedRecipesMenuItemTitle(); UpdateFavoritesMenuItemTitle(); _recipesFacade.SelectedRecipesContainer.CollectionChanged += OnSelectedRecipesContainerChanged; _recipesFacade.FavoriteRecipesContainer.CollectionChanged += OnFavoriteRecipesContainerChanged; }
public RecipeListViewModel(RecipesFacade recipesFacade, ICommandFactory commandFactory, INavigationService navigationService) { this.recipesFacade = recipesFacade; this.navigationService = navigationService; NavigateToDetailCommand = commandFactory.CreateCommand <Guid>(NavigateToDetail); NavigateToAddCommand = commandFactory.CreateCommand(NavigateToAdd); }
public ShoppingFacade(RecipesFacade recipesFacade) { _RecipesFacade = recipesFacade; ShoppingList = new ShoppingList(); UpdateShoppingList(); _RecipesFacade.SelectedRecipesContainer.IngredientsAggregator.IngredientsContainer.CollectionChanged += OnSelectedRecipesIngredientsAggregatorCollectionChanged; }
public RecipeDetailViewModel(Guid viewModelParameter, RecipesFacade recipesFacade, ICommandFactory commandFactory, INavigationService navigationService) : base(viewModelParameter) { this.recipesFacade = recipesFacade; this.commandFactory = commandFactory; this.navigationService = navigationService; DeleteCommand = commandFactory.CreateCommand(Delete); NavigateToEditCommand = commandFactory.CreateCommand(NavigateToEdit); }
public SelectedRecipesPageViewModel(INavigationService navigationService, RecipesFacade recipesFacade) { Recipes = recipesFacade.SelectedRecipesContainer; GoToRecipeDetailsCommand = new DelegateCommand(() => { navigationService.Navigate(PageTokens.RecipeDetails.ToString(), SelectedRecipe.Id); }, () => { return(SelectedRecipe != null); }).ObservesProperty(() => SelectedRecipe); DeleteRecipeCommand = new DelegateCommand(() => { recipesFacade.SelectedRecipesContainer.Remove(SelectedRecipe); }, () => { return(SelectedRecipe != null); }).ObservesProperty(() => SelectedRecipe); }
public RecipeEditViewModel(Guid?viewModelParameter, RecipesFacade recipesFacade, IngredientsFacade ingredientsFacade, ICommandFactory commandFactory, INavigationService navigationService) : base(viewModelParameter) { this.recipesFacade = recipesFacade; this.ingredientsFacade = ingredientsFacade; this.navigationService = navigationService; AddIngredientCommand = commandFactory.CreateCommand(AddIngredient); RemoveIngredientCommand = commandFactory.CreateCommand <Guid>(RemoveIngredient); SaveCommand = commandFactory.CreateCommand(Save); CancelCommand = commandFactory.CreateCommand(Cancel); }
protected override void ConfigureContainer() { base.ConfigureContainer(); RetailersProvider retailersProvider = new RetailersProvider(); retailersProvider.Retailers.Add(new Retailers.Intermarche.Retailer(new Retailers.Intermarche.Uwp.RetailerSettings())); retailersProvider.Retailers.Add(new Retailers.Carrefour.Retailer(new Retailers.Carrefour.Uwp.RetailerSettings())); Container.RegisterInstance <IRetailersProvider>(retailersProvider); Container.RegisterType <RetailersFacade>(new ContainerControlledLifetimeManager()); RecipesFacade recipesFacade = new RecipesFacade(new RecipesJsonProvider(), new LocalStorageReaderWriter("favoriteRecipes")); Container.RegisterInstance(recipesFacade); Container.RegisterType <ShoppingFacade>(new ContainerControlledLifetimeManager()); }
public RecipesPageViewModel(RecipesFacade recipesFacade, INavigationService navigationService) { _RecipesFacade = recipesFacade; Recipes = new ObservableCollection <Recipe>(); GoToRecipeDetailsCommand = new DelegateCommand(() => { navigationService.Navigate(PageTokens.RecipeDetails.ToString(), SelectedRecipe.Id); }, () => { return(SelectedRecipe != null); }).ObservesProperty(() => SelectedRecipe); AddToSelectionCommand = new DelegateCommand(() => { recipesFacade.SelectedRecipesContainer.Add(SelectedRecipe); }, () => { return(SelectedRecipe != null); }).ObservesProperty(() => SelectedRecipe); AddToFavoritesCommand = new DelegateCommand(() => { recipesFacade.FavoriteRecipesContainer.Add(SelectedRecipe); }, () => { return(SelectedRecipe != null); }).ObservesProperty(() => SelectedRecipe); }
public RecipeDetailsPageViewModel(RecipesFacade recipesFacade) { _RecipesFacade = recipesFacade; }