Files
Common-VS2019/SacsMobileMaui/Maui/App/Sam.cs
T

209 lines
7.8 KiB
C#

using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
namespace Sarand.Net.Mobile.Maui.App
{
//=======================================================================
// Colour references:
// http://www.html-color-names.com/skyblue.php
// http://www.html-color-names.com/lightsteelblue.php
//=======================================================================
public static class Sam
{
//-------------------------------------------------------------------
// Definitions.
public enum Platform
{
Unknown = 0,
Android,
IOS,
MacCatalyst,
Windows
}
// Utilities.
public static Random Random { get; set; } = new Random();
//-------------------------------------------------------------------
// Localisation.
public static class Locale
{
public static CultureInfo CultureInfo { get; set; } = CultureInfo.CurrentCulture;
public static TextInfo TextInfo { get; set; } = CultureInfo.TextInfo;
}
//-------------------------------------------------------------------
// Visuals.
public enum DisplayPosition { None, Left, Middle, Right }
public static class Visuals
{
// Application styling.
public static class Application
{
// Application bar.
public static class Bar
{
public static double Height { get; set; } = 28;
public static Color BackgroundColor { get; set; } = Color.FromArgb("#558395");
public static Color TextColor { get; set; } = Color.FromArgb("#f8f8f8");
public static double TextSizeRatio { get; set; } = 1.5;
public static Color BorderColor { get; set; } = Colors.DarkSlateBlue;
public static double BorderBottom { get; set; } = 1.0;
}
// Menu.
public static class Menu
{
public static Color BorderColor { get; set; } = Colors.DarkSlateBlue;
public static double Border { get; set; } = 1.0;
public static Color BackgroundColor { get; set; } = Color.FromArgb("#F0F0F0");
public static Color HeaderBackgroundColor { get; set; } = Color.FromArgb("#E0E0E0");
}
}
// Page layout.
public static class Page
{
public static Color BaseColor { get; set; } = Color.FromArgb("#c8e8f5");
public static Color BackgroundColor { get; set; } = Color.FromArgb("#e9f6fb");
// Header.
public static class Header
{
// Text.
public static String TextLeft { get; set; } = "";
public static String TextRight { get; set; } = "";
// Toolbar.
public static DisplayPosition ToolbarDisplay { get; set; } = Sam.DisplayPosition.None;
public static bool Display_ToolbarItem_Back { get; set; } = false;
// Styling.
public static Color BackgroundColor { get; set; } = Colors.Honeydew;
public static Color BorderColor { get; set; } = Colors.LightSlateGray;
public static double BorderStrokeWidthTop { get; set; } = 2.0;
public static double BorderStrokeWidthBottom { get; set; } = 1.0;
public static Thickness Padding { get; set; } = new Thickness(8, 4);
}
// Caption.
public static class Caption
{
public static Color BackgroundColor { get; set; } = Color.FromArgb("#558395");
public static double PaddingHorizontal { get; set; } = 4.0;
public static double PaddingVertical { get; set; } = 8.0;
public static Color TextColor { get; set; } = Color.FromArgb("#f8f8f8");
public static double TextSizeRatio { get; set; } = 1.25;
}
// Navigation.
public static class Navigation
{
public static double BorderTopWidth { get; set; } = 0.75;
public static double PaddingVertical { get; set; } = 4.0;
public static Color BorderColor { get; set; } = Color.FromArgb("#808080");
public static Color BackgroundColor { get; set; } = Color.FromArgb("#e9f6fb");
}
// Body.
public static class Body
{
public static double PaddingVerticalMin { get; set; } = 4.0;
public static double PaddingHorizontalMin { get; set; } = 4.0;
}
// Footer.
public static class Footer
{
public static String TextLeft { get; set; } = "";
public static String TextMiddle { get; set; } = "";
public static String TextRight { get; set; } = "";
public static String DateTimeFormat { get; set; } = "ddd d-MMM-yyyy HH:mm:ss";
public static DisplayPosition DateTimeDisplay { get; set; } = DisplayPosition.None;
public static Color BackgroundColor { get; set; } = Colors.Honeydew;
public static Color BorderColor { get; set; } = Colors.LightSlateGray;
public static double BorderStrokeWidthTop { get; set; } = 1.0;
public static double BorderStrokeWidthBottom { get; set; } = 2.0;
public static Thickness Padding { get; set; } = new Thickness(8, 4);
}
}
// Fonts.
public static class Fonts
{
// Dynamic font sizing.
public static string HtmlFontSize
{
get
{
if (SamApplication.MinDeviceDimension > 2000) return "14pt";
if (SamApplication.MinDeviceDimension > 1600) return "13pt";
if (SamApplication.MinDeviceDimension > 1200) return "12pt";
if (SamApplication.MinDeviceDimension > 1000) return "11pt";
return "10pt";
}
}
public static double FontSizeRatio
{
get
{
if (SamApplication.MinDeviceDimension > 2000) return 1.75;
if (SamApplication.MinDeviceDimension > 1600) return 1.50;
if (SamApplication.MinDeviceDimension > 1200) return 1.25;
return 1.0;
}
}
}
// Data display visuals.
public static class Data
{
// Item list.
public static class ItemList
{
public static double HeaderBorderWidth { get; set; } = 2.0;
public static float HeaderBorderRadius = 6.0f;
public static Color HeaderBorderColor = Sam.Visuals.Application.Bar.BackgroundColor;
public static Color HeaderBackgroundColor = Color.FromArgb("#F0F0F0");
}
// Associated items panel.
public static class AssociatedItems
{
public static Color CaptionBackgroundColor { get; set; } = Color.FromArgb("#becee4");
public static Color CaptionTextColor { get; set; } = Color.FromArgb("#f8f8f8");
public static double CaptionTextSizeRatio { get; set; } = 1.2;
public static Color BackgroundColor { get; set; } = Color.FromArgb("#dbe4f0");
}
}
// Form.
public static class Form
{
public static Color BackgroundColor { get; set; } = Color.FromArgb("#e9f6fb");
public static double GridRowSpacing { get; set; } = 4.0;
public static double GridColumnSpacing { get; set; } = 4.0;
// Label.
public static class Label
{
public static Thickness Margin { get; set; } = new Thickness(8.0, 4.0, 8.0, 2.0);
}
// Controls.
public static class Controls
{
public static Thickness Padding { get; set; } = new Thickness(4.0, 2.0, 4.0, 1.0);
public static Color BackgroundColor { get; set; } = Color.FromArgb("#F8F8F8");
public static Color BorderColor { get; set; } = Color.FromArgb("#E0E0E0");
public static double BorderWidth { get; set; } = 0.5;
// Native behaviour modified by SamHandler.
public static bool NativeNoBorder { get; set; } = false;
public static bool NativeNoUnderline { get; set; } = false;
public static bool NativeBackgroundClear { get; set; } = false;
}
// Tab controls.
public static class TabControl
{
public static Color HeaderBackgroundColor { get; set; } = Colors.Transparent;
public static Color CaptionBackgroundColor { get; set; } = Color.FromArgb("#E0E0E0");
public static Color BodyBackgroundColor { get; set; } = Color.FromArgb("#F8F8F8");
public static Thickness BodyPadding { get; set; } = new Thickness(4.0);
}
}
}
//-------------------------------------------------------------------
}
//=======================================================================
}