Ejemplo n.º 1
0
        private async Task changeBackgroundColor()
        {
            var color = await ColourLoverClient.GetNewRandomColorAsync();

            this.Background.SetColorFilter(new global::Android.Graphics.Color(color.Rgb.Red, color.Rgb.Green, color.Rgb.Blue), PorterDuff.Mode.Multiply);

            //this.SetBackgroundColor (new global::Android.Graphics.Color (color.Rgb.Red, color.Rgb.Green, color.Rgb.Blue));
        }
Ejemplo n.º 2
0
        private async void tapped(UITapGestureRecognizer g)
        {
            UIView.Animate(0.1, 0, UIViewAnimationOptions.Autoreverse, () => this.BackgroundColor = this.BackgroundColor.ColorWithAlpha(0.5f), null);
            _colorData = await ColourLoverClient.GetNewRandomColorAsync();

            this.Layer.RemoveAllAnimations();
            InvokeOnMainThread(() => {
                UIView.Animate(1, () => this.BackgroundColor = UIColor.FromRGB(_colorData.Rgb.Red / 255f, _colorData.Rgb.Green / 255f, _colorData.Rgb.Blue / 255f));
                if (_showTextColor)
                {
                    this.Text = _colorData.Title;
                }
            });
        }