예제 #1
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 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;
            }
        }
예제 #3
0
        protected async void OnWithdrawalEditTapped(object sender, TappedEventArgs e)
        {
            CheckingWithdrawalEdit editor = new CheckingWithdrawalEdit();
            await vm.LoadBudgetData();

            editor.BindingContext = vm;
            await Navigation.PushAsync(editor);
        }
예제 #4
0
        public async void btnNewWithdrawal_Clicked(object sender, EventArgs eventArgs)
        {
            if (vm == null)
            {
                vm = this.BindingContext as BankAccountViewModel;
            }
            var withdrawalVM = await vm.AddWithdrawalAsync();

            var _vmWithdrawal = withdrawalVM as CheckingWithdrawalViewModel;
            await _vmWithdrawal.LoadBudgetData();

            vm.SelectedRegisterItem = _vmWithdrawal;
            if (_vmWithdrawal != null)
            {
                CheckingWithdrawalEdit withdrawalViewer = new CheckingWithdrawalEdit();
                withdrawalViewer.BindingContext = _vmWithdrawal;
                await Navigation.PushAsync(withdrawalViewer);
            }
        }