105 lines
2.8 KiB
C#
105 lines
2.8 KiB
C#
using System;
|
|
using Xamarin.Forms;
|
|
|
|
namespace Billing.UI
|
|
{
|
|
public static partial class Definition
|
|
{
|
|
public static partial string GetCascadiaRegularFontFamily();
|
|
public static partial string GetCascadiaBoldFontFamily();
|
|
public static partial string GetRobotoCondensedRegularFontFamily();
|
|
public static partial string GetRobotoCondensedBoldFontFamily();
|
|
}
|
|
|
|
public static class ExtensionHelper
|
|
{
|
|
public static T Binding<T>(this T obj, BindableProperty property, string path, BindingMode mode = BindingMode.Default, IValueConverter converter = null) where T : BindableObject
|
|
{
|
|
obj.SetBinding(property, path, mode, converter);
|
|
return obj;
|
|
}
|
|
|
|
public static T HorizontalOptions<T>(this T view, LayoutOptions options) where T : View
|
|
{
|
|
if (view != null)
|
|
{
|
|
view.HorizontalOptions = options;
|
|
}
|
|
return view;
|
|
}
|
|
|
|
public static T VerticalOptions<T>(this T view, LayoutOptions options) where T : View
|
|
{
|
|
if (view != null)
|
|
{
|
|
view.VerticalOptions = options;
|
|
}
|
|
return view;
|
|
}
|
|
|
|
public static T Margin<T>(this T view, Thickness margin) where T : View
|
|
{
|
|
view.Margin = margin;
|
|
return view;
|
|
}
|
|
|
|
public static T DynamicResource<T>(this T view, BindableProperty property, string key) where T : Element
|
|
{
|
|
view.SetDynamicResource(property, key);
|
|
return view;
|
|
}
|
|
|
|
public static T GridColumn<T>(this T view, int column) where T : BindableObject
|
|
{
|
|
Grid.SetColumn(view, column);
|
|
return view;
|
|
}
|
|
|
|
public static T GridRow<T>(this T view, int row) where T : BindableObject
|
|
{
|
|
Grid.SetRow(view, row);
|
|
return view;
|
|
}
|
|
|
|
public static T GridColumnSpan<T>(this T view, int columnSpan) where T : BindableObject
|
|
{
|
|
Grid.SetColumnSpan(view, columnSpan);
|
|
return view;
|
|
}
|
|
|
|
public static T GridRowSpan<T>(this T view, int rowSpan) where T : BindableObject
|
|
{
|
|
Grid.SetRowSpan(view, rowSpan);
|
|
return view;
|
|
}
|
|
}
|
|
|
|
public class Tap : IDisposable
|
|
{
|
|
private readonly static object sync = new();
|
|
private static Tap instance;
|
|
|
|
private bool busy = false;
|
|
|
|
private Tap() { }
|
|
|
|
public static bool IsBusy => instance?.busy ?? false;
|
|
|
|
public static Tap Start()
|
|
{
|
|
lock (sync)
|
|
{
|
|
(instance ??= new Tap()).busy = true;
|
|
}
|
|
return instance;
|
|
}
|
|
|
|
public void Dispose()
|
|
{
|
|
lock (sync)
|
|
{
|
|
busy = false;
|
|
}
|
|
}
|
|
}
|
|
} |