コード例 #1
0
        async void Save_Clicked(object sender, EventArgs e)
        {
            try
            {
                RequirementCalc reqCalc = new RequirementCalc();
                //generate the total costs etc before updating the DB
                var total = reqCalc.CalculateRequirements(Item);
                Item.TotalCost = total;
                var response = await _context.SaveJobAsync(Item);

                if (response != default)

                {
                    await DisplayAlert("Success", "Job saved", "OK");

                    await Navigation.PopModalAsync();
                }
                else
                {
                    throw new Exception();
                }
            }
            catch (Exception ex)
            {
                await DisplayAlert("Error", $"{ex}", "OK");
            }
        }
コード例 #2
0
        async void TotalGenerator(object sender, EventArgs e)
        {
            RequirementCalc calc = new RequirementCalc();

            BindingContext = this;
            Item.TotalCost = calc.CalculateRequirements(Item);
            // TotalJobCost.Text = calc.CalculateRequirements(Item);
        }