Browse Source

Removed extra key

Tig 9 months ago
parent
commit
f3ec218abb

+ 4 - 4
UICatalog/Properties/launchSettings.json

@@ -54,10 +54,6 @@
       "commandName": "Project",
       "commandLineArgs": "\"ListView & ComboBox\""
     },
-    "Frames Demo": {
-      "commandName": "Project",
-      "commandLineArgs": "\"Frames Demo\""
-    },
     "Generic": {
       "commandName": "Project",
       "commandLineArgs": "--benchmark Generic"
@@ -73,6 +69,10 @@
     "ContextMenus": {
       "commandName": "Project",
       "commandLineArgs": "ContextMenus -b"
+    },
+    "Animation": {
+      "commandName": "Project",
+      "commandLineArgs": "Animation -b"
     }
   }
 }

+ 1 - 2
UICatalog/Scenario.cs

@@ -151,7 +151,7 @@ public class Scenario : IDisposable
     /// </summary>
     public virtual void Main () { }
 
-    private const uint MAX_NATURAL_ITERATIONS = 100; // not including needed for demo keys
+    private const uint MAX_NATURAL_ITERATIONS = 1000; // not including needed for demo keys
     private const uint ABORT_TIMEOUT_MS = 5000;
     private const int DEMO_KEY_PACING_MS = 1; // Must be non-zero
 
@@ -245,7 +245,6 @@ public class Scenario : IDisposable
 
         _currentDemoKey = 0;
         _demoKeys = GetDemoKeyStrokes ();
-        _demoKeys.Add (Application.QuitKey);
 
         Application.AddTimeout (
                                 new TimeSpan (0, 0, 0, 0, DEMO_KEY_PACING_MS),

+ 8 - 10
UICatalog/Scenarios/AnimationScenario/AnimationScenario.cs

@@ -1,4 +1,5 @@
 using System;
+using System.Diagnostics;
 using System.IO;
 using System.Reflection;
 using System.Text;
@@ -15,11 +16,11 @@ namespace UICatalog.Scenarios;
 [ScenarioCategory ("Drawing")]
 public class AnimationScenario : Scenario
 {
-    private bool _isDisposed;
+    private bool _closed;
 
     public override void Main ()
     {
-        Application.Init();
+        Application.Init ();
 
         var win = new Window
         {
@@ -39,7 +40,7 @@ public class AnimationScenario : Scenario
 
         var lbl2 = new Label
         {
-           X = Pos.AnchorEnd(), Y = Pos.AnchorEnd (), Text = "https://commons.wikimedia.org/wiki/File:Spinning_globe.gif"
+            X = Pos.AnchorEnd (), Y = Pos.AnchorEnd (), Text = "https://commons.wikimedia.org/wiki/File:Spinning_globe.gif"
         };
         win.Add (lbl2);
 
@@ -72,7 +73,7 @@ public class AnimationScenario : Scenario
         Task.Run (
                   () =>
                   {
-                      while (!_isDisposed)
+                      while (!_closed)
                       {
                           // When updating from a Thread/Task always use Invoke
                           Application.Invoke (
@@ -88,17 +89,14 @@ public class AnimationScenario : Scenario
                   }
                  );
 
+        win.Closing += (sender, args) => _closed = true;
+
+        _closed = false;
         Application.Run (win);
         win.Dispose ();
         Application.Shutdown ();
     }
 
-    protected override void Dispose (bool disposing)
-    {
-        _isDisposed = true;
-        base.Dispose (disposing);
-    }
-
     // This is a C# port of https://github.com/andraaspar/bitmap-to-braille by Andraaspar
 
     /// <summary>Renders an image as unicode Braille.</summary>

+ 0 - 3
UnitTests/UICatalog/ScenarioTests.cs

@@ -190,9 +190,6 @@ public class ScenarioTests : TestsAllViews
             }
         }
 
-        Assert.True (initialized);
-        Assert.True (shutdown);
-
         lock (_timeoutLock)
         {
             _timeoutLock = null;