コード例 #1
0
        public async Task <AccountRegisterItemViewModel> AddWithdrawalAsync()
        {
            AccountRegisterItemViewModel vm = null;

            switch (this.AccountType)
            {
            case BankAccountType.Checking:
                vm = await AddCheckingWithdrawalAsync();

                (vm as CheckingWithdrawalViewModel).ItemUpdated += OnRegisterUpdated;
                break;

            case BankAccountType.Savings:
                vm = await AddSavingsWithdrawalAsync();

                (vm as SavingsWithdrawalViewModel).ItemUpdated += OnRegisterUpdated;
                break;
            }

            this.AccountRegister.Add(vm);
            await GroupAccountItemsAsync();

            this.SelectedRegisterItem = vm;

            return(vm);
        }
コード例 #2
0
        public async Task <bool> DeleteRegisterItemAsync(AccountRegisterItemViewModel vm)
        {
            bool _deleted = false;

            switch (vm.ItemType)
            {
            case AccountRegisterItemViewModel.AccountItemType.Deposits:
                switch (this.AccountType)
                {
                case BankAccountType.Checking:
                    _deleted = await(vm as CheckingDepositViewModel).DeleteAsync();
                    (vm as CheckingDepositViewModel).ItemUpdated -= OnRegisterUpdated;
                    break;

                case BankAccountType.Savings:
                    _deleted = await(vm as SavingsDepositViewModel).DeleteAsync();
                    (vm as SavingsDepositViewModel).ItemUpdated -= OnRegisterUpdated;
                    break;
                }
                break;

            case AccountRegisterItemViewModel.AccountItemType.Withdrawals:
                switch (this.AccountType)
                {
                case BankAccountType.Checking:
                    _deleted = await(vm as CheckingWithdrawalViewModel).DeleteAsync();
                    (vm as CheckingWithdrawalViewModel).ItemUpdated -= OnRegisterUpdated;
                    break;

                case BankAccountType.Savings:
                    _deleted = await(vm as SavingsWithdrawalViewModel).DeleteAsync();
                    (vm as SavingsWithdrawalViewModel).ItemUpdated -= OnRegisterUpdated;
                    break;
                }
                break;
            }

            if (_deleted && this.AccountRegister.Contains(vm, new AccountRegisterItemViewModelComparer()))
            {
                this.AccountRegister.Remove(vm);
                GroupAccountItems();
            }

            return(_deleted);
        }