瀏覽代碼

Refactgored scenario to use Main

Tig 1 年之前
父節點
當前提交
edfd240310
共有 1 個文件被更改,包括 16 次插入13 次删除
  1. 16 13
      UICatalog/Scenarios/ASCIICustomButton.cs

+ 16 - 13
UICatalog/Scenarios/ASCIICustomButton.cs

@@ -14,9 +14,10 @@ public class ASCIICustomButtonTest : Scenario
     private MenuItem _miSmallerWindow;
     private MenuItem _miSmallerWindow;
     private ScrollViewTestWindow _scrollViewTestWindow;
     private ScrollViewTestWindow _scrollViewTestWindow;
 
 
-    public override void Init ()
+    public override void Main ()
     {
     {
         Application.Init ();
         Application.Init ();
+        Toplevel top = new ();
         _scrollViewTestWindow = new ScrollViewTestWindow ();
         _scrollViewTestWindow = new ScrollViewTestWindow ();
 
 
         var menu = new MenuBar
         var menu = new MenuBar
@@ -50,20 +51,22 @@ public class ASCIICustomButtonTest : Scenario
                                 )
                                 )
             ]
             ]
         };
         };
-        Top = new ();
-        Top.Add (menu, _scrollViewTestWindow);
-        Application.Run (Top);
-    }
+        top = new ();
+        top.Add (menu, _scrollViewTestWindow);
+        Application.Run (top);
+        top.Dispose ();
 
 
-    public override void Run () { }
+        return;
 
 
-    private void ChangeWindowSize ()
-    {
-        _smallerWindow = (bool)(_miSmallerWindow.Checked = !_miSmallerWindow.Checked);
-        _scrollViewTestWindow.Dispose ();
-        Top.Remove (_scrollViewTestWindow);
-        _scrollViewTestWindow = new ScrollViewTestWindow ();
-        Top.Add (_scrollViewTestWindow);
+        void ChangeWindowSize ()
+        {
+            _smallerWindow = (bool)(_miSmallerWindow.Checked = !_miSmallerWindow.Checked);
+            top.Remove (_scrollViewTestWindow);
+            _scrollViewTestWindow.Dispose ();
+
+            _scrollViewTestWindow = new ScrollViewTestWindow ();
+            top.Add (_scrollViewTestWindow);
+        }
     }
     }
 
 
     public class ASCIICustomButton : Button
     public class ASCIICustomButton : Button