private void OnSubmit(RecipeViewModelState model) { var command = new SubmitRecipe { Id = new RecipeId(model.RecipeId) }; Bus.Send(command, () => { model.RecipeStatus = RecipeStatus.Submitted; }); }
private void OnReload(object obj) { Recipes.Clear(); var provider = ProviderFactory.CreateRecipeProvider(); foreach(var recipe in provider.GetByName(100)) { var state = new RecipeViewModelState(); state.SubmitCommand = new DelegateCommand<RecipeViewModelState>(z => OnSubmit(state), state, x => x.CanSubmit); state.Initialize(recipe); Recipes.Add(state); } }
public RecipeViewModel(IRecipeView view, Action<RecipeViewModelState> continuation, Action<RecipeViewModelState> onSubmit) { this.continuation = continuation; View = view; State = new RecipeViewModelState { CancelCommand = new DelegateCommand(obj => view.Close()), SaveCommand = new DelegateCommand(obj => OnSave()), }; State.SubmitCommand = new DelegateCommand<RecipeViewModelState>(obj => onSubmit(State), State, x => x.CanSubmit); view.SetContext(State); view.FocusTitle(); }
public RecipeViewModel(IRecipeView view, Action <RecipeViewModelState> continuation, Action <RecipeViewModelState> onSubmit) { this.continuation = continuation; View = view; State = new RecipeViewModelState { CancelCommand = new DelegateCommand(obj => view.Close()), SaveCommand = new DelegateCommand(obj => OnSave()), }; State.SubmitCommand = new DelegateCommand <RecipeViewModelState>(obj => onSubmit(State), State, x => x.CanSubmit); view.SetContext(State); view.FocusTitle(); }
private void OnReload(object obj) { Recipes.Clear(); var provider = ProviderFactory.CreateRecipeProvider(); foreach (var recipe in provider.GetByName(100)) { var state = new RecipeViewModelState(); state.SubmitCommand = new DelegateCommand <RecipeViewModelState>(z => OnSubmit(state), state, x => x.CanSubmit); state.Initialize(recipe); Recipes.Add(state); } }