コード例 #1
0
        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)
                {
                    SavingsDepositEdit depositViewer = new SavingsDepositEdit();
                    depositViewer.BindingContext = depositVM as SavingsDepositViewModel;
                    await Navigation.PushModalAsync(depositViewer);
                }
                break;

            case "Withdrawal":
                var withdrawalVM = await(this.BindingContext as BankAccountViewModel).AddWithdrawalAsync();
                (this.BindingContext as BankAccountViewModel).SelectedRegisterItem = withdrawalVM;
                if (withdrawalVM != null)
                {
                    SavingsWithdrawalEdit withdrawalViewer = new SavingsWithdrawalEdit();
                    withdrawalViewer.BindingContext = withdrawalVM as SavingsWithdrawalViewModel;
                    await Navigation.PushModalAsync(withdrawalViewer);
                }
                break;
            }
        }
コード例 #2
0
        protected async void OnItemEdit(object sender, EventArgs e)
        {
            var btn     = sender as MenuItem;
            var regItem = btn.BindingContext as AccountRegisterItemViewModel;

            vm.SelectedRegisterItem = regItem;
            switch (regItem.ItemType)
            {
            case AccountRegisterItemViewModel.AccountItemType.Deposits:
                SavingsDepositEdit      depEditor = new SavingsDepositEdit();
                SavingsDepositViewModel _vmDep    = regItem as SavingsDepositViewModel;
                await _vmDep.LoadBudgetData();

                depEditor.BindingContext = _vmDep;
                await Navigation.PushAsync(depEditor);

                break;

            case AccountRegisterItemViewModel.AccountItemType.Withdrawals:
                SavingsWithdrawalEdit      witEditor     = new SavingsWithdrawalEdit();
                SavingsWithdrawalViewModel _vmWithdrawal = regItem as SavingsWithdrawalViewModel;
                await _vmWithdrawal.LoadBudgetData();

                witEditor.BindingContext = _vmWithdrawal;
                await Navigation.PushAsync(witEditor);

                break;
            }
        }
コード例 #3
0
        protected async void OnWithdrawalEditTapped(object sender, TappedEventArgs e)
        {
            SavingsWithdrawalEdit editor = new SavingsWithdrawalEdit();
            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 SavingsWithdrawalViewModel;
            await _vmWithdrawal.LoadBudgetData();

            vm.SelectedRegisterItem = _vmWithdrawal;
            if (withdrawalVM != null)
            {
                SavingsWithdrawalEdit withdrawalViewer = new SavingsWithdrawalEdit();
                withdrawalViewer.BindingContext = _vmWithdrawal;
                await Navigation.PushAsync(withdrawalViewer);
            }
        }
コード例 #5
0
        public async void OnItemTapped(object sender, ItemTappedEventArgs e)
        {
            var itemVM = e.Item as AccountRegisterItemViewModel;

            (this.BindingContext as BankAccountViewModel).SelectedRegisterItem = itemVM;
            switch (itemVM.ItemType)
            {
            case AccountRegisterItemViewModel.AccountItemType.Deposits:
                SavingsDepositEdit depositViewer = new SavingsDepositEdit();
                depositViewer.BindingContext = itemVM as SavingsDepositViewModel;
                await Navigation.PushModalAsync(depositViewer);

                break;

            case AccountRegisterItemViewModel.AccountItemType.Withdrawals:
                SavingsWithdrawalEdit withdrawalViewer = new SavingsWithdrawalEdit();
                withdrawalViewer.BindingContext = itemVM as SavingsWithdrawalViewModel;
                await Navigation.PushModalAsync(withdrawalViewer);

                break;
            }
        }
コード例 #6
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:
                SavingsDepositEdit depEditor = new SavingsDepositEdit();
                depEditor.BindingContext = regItem as SavingsDepositViewModel;
                await Navigation.PushModalAsync(depEditor);

                break;

            case AccountRegisterItemViewModel.AccountItemType.Withdrawals:
                SavingsWithdrawalEdit witEditor = new SavingsWithdrawalEdit();
                witEditor.BindingContext = regItem as SavingsWithdrawalViewModel;
                await Navigation.PushModalAsync(witEditor);

                break;
            }
        }