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

61 lines
2.1 KiB
C#

using Sarand.Net.Standard.Base.App;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Sarand.Net.Mobile.Maui.App
{
//=======================================================================
public class SamApplication : Application
{
//-------------------------------------------------------------------
// Definitions.
//-------------------------------------------------------------------
// Data members.
private Sam.Platform platform;
//-------------------------------------------------------------------
protected SamApplication()
{
// Determine platform.
#if ANDROID
platform = Sam.Platform.Android;
#elif IOS
platform = Sam.Platform.IOS;
#elif MACCATALYST
platform = Sam.Platform.MacCatalyst;
#elif WINDOWS
platform = Sam.Platform.Windows;
#endif
// Log environment.
SaLogger.Debug("Platform: " + platform.ToString());
SaLogger.Debug("AppInfo.AppName: " + AppInfo.Name);
SaLogger.Debug("AppInfo.PackageName: " + AppInfo.PackageName);
SaLogger.Debug("AppInfo.Version: " + AppInfo.VersionString);
SaLogger.Debug("AppInfo.Build: " + AppInfo.BuildString);
SaLogger.Debug("DeviceWidth: " + DeviceWidth);
SaLogger.Debug("DeviceHeight: " + DeviceHeight);
SaLogger.Debug("DeviceDensity: " + DeviceDisplay.MainDisplayInfo.Density);
}
//-------------------------------------------------------------------
// Properties.
public Sam.Platform Platform { get { return platform; } }
// Device screen size and orientation.
public static bool Landscape => DeviceWidth > DeviceHeight;
public static double DeviceWidth => DeviceDisplay.MainDisplayInfo.Width;
public static double DeviceHeight => DeviceDisplay.MainDisplayInfo.Height;
public static double MinDeviceDimension => Math.Min(DeviceWidth, DeviceHeight);
public static double MaxDeviceDimension => Math.Max(DeviceWidth, DeviceHeight);
//-------------------------------------------------------------------
}
//=======================================================================
}