protected async void OnNewItemClicked(object sender, EventArgs e)
        {
            var action = await DisplayActionSheet("New Item Type", "Cancel", null, "Deposit", "Withdrawal");

            switch (action)
            {
            case "Deposit":
                var depositVM = await(this.BindingContext as BankAccountViewModel).AddDepositAsync();
                (this.BindingContext as BankAccountViewModel).SelectedRegisterItem = depositVM;
                if (depositVM != null)
                {
                    CheckingDepositEdit depositViewer = new CheckingDepositEdit();
                    depositViewer.BindingContext = depositVM as CheckingDepositViewModel;
                    await Navigation.PushModalAsync(depositViewer);
                }
                break;

            case "Withdrawal":
                var withdrawalVM = await(this.BindingContext as BankAccountViewModel).AddWithdrawalAsync();
                (this.BindingContext as BankAccountViewModel).SelectedRegisterItem = withdrawalVM;
                if (withdrawalVM != null)
                {
                    CheckingWithdrawalEdit withdrawalViewer = new CheckingWithdrawalEdit();
                    withdrawalViewer.BindingContext = withdrawalVM as CheckingWithdrawalViewModel;
                    await Navigation.PushModalAsync(withdrawalViewer);
                }
                break;
            }
        }
Exemple #2
0
        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;
            }
        }
        protected async void OnDepositEditTapped(object sender, TappedEventArgs e)
        {
            CheckingDepositEdit editor = new CheckingDepositEdit();
            await vm.LoadBudgetData();

            editor.BindingContext = vm;
            await Navigation.PushAsync(editor);
        }
Exemple #4
0
        public async void btnNewDeposit_Clicked(object sender, EventArgs eventArgs)
        {
            if (vm == null)
            {
                vm = this.BindingContext as BankAccountViewModel;
            }
            var depositVM = await vm.AddDepositAsync();

            vm.SelectedRegisterItem = depositVM;
            if (depositVM != null)
            {
                CheckingDepositEdit depositViewer = new CheckingDepositEdit();
                depositViewer.BindingContext = depositVM as CheckingDepositViewModel;
                await Navigation.PushAsync(depositViewer);
            }
        }