private async void OpenItem(MenuItemModel item) { if (item == null) return; using (var vm = GetViewModel<ItemViewModel>()) { vm.DisplayName = item.Name; vm.Id = item.Id; await vm.ShowAsync(); _toastPresenter.ShowAsync("Closed " + vm.DisplayName, ToastDuration.Short); } }
public MainViewModel(IToastPresenter toastPresenter) { Should.NotBeNull(toastPresenter, "toastPresenter"); _toastPresenter = toastPresenter; var items = new List<MenuItemModel>(); for (var i = 0; i < 10; i++) { var item = new MenuItemModel(); item.Id = i; item.Name = "Item " + i; items.Add(item); } Items = items; OpenItemCommand = new RelayCommand<MenuItemModel>(OpenItem); }