| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273 | using System;using System.Collections.Generic;using System.Threading;using System.Threading.Tasks;using Xamarin.Forms;namespace comal.timesheets{    public partial class ToolEntry : Grid    {        public static readonly BindableProperty TextProperty = BindableProperty.Create(nameof(Text), typeof(string), typeof(ToolEntry), "");        public string Text        {            get { return (string)GetValue(TextProperty); }            set { SetValue(TextProperty, value); }        }        public static readonly BindableProperty ImageProperty = BindableProperty.Create(nameof(Image), typeof(ImageSource), typeof(ToolEntry), null);        public ImageSource Image        {            get { return (ImageSource)GetValue(ImageProperty); }            set { SetValue(ImageProperty, value); }        }                public static readonly BindableProperty IndicatorProperty = BindableProperty.Create(nameof(Indicator), typeof(string), typeof(ToolEntry), null);        public string Indicator        {            get { return (string)GetValue(IndicatorProperty); }            set            {                SetValue(IndicatorProperty, value);                UpdateIndicator();            }        }                public int ID { get; set; }        public event EventHandler Tapped;        public ToolEntry()        {            InitializeComponent();        }        private void UpdateIndicator()        {            if (!String.IsNullOrWhiteSpace(Indicator))            {                indicatorLbl.Text = Indicator;                indicatorFrame.IsVisible = true;                Task.Run(() =>                {                    Thread.Sleep(1000);                    Device.BeginInvokeOnMainThread(() =>                    {                        indicatorFrame.TranslateTo(0, -10, 250);                        indicatorFrame.TranslateTo(0, 0, 250);                    });                });            }            else                indicatorFrame.IsVisible = false;        }                async void ImageTapped(System.Object sender, System.EventArgs e)        {            await toolFrame.TranslateTo(0, -15, 150);            await toolFrame.TranslateTo(0, 0, 150);            Tapped?.Invoke(this, new EventArgs());        }    }}
 |