| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121 | using System;using System.Threading.Tasks;using System.Windows.Input;using Xamarin.Forms;namespace InABox.Mobile{        public interface IMobileToolItem    {        string Text { get; set; }        ImageSource Image { get; set; }        string Alert { get; set; }        bool IsEnabled { get; set; }        bool IsVisible { get; set; }        int ID { get; set; }        event EventHandler Clicked;        void DoTap();        int Row { get; set; }        int Column { get; set; }    }        public class MobileToolItem : BindableObject, IMobileToolItem    {                public static readonly BindableProperty TextProperty = BindableProperty.Create(nameof(Text), typeof(string), typeof(MobileToolItem), "");        public string Text        {            get { return (string)GetValue(TextProperty); }            set { SetValue(TextProperty, value); }        }        public static readonly BindableProperty ImageProperty = BindableProperty.Create(nameof(Image), typeof(ImageSource), typeof(MobileToolItem), null);        public ImageSource Image        {            get { return (ImageSource)GetValue(ImageProperty); }            set { SetValue(ImageProperty, value); }        }                public static readonly BindableProperty AlertProperty = BindableProperty.Create(            nameof(Alert),             typeof(string),             typeof(MobileToolItem),             null);        public string Alert        {            get { return (string)GetValue(AlertProperty); }            set {                 SetValue(AlertProperty, value);                OnPropertyChanged(nameof(AlertVisible));            }        }        public bool AlertVisible => !String.IsNullOrWhiteSpace(Alert);        public static readonly BindableProperty BackgroundColorProperty = BindableProperty.Create(            nameof(BackgroundColor),            typeof(Color),            typeof(MobileToolItem),            Color.White);        public Color BackgroundColor        {            get => (Color)GetValue(BackgroundColorProperty);            set => SetValue(BackgroundColorProperty, value);        }        public static readonly BindableProperty TextColorProperty = BindableProperty.Create(            nameof(TextColor),            typeof(Color),            typeof(MobileToolItem),            Color.Black);        public Color TextColor        {            get => (Color)GetValue(TextColorProperty);            set => SetValue(TextColorProperty, value);        }                        public static readonly BindableProperty IsEnabledProperty = BindableProperty.Create(nameof(IsEnabled), typeof(bool), typeof(MobileToolItem), true);        public bool IsEnabled        {            get { return (bool)GetValue(IsEnabledProperty); }            set { SetValue(IsEnabledProperty, value); }        }                                        public static readonly BindableProperty IsVisibleProperty = BindableProperty.Create(nameof(IsVisible), typeof(bool), typeof(MobileToolItem), true);        public bool IsVisible        {            get { return (bool)GetValue(IsVisibleProperty); }            set { SetValue(IsVisibleProperty, value); }        }                                                public static readonly BindableProperty RowProperty = BindableProperty.Create(nameof(Row), typeof(Int32), typeof(MobileToolItem));        public Int32 Row        {            get { return (Int32)GetValue(RowProperty); }            set { SetValue(RowProperty, value); }        }                public static readonly BindableProperty ColumnProperty = BindableProperty.Create(nameof(Column), typeof(Int32), typeof(MobileToolItem));        public Int32 Column        {            get { return (Int32)GetValue(ColumnProperty); }            set { SetValue(ColumnProperty, value); }        }                public int ID { get; set; }                public event EventHandler Clicked;                public void DoTap()        {	        Clicked?.Invoke(this, EventArgs.Empty);        }            }}
 |