Table of Contents

Class Platform

Namespace
CarinaStudio
Assembly
CarinaStudio.AppBase.Core.dll

Utility class to provide platform specific functions.

public static class Platform
Inheritance
Platform
Inherited Members

Properties

IsAndroid

Check whether current operating system is Android of not.

public static bool IsAndroid { get; }

Property Value

bool

IsGnome

Check whether the desktop environment is GNOME or not if current operating system is Linux.

[Obsolete("Use LinuxDesktop instead.")]
public static bool IsGnome { get; }

Property Value

bool

IsIOS

Check whether current operating system is iOS of not.

public static bool IsIOS { get; }

Property Value

bool

IsLinux

Check whether current operating system is Linux of not.

public static bool IsLinux { get; }

Property Value

bool

Remarks

Please noted that the value is also True on Android platform.

IsMacOS

Check whether current operating system is macOS of not.

public static bool IsMacOS { get; }

Property Value

bool

IsNotAndroid

Check whether current operating system is not Android of not.

public static bool IsNotAndroid { get; }

Property Value

bool

IsNotIOS

Check whether current operating system is not iOS of not.

public static bool IsNotIOS { get; }

Property Value

bool

IsNotLinux

Check whether current operating system is not Linux of not.

public static bool IsNotLinux { get; }

Property Value

bool

IsNotMacOS

Check whether current operating system is not macOS of not.

public static bool IsNotMacOS { get; }

Property Value

bool

IsNotWindows

Check whether current operating system is not Windows of not.

public static bool IsNotWindows { get; }

Property Value

bool

IsOpeningFileManagerSupported

Check whether opening system file manager is supported or not.

public static bool IsOpeningFileManagerSupported { get; }

Property Value

bool

IsOpeningLinkSupported

Check whether opening URI by default browser is supported on current platform or not.

public static bool IsOpeningLinkSupported { get; }

Property Value

bool

IsWindows

Check whether current operating system is Windows of not.

public static bool IsWindows { get; }

Property Value

bool

IsWindows10OrAbove

Check whether the version of Windows is Windows 10+ or not.

public static bool IsWindows10OrAbove { get; }

Property Value

bool

IsWindows11OrAbove

Check whether the version of Windows is Windows 11+ or not.

public static bool IsWindows11OrAbove { get; }

Property Value

bool

IsWindows8OrAbove

Check whether the version of Windows is Windows 8+ or not.

public static bool IsWindows8OrAbove { get; }

Property Value

bool

LinuxDesktop

Get current desktop environment running on Linux.

public static LinuxDesktop LinuxDesktop { get; }

Property Value

LinuxDesktop

LinuxDistribution

Get Linux distribution if current operating system is Linux.

public static LinuxDistribution LinuxDistribution { get; }

Property Value

LinuxDistribution

WindowsVersion

Get version of Windows currently running on.

public static WindowsVersion WindowsVersion { get; }

Property Value

WindowsVersion

Methods

GetInstalledRuntimeVersion(bool)

Get the latest version of .NET Runtime installed on device.

public static Version? GetInstalledRuntimeVersion(bool stableVersionOnly = true)

Parameters

stableVersionOnly bool

True to include stable version only.

Returns

Version

Installed .NET Runtime version, or null if .NET Runtime is not installed on device.

GetInstalledRuntimeVersionAsync(bool)

Get the latest version of .NET Runtime installed on device

public static Task<Version?> GetInstalledRuntimeVersionAsync(bool stableVersionOnly = true)

Parameters

stableVersionOnly bool

True to include stable version only.

Returns

Task<Version>

Task of getting version. The result will be null if .NET Runtime is not installed on device.

GetInstalledRuntimeVersionAsync(bool, CancellationToken)

Get the latest version of .NET Runtime installed on device

public static Task<Version?> GetInstalledRuntimeVersionAsync(bool stableVersionOnly, CancellationToken cancellationToken)

Parameters

stableVersionOnly bool

True to include stable version only.

cancellationToken CancellationToken

Cancellation token.

Returns

Task<Version>

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.

public static void OpenFileManager(string path)

Parameters

path string

Path of file or directory to show.

Open given URI by default browser.

public static bool OpenLink(string uri)

Parameters

uri string

URI to open.

Returns

bool

True if URI opened successfully.

Open given Uri by default browser.

public static bool OpenLink(Uri uri)

Parameters

uri Uri

Uri to open.

Returns

bool

True if URI opened successfully.