-
-
Notifications
You must be signed in to change notification settings - Fork 335
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make OperatingSystemPlatform lazy and use newer APIs for OS detection
- Loading branch information
Showing
2 changed files
with
88 additions
and
60 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
49 changes: 49 additions & 0 deletions
49
test/Eto.Test/Sections/Behaviors/OperatingSystemPlatformSection.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Threading.Tasks; | ||
|
||
namespace Eto.Test.Sections.Behaviors | ||
{ | ||
[Section("Behaviors", "OperatingSystemPlatform")] | ||
public class OperatingSystemPlatformSection : Scrollable | ||
{ | ||
public OperatingSystemPlatformSection() | ||
{ | ||
var platform = EtoEnvironment.Platform; | ||
|
||
var layout = new DynamicLayout | ||
{ | ||
DefaultSpacing = new Size(10, 10) | ||
}; | ||
layout.BeginCentered(yscale: true, xscale: true); | ||
|
||
layout.Add(new Label { Text = "OperatingSystemPlatform", Font = SystemFonts.Bold(SystemFonts.Bold().Size + 2) }); | ||
|
||
layout.BeginVertical(); | ||
layout.AddRow("IsNetCore:", platform.IsNetCore.ToString()); | ||
layout.AddRow("IsNetFramework:", platform.IsNetFramework.ToString()); | ||
layout.AddRow("IsMono:", platform.IsMono.ToString()); | ||
layout.AddRow("IsWinRT:", platform.IsWinRT.ToString()); | ||
layout.AddRow("IsWindows:", platform.IsWindows.ToString()); | ||
layout.AddRow("IsMac:", platform.IsMac.ToString()); | ||
layout.AddRow("IsUnix:", platform.IsUnix.ToString()); | ||
layout.AddRow("IsLinux:", platform.IsLinux.ToString()); | ||
layout.EndVertical(); | ||
|
||
layout.Add(new Label { Text = "RuntimeInformation", Font = SystemFonts.Bold(SystemFonts.Bold().Size + 2) }); | ||
layout.BeginVertical(); | ||
layout.AddRow("FrameworkDescription: ", RuntimeInformation.FrameworkDescription); | ||
layout.AddRow("OSArchitecture: ", RuntimeInformation.OSArchitecture.ToString()); | ||
layout.AddRow("OSDescription: ", RuntimeInformation.OSDescription); | ||
layout.AddRow("ProcessArchitecture: ", RuntimeInformation.ProcessArchitecture.ToString()); | ||
#if NET | ||
layout.AddRow("RuntimeIdentifier: ", RuntimeInformation.RuntimeIdentifier); | ||
#endif | ||
layout.EndVertical(); | ||
|
||
layout.EndCentered(); | ||
Content = layout; | ||
} | ||
} | ||
} |