From: thefiddler Date: Fri, 18 Jul 2014 07:44:47 +0000 (+0200) Subject: [Examples] Only use WinForms when supported. X-Git-Tag: 2.0-0~112^2~5 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=b1a31c08cc358b35e95bae58c379486b9166c3bf;p=platform%2Fcore%2Fcsapi%2Fopentk.git [Examples] Only use WinForms when supported. --- diff --git a/Source/Examples/OpenTK/Test/TestResolutionChanges.cs b/Source/Examples/OpenTK/Test/TestResolutionChanges.cs index 314a34a..740f60f 100644 --- a/Source/Examples/OpenTK/Test/TestResolutionChanges.cs +++ b/Source/Examples/OpenTK/Test/TestResolutionChanges.cs @@ -23,16 +23,35 @@ namespace Examples.Tests DisplayDevice dev = DisplayDevice.GetDisplay(DisplayIndex.First + i); if (dev != null) { - Trace.WriteLine(dev.ToString()); - MessageBox.Show(dev.ToString()); + Print(dev.ToString()); + dev.ChangeResolution(dev.SelectResolution(640, 480, 32, 60.0f)); Thread.Sleep(1000); - MessageBox.Show(dev.ToString()); + Print(dev.ToString()); + dev.RestoreResolution(); Thread.Sleep(1000); - MessageBox.Show(dev.ToString()); + Print(dev.ToString()); + } + } + } + + static void Print(string msg) + { + Trace.WriteLine(msg); + + // Also display a MessageBox when running on a platform + // with WinForms support. + try + { + if (Configuration.RunningOnWindows || Configuration.RunningOnX11 || Configuration.RunningOnMacOS) + { + MessageBox.Show(msg); } } + catch + { + } } } }