void AddButton() { Task.Factory.StartNew(() => { Thread.Sleep(5000); ActionButton btn = null; Color color = new Color(rnd.NextDouble(), rnd.NextDouble(), rnd.NextDouble()); btn = new ActionButton() { ButtonColor = color, Color = color.Luminosity < 0.3 ? Color.White : Color.Black, Size = i % 2 == 0 ? Abstraction.Size.Normal : Abstraction.Size.Mini, Clicked = (obj, evt) => { if (btn?.Rotation == 0) { btn?.RotateTo(315, 500, Easing.SpringOut); } else { btn?.RotateTo(0, 500, Easing.SpringOut); } }, Content = new FontAwesomeIcon() { Icon = FAIcons.FACheck } }; Menu.Contents.Add(btn); if (i++ < 2) { AddButton(); } }); }