private async Task LoadImage(OverflowHelper.Animal animal) { progressBar.Visibility = ViewStates.Visible; progressBar.Indeterminate = true; imageView.Visibility = ViewStates.Gone; imageViewAnimated.Visibility = ViewStates.Gone; buttonKitty.Enabled = false; buttonPuppy.Enabled = false; state.SetDefault = true; state.Image = animal == OverflowHelper.Animal.Cat ? "cat" : "dog"; var eventType = string.Empty; switch (animal) { case OverflowHelper.Animal.Cat: eventType = "cat"; break; case OverflowHelper.Animal.Dog: eventType = "dog"; break; case OverflowHelper.Animal.Otter: eventType = "otter"; break; } try { var image = await OverflowHelper.GetPictureAsync(animal); if (!string.IsNullOrWhiteSpace(image)) { state.SetDefault = false; state.Image = image; } } catch (Exception) { } await SetImage(); progressBar.Visibility = ViewStates.Invisible; progressBar.Indeterminate = false; buttonKitty.Enabled = true; buttonPuppy.Enabled = true; }