using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Input; using Syncfusion.DocIO.DLS; using Xamarin.Forms; using Xamarin.Forms.Xaml; using XF.Material.Forms.Resources.Typography; namespace comal.timesheets { public class ActionButtonClickEventArgs : EventArgs { public object Tag { get; private set; } public ActionButtonClickEventArgs(object tag) { Tag = tag; } } public delegate void ActionButtonClickEvent(object sender, ActionButtonClickEventArgs args); [XamlCompilation(XamlCompilationOptions.Compile)] public partial class ActionButton { public event ActionButtonClickEvent Clicked; public static readonly BindableProperty TagProperty = BindableProperty.Create( nameof(Tag), typeof(object), typeof(ActionButton)); public object Tag { get => GetValue(TagProperty); set => SetValue(TagProperty, value); } public static readonly BindableProperty OrientationProperty = BindableProperty.Create( nameof(Orientation), typeof(StackOrientation), typeof(ActionButton), StackOrientation.Horizontal); public StackOrientation Orientation { get => (StackOrientation)GetValue(OrientationProperty); set => SetValue(OrientationProperty, value); } public static readonly BindableProperty ImageProperty = BindableProperty.Create( nameof(Image), typeof(ImageSource), typeof(ActionButton) ); public ImageSource Image { get => GetValue(ImageProperty) as ImageSource; set => SetValue(ImageProperty, value); } public static readonly BindableProperty TextProperty = BindableProperty.Create( nameof(Text), typeof(String), typeof(ActionButton) ); public String Text { get => (String)GetValue(TextProperty); set => SetValue(TextProperty, value); } public static readonly BindableProperty AlertProperty = BindableProperty.Create( nameof(Alert), typeof(String), typeof(ActionButton) ); public String Alert { get => (String)GetValue(AlertProperty); set => SetValue(AlertProperty, value); } public static readonly BindableProperty TextColorProperty = BindableProperty.Create( nameof(TextColor), typeof(Color), typeof(ActionButton), XF.Material.Forms.Material.Color.OnSecondary); public Color TextColor { get => (Color)GetValue(TextColorProperty); set => SetValue(TextColorProperty, value); } public static readonly BindableProperty TypeScaleProperty = BindableProperty.Create( nameof(TypeScale), typeof(MaterialTypeScale), typeof(ActionButton), MaterialTypeScale.Button); public MaterialTypeScale TypeScale { get => (MaterialTypeScale)GetValue(TypeScaleProperty); set => SetValue(TypeScaleProperty, value); } public new static readonly BindableProperty BackgroundColorProperty = BindableProperty.Create( nameof(BackgroundColor), typeof(Color), typeof(ActionButton), XF.Material.Forms.Material.Color.Secondary); public new Color BackgroundColor { get => (Color)GetValue(BackgroundColorProperty); set => SetValue(BackgroundColorProperty, value); } public static readonly BindableProperty BorderColorProperty = BindableProperty.Create( nameof(BorderColor), typeof(Color), typeof(ActionButton), XF.Material.Forms.Material.Color.SecondaryVariant); public Color BorderColor { get => (Color)GetValue(BorderColorProperty); set => SetValue(BorderColorProperty, value); } public static readonly BindableProperty PaddingProperty = BindableProperty.Create( nameof(Padding), typeof(Thickness), typeof(ActionButton), new Thickness(5)); public new Thickness Padding { get => (Thickness)GetValue(PaddingProperty); set => SetValue(PaddingProperty, value); } public ActionButton() { InitializeComponent(); Alert = ""; } private void _frame_OnClicked(object sender, EventArgs e) { Clicked?.Invoke(this, new ActionButtonClickEventArgs(Tag)); } } }