public AddEntityPage(EntityListViewModel entityListViewModel) { InitializeComponent(); _entityListViewModel = entityListViewModel; var vm = new AddEntityViewModel(); vm.ItemAdded += _entityListViewModel.OnNewItemAdded; vm.ItemSaved += OnBtnClicked; vm.ItemCanceled += OnBtnClicked; vm.ItemDeleted += OnBtnClicked; BindingContext = vm; }
public EditEntityViewPage(Guid id, EntityListViewModel entityListViewModel) { _entityListViewModel = entityListViewModel; InitializeComponent(); var vm = new AddEntityViewModel(id, DependencyService.Get<IEntityService>()); vm.ItemDeleted += OnBtnClicked; vm.ItemEdited += _entityListViewModel.OnItemEdited; vm.ItemSaved += OnBtnClicked; vm.ItemCanceled += OnBtnClicked; vm.WhatItemDeleted += _entityListViewModel.Delete; BindingContext = vm; }