Class Platform
Utility class to provide platform specific functions.
Inheritance
Namespace: CarinaStudio
Assembly: CarinaStudio.AppBase.Core.dll
Syntax
public static class Platform : object
Properties
| Improve this Doc View SourceIsAndroid
Check whether current operating system is Android of not.
Declaration
public static bool IsAndroid { get; }
Property Value
Type | Description |
---|---|
System. |
IsGnome
Check whether the desktop environment is GNOME or not if current operating system is Linux.
Declaration
public static bool IsGnome { get; }
Property Value
Type | Description |
---|---|
System. |
IsIOS
Check whether current operating system is iOS of not.
Declaration
public static bool IsIOS { get; }
Property Value
Type | Description |
---|---|
System. |
IsLinux
Check whether current operating system is Linux of not.
Declaration
public static bool IsLinux { get; }
Property Value
Type | Description |
---|---|
System. |
Remarks
Please noted that the value is also True on Android platform.
IsMacOS
Check whether current operating system is macOS of not.
Declaration
public static bool IsMacOS { get; }
Property Value
Type | Description |
---|---|
System. |
IsNotAndroid
Check whether current operating system is not Android of not.
Declaration
public static bool IsNotAndroid { get; }
Property Value
Type | Description |
---|---|
System. |
IsNotIOS
Check whether current operating system is not iOS of not.
Declaration
public static bool IsNotIOS { get; }
Property Value
Type | Description |
---|---|
System. |
IsNotLinux
Check whether current operating system is not Linux of not.
Declaration
public static bool IsNotLinux { get; }
Property Value
Type | Description |
---|---|
System. |
IsNotMacOS
Check whether current operating system is not macOS of not.
Declaration
public static bool IsNotMacOS { get; }
Property Value
Type | Description |
---|---|
System. |
IsNotWindows
Check whether current operating system is not Windows of not.
Declaration
public static bool IsNotWindows { get; }
Property Value
Type | Description |
---|---|
System. |
IsOpeningFileManagerSupported
Check whether opening system file manager is supported or not.
Declaration
public static bool IsOpeningFileManagerSupported { get; }
Property Value
Type | Description |
---|---|
System. |
IsOpeningLinkSupported
Check whether opening URI by default browser is supported on current platform or not.
Declaration
public static bool IsOpeningLinkSupported { get; }
Property Value
Type | Description |
---|---|
System. |
IsWindows
Check whether current operating system is Windows of not.
Declaration
public static bool IsWindows { get; }
Property Value
Type | Description |
---|---|
System. |
IsWindows10OrAbove
Check whether the version of Windows is Windows 10+ or not.
Declaration
public static bool IsWindows10OrAbove { get; }
Property Value
Type | Description |
---|---|
System. |
IsWindows11OrAbove
Check whether the version of Windows is Windows 11+ or not.
Declaration
public static bool IsWindows11OrAbove { get; }
Property Value
Type | Description |
---|---|
System. |
IsWindows8OrAbove
Check whether the version of Windows is Windows 8+ or not.
Declaration
public static bool IsWindows8OrAbove { get; }
Property Value
Type | Description |
---|---|
System. |
LinuxDesktop
Get current desktop environment running on Linux.
Declaration
public static LinuxDesktop LinuxDesktop { get; }
Property Value
Type | Description |
---|---|
Linux |
LinuxDistribution
Get Linux distribution if current operating system is Linux.
Declaration
public static LinuxDistribution LinuxDistribution { get; }
Property Value
Type | Description |
---|---|
Linux |
WindowsVersion
Get version of Windows currently running on.
Declaration
public static WindowsVersion WindowsVersion { get; }
Property Value
Type | Description |
---|---|
Windows |
Methods
| Improve this Doc View SourceGetInstalledRuntimeVersion(Boolean)
Get the latest version of .NET Runtime installed on device.
Declaration
public static Version? GetInstalledRuntimeVersion(bool stableVersionOnly = true)
Parameters
Type | Name | Description |
---|---|---|
System. |
stableVersionOnly | True to include stable version only. |
Returns
Type | Description |
---|---|
System. |
Installed .NET Runtime version, or null if .NET Runtime is not installed on device. |
GetInstalledRuntimeVersionAsync(Boolean)
Get the latest version of .NET Runtime installed on device
Declaration
public static Task<Version?> GetInstalledRuntimeVersionAsync(bool stableVersionOnly = true)
Parameters
Type | Name | Description |
---|---|---|
System. |
stableVersionOnly | True to include stable version only. |
Returns
Type | Description |
---|---|
Task<System. |
Task of getting version. The result will be null if .NET Runtime is not installed on device. |
GetInstalledRuntimeVersionAsync(Boolean, CancellationToken)
Get the latest version of .NET Runtime installed on device
Declaration
public static async Task<Version?> GetInstalledRuntimeVersionAsync(bool stableVersionOnly, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
System. |
stableVersionOnly | True to include stable version only. |
Cancellation |
cancellationToken | Cancellation token. |
Returns
Type | Description |
---|---|
Task<System. |
Task of getting version. The result will be null if .NET Runtime is not installed on device. |
OpenFileManager(String)
Open system file manager and show given file or directory.
Declaration
public static void OpenFileManager(string path)
Parameters
Type | Name | Description |
---|---|---|
System. |
path | Path of file or directory to show. |
OpenLink(String)
Open given URI by default browser.
Declaration
public static bool OpenLink(string uri)
Parameters
Type | Name | Description |
---|---|---|
System. |
uri | URI to open. |
Returns
Type | Description |
---|---|
System. |
True if URI opened successfully. |
OpenLink(Uri)
Open given
Declaration
public static bool OpenLink(Uri uri)
Parameters
Type | Name | Description |
---|---|---|
Uri | uri |
Returns
Type | Description |
---|---|
System. |
True if URI opened successfully. |