示例#1
0
        private async void btnAmount_Click(object sender, RoutedEventArgs e)
        {
            OutcomeOverviewViewModel viewModel = (OutcomeOverviewViewModel)((Button)sender).DataContext;

            OutcomeAmount dialog = new OutcomeAmount(queryDispatcher);

            dialog.Value    = viewModel.Amount.Value;
            dialog.Currency = viewModel.Amount.Currency;

            ContentDialogResult result = await dialog.ShowAsync(true);

            decimal newValue = dialog.Value;

            if (result == ContentDialogResult.Primary && newValue != viewModel.Amount.Value)
            {
                Price newAmount = new Price(newValue, dialog.Currency);
                await commandDispatcher.HandleAsync(new ChangeOutcomeAmount(viewModel.Key, newAmount));
            }
        }
示例#2
0
        private async void btnAmount_Click(object sender, RoutedEventArgs e)
        {
            OutcomeOverviewViewModel viewModel = (OutcomeOverviewViewModel)((Button)sender).DataContext;

            OutcomeAmount dialog = new OutcomeAmount();

            dialog.Value = (double)viewModel.Amount.Value;

            ContentDialogResult result = await dialog.ShowAsync();

            decimal newValue = (decimal)dialog.Value;

            if (result == ContentDialogResult.Primary && newValue != viewModel.Amount.Value)
            {
                Price newAmount = new Price(newValue, viewModel.Amount.Currency);
                await domainFacade.ChangeOutcomeAmount(viewModel.Key, newAmount);

                viewModel.Amount = newAmount;
            }
        }