Fix warnings and index bugs in ControlCatalog sample (#20590)

This commit is contained in:
Thad House
2026-02-02 12:07:00 -08:00
committed by GitHub
parent 0715676f22
commit 7d9c8eeb7b
+4 -4
View File
@@ -45,7 +45,7 @@ namespace ControlCatalog.Desktop
double GetScaling()
{
var idx = Array.IndexOf(args, "--scaling");
if (idx != 0 && args.Length > idx + 1 &&
if (idx >= 0 && args.Length > idx + 1 &&
double.TryParse(args[idx + 1], NumberStyles.Any, CultureInfo.InvariantCulture, out var scaling))
return scaling;
return 1;
@@ -114,7 +114,7 @@ namespace ControlCatalog.Desktop
{
builder.With(new Win32PlatformOptions()
{
CompositionMode = new [] { Win32CompositionMode.LowLatencyDxgiSwapChain }
CompositionMode = [Win32CompositionMode.LowLatencyDxgiSwapChain]
});
return builder.StartWithClassicDesktopLifetime(args);
}
@@ -151,14 +151,14 @@ namespace ControlCatalog.Desktop
.WithDeveloperTools()
.AfterSetup(builder =>
{
EmbedSample.Implementation = OperatingSystem.IsWindows() ? (INativeDemoControl)new EmbedSampleWin()
EmbedSample.Implementation = OperatingSystem.IsWindows() ? new EmbedSampleWin()
: OperatingSystem.IsMacOS() ? new EmbedSampleMac()
: OperatingSystem.IsLinux() ? new EmbedSampleGtk()
: null;
})
.LogToTrace();
static void SilenceConsole()
private static void SilenceConsole()
{
new Thread(() =>
{