Fix warnings and index bugs in ControlCatalog sample (#20590)
This commit is contained in:
@@ -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(() =>
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user