protected async override void OnCreate(Bundle bundle) { base.OnCreate(bundle); // Set our view from the "main" layout resource SetContentView(Resource.Layout.Main); accelerometerManager = new AccelerometerManager(this, this); buttonPuppy = FindViewById <Button>(Resource.Id.button_puppy); buttonPuppy.Click += async(sender, args) => { state.CurrentTask = LoadImage(OverflowHelper.Animal.Dog); await state.CurrentTask; }; buttonKitty = FindViewById <Button>(Resource.Id.button_kitty); buttonKitty.Click += async(sender, args) => await LoadImage(OverflowHelper.Animal.Cat); progressBar = FindViewById <ProgressBar>(Resource.Id.progressbar); imageView = FindViewById <ImageView>(Resource.Id.imageview_animal); imageViewAnimated = FindViewById <AnimatedImageView>(Resource.Id.imageview_animal_animated); progressBar.Visibility = ViewStates.Invisible; imageView.Visibility = ViewStates.Gone; imageViewAnimated.Visibility = ViewStates.Gone; state = LastNonConfigurationInstance as PuppyKittyState; if (state != null) { if (state.CurrentTask == null || state.CurrentTask.IsCompleted) { await SetImage(); } } else { state = new PuppyKittyState(); state.SetDefault = true; } }
protected async override void OnCreate(Bundle bundle) { base.OnCreate(bundle); // Set our view from the "main" layout resource SetContentView(Resource.Layout.Main); accelerometerManager = new AccelerometerManager(this, this); buttonPuppy = FindViewById<Button>(Resource.Id.button_puppy); buttonPuppy.Click += async (sender, args) => { state.CurrentTask = LoadImage(OverflowHelper.Animal.Dog); await state.CurrentTask; }; buttonKitty = FindViewById<Button>(Resource.Id.button_kitty); buttonKitty.Click += async (sender, args) => await LoadImage(OverflowHelper.Animal.Cat); progressBar = FindViewById<ProgressBar>(Resource.Id.progressbar); imageView = FindViewById<ImageView>(Resource.Id.imageview_animal); imageViewAnimated = FindViewById<AnimatedImageView>(Resource.Id.imageview_animal_animated); progressBar.Visibility = ViewStates.Invisible; imageView.Visibility = ViewStates.Gone; imageViewAnimated.Visibility = ViewStates.Gone; state = LastNonConfigurationInstance as PuppyKittyState; if (state != null) { if (state.CurrentTask == null || state.CurrentTask.IsCompleted) await SetImage(); } else { state = new PuppyKittyState(); state.SetDefault = true; } }