protected async void OnItemEdit(object sender, EventArgs e) { var btn = sender as MenuItem; var regItem = btn.BindingContext as AccountRegisterItemViewModel; (this.BindingContext as BankAccountViewModel).SelectedRegisterItem = regItem; switch (regItem.ItemType) { case AccountRegisterItemViewModel.AccountItemType.Deposits: CheckingDepositEdit depEditor = new CheckingDepositEdit(); CheckingDepositViewModel _vmDep = regItem as CheckingDepositViewModel; await _vmDep.LoadBudgetData(); depEditor.BindingContext = _vmDep; await Navigation.PushAsync(depEditor); break; case AccountRegisterItemViewModel.AccountItemType.Withdrawals: CheckingWithdrawalEdit witEditor = new CheckingWithdrawalEdit(); CheckingWithdrawalViewModel _vmWithdrawal = regItem as CheckingWithdrawalViewModel; await _vmWithdrawal.LoadBudgetData(); witEditor.BindingContext = _vmWithdrawal; await Navigation.PushAsync(witEditor); break; } }
public async void OnItemTapped(object sender, ItemTappedEventArgs e) { var itemVM = e.Item as AccountRegisterItemViewModel; vm.SelectedRegisterItem = itemVM; switch (itemVM.ItemType) { case AccountRegisterItemViewModel.AccountItemType.Deposits: CheckingDepositView depositViewer = new CheckingDepositView(); CheckingDepositViewModel _vmDep = itemVM as CheckingDepositViewModel; await _vmDep.LoadBudgetData(); depositViewer.BindingContext = _vmDep; await Navigation.PushAsync(depositViewer); break; case AccountRegisterItemViewModel.AccountItemType.Withdrawals: CheckingWithdrawalView withdrawalViewer = new CheckingWithdrawalView(); CheckingWithdrawalViewModel _vmWithdrawal = itemVM as CheckingWithdrawalViewModel; await _vmWithdrawal.LoadBudgetData(); withdrawalViewer.BindingContext = _vmWithdrawal; await Navigation.PushAsync(withdrawalViewer); break; } }
protected async void OnWithdrawalEditTapped(object sender, TappedEventArgs e) { CheckingWithdrawalEdit editor = new CheckingWithdrawalEdit(); await vm.LoadBudgetData(); editor.BindingContext = vm; await Navigation.PushAsync(editor); }