示例#1
0
        async Task UpdatePlant(object sender, Plant plant)
        {
            if (IsBusy)
            {
                return;
            }

            IsBusy = true;

            if (plant != null)
            {
                await App.PlantService.UpdatePlantAsync(plant.Id, plant);

                var oldPlant = Plants.SingleOrDefault(x => x.Id == plant.Id);
                if (oldPlant != null)
                {
                    Plants.Remove(oldPlant);
                    Plants.Add(plant);
                }
            }

            IsBusy = false;
        }