Browse Source

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

pull/20592/head
Thad House 4 days ago
committed by GitHub
parent
commit
7d9c8eeb7b
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 8
      samples/ControlCatalog.Desktop/Program.cs

8
samples/ControlCatalog.Desktop/Program.cs

@ -45,7 +45,7 @@ namespace ControlCatalog.Desktop
double GetScaling() double GetScaling()
{ {
var idx = Array.IndexOf(args, "--scaling"); 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)) double.TryParse(args[idx + 1], NumberStyles.Any, CultureInfo.InvariantCulture, out var scaling))
return scaling; return scaling;
return 1; return 1;
@ -114,7 +114,7 @@ namespace ControlCatalog.Desktop
{ {
builder.With(new Win32PlatformOptions() builder.With(new Win32PlatformOptions()
{ {
CompositionMode = new [] { Win32CompositionMode.LowLatencyDxgiSwapChain } CompositionMode = [Win32CompositionMode.LowLatencyDxgiSwapChain]
}); });
return builder.StartWithClassicDesktopLifetime(args); return builder.StartWithClassicDesktopLifetime(args);
} }
@ -151,14 +151,14 @@ namespace ControlCatalog.Desktop
.WithDeveloperTools() .WithDeveloperTools()
.AfterSetup(builder => .AfterSetup(builder =>
{ {
EmbedSample.Implementation = OperatingSystem.IsWindows() ? (INativeDemoControl)new EmbedSampleWin() EmbedSample.Implementation = OperatingSystem.IsWindows() ? new EmbedSampleWin()
: OperatingSystem.IsMacOS() ? new EmbedSampleMac() : OperatingSystem.IsMacOS() ? new EmbedSampleMac()
: OperatingSystem.IsLinux() ? new EmbedSampleGtk() : OperatingSystem.IsLinux() ? new EmbedSampleGtk()
: null; : null;
}) })
.LogToTrace(); .LogToTrace();
static void SilenceConsole() private static void SilenceConsole()
{ {
new Thread(() => new Thread(() =>
{ {

Loading…
Cancel
Save