bu5hm4n pushed a commit to branch master.

http://git.enlightenment.org/tools/examples.git/commit/?id=b55e5150c91dd860fe86588adce9e0bb35d60c5b

commit b55e5150c91dd860fe86588adce9e0bb35d60c5b
Author: Xavi Artigas <[email protected]>
Date:   Tue Mar 26 11:19:13 2019 +0000

    mono examples: Adapt to Efl.Csharp.Application
    
    This class simplifies app development, so the examples have to showcase it.
    Basically:
    - Your app inherits form it
    - You do not need to init() or shutdown()
    - You override the methods you want (like OnInitialize).
    
    Fixes T7655
    Differential Revision: https://phab.enlightenment.org/D8477
---
 apps/csharp/life/src/life_main.cs              | 34 +++++++++++++++++---------
 apps/csharp/texteditor/src/texteditor_main.cs  | 23 ++++-------------
 reference/csharp/core/src/core_event.cs        | 28 ++++++++++-----------
 reference/csharp/core/src/core_idler.cs        | 27 +++++++++-----------
 reference/csharp/core/src/core_poll.cs         | 25 +++++++++----------
 reference/csharp/eina/src/eina_array.cs        | 17 +++++++++----
 reference/csharp/eina/src/eina_hash.cs         | 17 +++++++++----
 reference/csharp/eina/src/eina_iterator.cs     | 17 +++++++++----
 reference/csharp/eina/src/eina_list.cs         | 14 +++++++----
 reference/csharp/eina/src/eina_log.cs          | 17 +++++++++----
 reference/csharp/eina/src/eina_value.cs        | 17 +++++++++----
 reference/csharp/ui/src/focus_main.cs          | 23 ++++++++---------
 reference/csharp/ui/src/ui_container.cs        | 23 ++++++++---------
 reference/csharp/ui/src/ui_sizing.cs           | 23 ++++++++---------
 tutorial/csharp/eo-intro/src/eo_intro_main.cs  | 17 +++++++++----
 tutorial/csharp/hello-gui/src/gui_main.cs      | 27 +++++++++-----------
 tutorial/csharp/hello-world/src/hello-world.cs | 23 ++++++++---------
 17 files changed, 197 insertions(+), 175 deletions(-)

diff --git a/apps/csharp/life/src/life_main.cs 
b/apps/csharp/life/src/life_main.cs
index 3de8d68a..b485b18b 100644
--- a/apps/csharp/life/src/life_main.cs
+++ b/apps/csharp/life/src/life_main.cs
@@ -1,9 +1,10 @@
 using System;
 
-public class LifeWindow
+public class LifeWindow : Efl.Csharp.Application
 {
     private LifeBoard lifeBoard;
     private LifeRender lifeRender;
+    private Efl.Ui.Win win;
 
     void ResizeEvt(object sender, EventArgs ev)
     {
@@ -14,13 +15,12 @@ public class LifeWindow
     {
         // quit the mainloop
         if (ev.arg == false)
-            Efl.Ui.Config.Exit();
+            Efl.App.AppMain.Quit(0);
     }
 
     void TouchEvt(object sender, Efl.Input.IInterfacePointerDownEvt_Args ev)
     {
         int cellx, celly;
-        Efl.Ui.Win win = (Efl.Ui.Win)sender;
         var position = ev.arg.GetPosition();
         lifeRender.CellForCoords(win, position, out cellx, out celly);
 
@@ -31,14 +31,13 @@ public class LifeWindow
 
     void KeyDownEvt(object sender, Efl.Input.IInterfaceKeyDownEvt_Args ev)
     {
-        Efl.Ui.Win win = (Efl.Ui.Win)sender;
         if (ev.arg.GetKey() == "space")
             lifeBoard.TogglePause(win);
     }
 
-    public LifeWindow()
+    protected override void OnInitialize(Eina.Array<System.String> args)
     {
-        Efl.Ui.Win win = new Efl.Ui.Win(parent: null, winName: "Life", 
winType: Efl.Ui.WinType.Basic);
+        win = new Efl.Ui.Win(parent: null, winName: "Life", winType: 
Efl.Ui.WinType.Basic);
         win.SetText("EFL Life");
         win.SetAutohide(true);
 
@@ -61,19 +60,30 @@ public class LifeWindow
 
         lifeBoard.Run(win);
     }
+
+    protected override void OnPause() {
+        if (win != null) {
+            lifeBoard.TogglePause(win);
+        }
+    }
+
+    protected override void OnResume() {
+        if (win != null) {
+            lifeBoard.TogglePause(win);
+        }
+    }
+
+    protected override void OnTerminate() {
+        Console.WriteLine("Goodbye.");
+    }
 }
 
 public class Example
 {
     public static void Main()
     {
-        Efl.All.Init(Efl.Components.Ui);
-
         var lifeWin = new LifeWindow();
 
-        // start the mainloop
-        Efl.Ui.Config.Run();
-
-        Efl.All.Shutdown();
+        lifeWin.Launch();
     }
 }
diff --git a/apps/csharp/texteditor/src/texteditor_main.cs 
b/apps/csharp/texteditor/src/texteditor_main.cs
index e0591f13..e65ec3a8 100644
--- a/apps/csharp/texteditor/src/texteditor_main.cs
+++ b/apps/csharp/texteditor/src/texteditor_main.cs
@@ -17,7 +17,7 @@
 
 using System;
 
-public class TextEditor
+public class TextEditor : Efl.Csharp.Application
 {
     private Efl.Ui.Win win;                  // The main window
     private Efl.Ui.Text editorTextBox;       // The main text entry
@@ -35,7 +35,7 @@ public class TextEditor
     private void GUIQuitCb(object sender, 
Efl.Gfx.IEntityVisibilityChangedEvt_Args ea)
     {
         if (ea.arg == false)
-            Efl.Ui.Config.Exit();
+            Efl.App.AppMain.Quit(0);
     }
 
     // Enables or disables buttons on the toolbar as required
@@ -151,7 +151,7 @@ public class TextEditor
     }
 
     // Builds the user interface for the text editor
-    public TextEditor()
+    protected override void OnInitialize(Eina.Array<System.String> args)
     {
         // Create a window and initialize it
         win = new Efl.Ui.Win(parent: Efl.App.AppMain);
@@ -180,13 +180,6 @@ public class TextEditor
         // Initial refresh of the toolbar buttons
         GUIToolbarRefresh();
     }
-
-    // This method won't return until the application quits
-    public void Run()
-    {
-        // Start the EFL main loop
-        Efl.Ui.Config.Run();
-    }
 }
 
 public class Example
@@ -196,14 +189,8 @@ public class Example
 #endif
     public static void Main()
     {
-        // Initialize EFL and all UI components
-        Efl.All.Init(Efl.Components.Ui);
-
-        var textEditor = new TextEditor();
-        textEditor.Run();
-
-        // Shutdown EFL
-        Efl.All.Shutdown();
+        TextEditor editor = new TextEditor();
+        editor.Launch();
     }
 }
 
diff --git a/reference/csharp/core/src/core_event.cs 
b/reference/csharp/core/src/core_event.cs
index 7906f41e..cadfa997 100644
--- a/reference/csharp/core/src/core_event.cs
+++ b/reference/csharp/core/src/core_event.cs
@@ -7,7 +7,7 @@
 
 using System;
 
-public class Example
+public class Example : Efl.Csharp.Application
 {
     // Polling callback
     private static void PollCb(object sender, EventArgs e)
@@ -15,14 +15,8 @@ public class Example
         Console.WriteLine("  Poll from {0}", ((Efl.Object)sender).GetName());
     }
 
-#if WIN32
-    [STAThreadAttribute()]
-#endif
-    public static void Main()
+    protected override void OnInitialize(Eina.Array<System.String> args)
     {
-        // Initialize EFL and all UI components
-        Efl.All.Init();
-
         // Retrieve the application's main loop
         var mainloop = Efl.App.AppMain;
         mainloop.SetName("Mainloop");
@@ -57,14 +51,20 @@ public class Example
         };
 
         Console.WriteLine("Waiting for Timer to call back...");
+    }
 
-        // Start the EFL main loop (and the experiment)
-        mainloop.Begin();
-
-        // Shutdown EFL
-        Efl.All.Shutdown();
-
+    protected override void OnTerminate()
+    {
         Console.WriteLine("Application is over");
     }
+
+#if WIN32
+    [STAThreadAttribute()]
+#endif
+    public static void Main()
+    {
+        var example = new Example();
+        example.Launch();
+    }
 }
 
diff --git a/reference/csharp/core/src/core_idler.cs 
b/reference/csharp/core/src/core_idler.cs
index 1a0fb5c2..33bc1989 100644
--- a/reference/csharp/core/src/core_idler.cs
+++ b/reference/csharp/core/src/core_idler.cs
@@ -9,16 +9,10 @@
 
 using System;
 
-public class Example
+public class Example : Efl.Csharp.Application
 {
-#if WIN32
-    [STAThreadAttribute()]
-#endif
-    public static void Main()
+    protected override void OnInitialize(Eina.Array<System.String> args)
     {
-        // Initialize EFL and all UI components
-        Efl.All.Init();
-
         // Retrieve the application's main loop
         var mainloop = Efl.App.AppMain;
 
@@ -34,16 +28,19 @@ public class Example
         };
 
         // Use a timer to exit the application
-        var timer = new Efl.LoopTimer(mainloop, 0.01);
+        var timer = new Efl.LoopTimer(mainloop, 0.02);
         timer.TimerTickEvt += (object sender, EventArgs e) => {
           Console.WriteLine("TIMER: timer callback called, exiting.");
-          mainloop.Quit(new Eina.Value(0));
+          mainloop.Quit(0);
         };
+    }
 
-        // Start the EFL main loop (and the experiment)
-        mainloop.Begin();
-
-        // Shutdown EFL
-        Efl.All.Shutdown();
+#if WIN32
+    [STAThreadAttribute()]
+#endif
+    public static void Main()
+    {
+        var example = new Example();
+        example.Launch();
     }
 }
diff --git a/reference/csharp/core/src/core_poll.cs 
b/reference/csharp/core/src/core_poll.cs
index 502e08cf..8e129e21 100644
--- a/reference/csharp/core/src/core_poll.cs
+++ b/reference/csharp/core/src/core_poll.cs
@@ -8,16 +8,10 @@
 
 using System;
 
-public class Example
+public class Example : Efl.Csharp.Application
 {
-#if WIN32
-    [STAThreadAttribute()]
-#endif
-    public static void Main()
+    protected override void OnInitialize(Eina.Array<System.String> args)
     {
-        // Initialize EFL and all UI components
-        Efl.All.Init();
-
         // Retrieve the application's main loop
         var mainloop = Efl.App.AppMain;
 
@@ -36,13 +30,16 @@ public class Example
         var timer = new Efl.LoopTimer(mainloop, 30);
         timer.TimerTickEvt += (object sender, EventArgs e) => {
           Console.WriteLine("\nTIMER: timer callback called, exiting.");
-          mainloop.Quit(new Eina.Value(0));
+          mainloop.Quit(0);
         };
+    }
 
-        // Start the EFL main loop (and the experiment)
-        mainloop.Begin();
-
-        // Shutdown EFL
-        Efl.All.Shutdown();
+#if WIN32
+    [STAThreadAttribute()]
+#endif
+    public static void Main()
+    {
+        var example = new Example();
+        example.Launch();
     }
 }
diff --git a/reference/csharp/eina/src/eina_array.cs 
b/reference/csharp/eina/src/eina_array.cs
index dd7a3be8..0e594b7d 100644
--- a/reference/csharp/eina/src/eina_array.cs
+++ b/reference/csharp/eina/src/eina_array.cs
@@ -8,7 +8,7 @@
 
 using System;
 
-public class Example
+public class Example : Efl.Csharp.Application
 {
     static Eina.Array<string> CreateArray()
     {
@@ -38,10 +38,8 @@ public class Example
         return true;
     }
 
-    public static void Main()
+    protected override void OnInitialize(Eina.Array<System.String> args)
     {
-        Efl.All.Init();
-
         var array = CreateArray();
 
         // Show the contents of our array
@@ -69,7 +67,16 @@ public class Example
 
         array.Dispose();
 
-        Efl.All.Shutdown();
+        Efl.App.AppMain.Quit(0);
+    }
+
+#if WIN32
+    [STAThreadAttribute()]
+#endif
+    public static void Main()
+    {
+        var example = new Example();
+        example.Launch();
     }
 }
 
diff --git a/reference/csharp/eina/src/eina_hash.cs 
b/reference/csharp/eina/src/eina_hash.cs
index 7b155e70..64ade56f 100644
--- a/reference/csharp/eina/src/eina_hash.cs
+++ b/reference/csharp/eina/src/eina_hash.cs
@@ -12,7 +12,7 @@
 using System;
 using System.Collections.Generic;
 
-public class Example
+public class Example : Efl.Csharp.Application
 {
     static Eina.Hash<Int32, string> CreateHash()
     {
@@ -117,13 +117,20 @@ public class Example
         phone_book.Dispose();
     }
 
-    public static void Main()
+    protected override void OnInitialize(Eina.Array<System.String> args)
     {
-        Efl.All.Init();
-
         HashDemo();
         PhonebookDemo();
 
-        Efl.All.Shutdown();
+        Efl.App.AppMain.Quit(0);
+    }
+
+#if WIN32
+    [STAThreadAttribute()]
+#endif
+    public static void Main()
+    {
+        var example = new Example();
+        example.Launch();
     }
 }
diff --git a/reference/csharp/eina/src/eina_iterator.cs 
b/reference/csharp/eina/src/eina_iterator.cs
index 61d31dca..e8a03973 100644
--- a/reference/csharp/eina/src/eina_iterator.cs
+++ b/reference/csharp/eina/src/eina_iterator.cs
@@ -10,7 +10,7 @@
 
 using System;
 
-public class Example
+public class Example : Efl.Csharp.Application
 {
     static void PrintIterator(Eina.Iterator<string> it)
     {
@@ -55,10 +55,8 @@ public class Example
         return list;
     }
 
-    public static void Main()
+    protected override void OnInitialize(Eina.Array<System.String> args)
     {
-        Efl.All.Init();
-
         // Create an Eina.Array and iterate through its contents
         var array = CreateArray();
         var it = array.GetIterator();
@@ -73,6 +71,15 @@ public class Example
         it.Dispose();
         list.Dispose();
 
-        Efl.All.Shutdown();
+        Efl.App.AppMain.Quit(0);
+    }
+
+#if WIN32
+    [STAThreadAttribute()]
+#endif
+    public static void Main()
+    {
+        var example = new Example();
+        example.Launch();
     }
 }
diff --git a/reference/csharp/eina/src/eina_list.cs 
b/reference/csharp/eina/src/eina_list.cs
index e04dc205..0253bc39 100644
--- a/reference/csharp/eina/src/eina_list.cs
+++ b/reference/csharp/eina/src/eina_list.cs
@@ -10,7 +10,7 @@
 using System;
 using System.Linq;
 
-public class Example
+public class Example : Efl.Csharp.Application
 {
     static Eina.List<string> CreateList()
     {
@@ -23,10 +23,8 @@ public class Example
         return list;
     }
 
-    public static void Main()
+    protected override void OnInitialize(Eina.Array<System.String> args)
     {
-        Efl.All.Init();
-
         var list = CreateList();
 
         // Print our list with a simple foreach
@@ -66,6 +64,12 @@ public class Example
 
         list.Dispose();
 
-        Efl.All.Shutdown();
+        Efl.App.AppMain.Quit(0);
+    }
+
+    public static void Main()
+    {
+        var example = new Example();
+        example.Launch();
     }
 }
diff --git a/reference/csharp/eina/src/eina_log.cs 
b/reference/csharp/eina/src/eina_log.cs
index 86627e9f..fb64ba4a 100644
--- a/reference/csharp/eina/src/eina_log.cs
+++ b/reference/csharp/eina/src/eina_log.cs
@@ -8,7 +8,7 @@
 
 using System;
 
-public class Example
+public class Example : Efl.Csharp.Application
 {
     static double Divide(int num, int denom)
     {
@@ -48,15 +48,22 @@ public class Example
         Divides();
     }
 
-    public static void Main()
+    protected override void OnInitialize(Eina.Array<System.String> args)
     {
-        Efl.All.Init();
-
         LogLevels();
 
         // TODO: missing
         //LogCustom();
 
-        Efl.All.Shutdown();
+        Efl.App.AppMain.Quit(0);
+    }
+
+#if WIN32
+    [STAThreadAttribute()]
+#endif
+    public static void Main()
+    {
+        var example = new Example();
+        example.Launch();
     }
 }
diff --git a/reference/csharp/eina/src/eina_value.cs 
b/reference/csharp/eina/src/eina_value.cs
index 3f3308ea..2e277f54 100644
--- a/reference/csharp/eina/src/eina_value.cs
+++ b/reference/csharp/eina/src/eina_value.cs
@@ -9,7 +9,7 @@
 
 using System;
 
-public class Example
+public class Example : Efl.Csharp.Application
 {
     static void ValueInt()
     {
@@ -47,10 +47,8 @@ public class Example
         Console.WriteLine("str_val was \"{0}\", converted to int is {1}", 
str_val, int_val);
     }
 
-    public static void Main()
+    protected override void OnInitialize(Eina.Array<System.String> args)
     {
-        Efl.All.Init();
-
         ValueInt();
         Console.WriteLine("");
 
@@ -60,6 +58,15 @@ public class Example
         ValueConvert();
         Console.WriteLine("");
 
-        Efl.All.Shutdown();
+        Efl.App.AppMain.Quit(0);
+    }
+
+#if WIN32
+    [STAThreadAttribute()]
+#endif
+    public static void Main()
+    {
+        var example = new Example();
+        example.Launch();
     }
 }
diff --git a/reference/csharp/ui/src/focus_main.cs 
b/reference/csharp/ui/src/focus_main.cs
index d5948bdf..bd0e210c 100644
--- a/reference/csharp/ui/src/focus_main.cs
+++ b/reference/csharp/ui/src/focus_main.cs
@@ -1,20 +1,14 @@
 using System;
 
-public class Example
+public class Example : Efl.Csharp.Application
 {
     public static void FocusChangedCb(object sender, EventArgs e)
     {
         Console.WriteLine($"Focus for object {((Efl.IText)sender).GetText()} 
changed to {((Efl.Ui.Widget)sender).GetFocus()}");
     }
 
-#if WIN32
-    [STAThreadAttribute()]
-#endif
-    public static void Main()
+    protected override void OnInitialize(Eina.Array<System.String> args)
     {
-        // Initialize EFL and all UI components
-        Efl.All.Init(Efl.Components.Ui);
-
         // Create a window and initialize it
         var win = new Efl.Ui.Win(null);
         win.SetWinType(Efl.Ui.WinType.Basic);
@@ -71,12 +65,15 @@ public class Example
 
         // Show the focus highlight
         win.SetFocusHighlightEnabled(true);
+    }
 
-        // Start the EFL main loop
-        Efl.Ui.Config.Run();
-
-        // Shutdown EFL
-        Efl.All.Shutdown();
+#if WIN32
+    [STAThreadAttribute()]
+#endif
+    public static void Main()
+    {
+        var example = new Example();
+        example.Launch();
     }
 }
 
diff --git a/reference/csharp/ui/src/ui_container.cs 
b/reference/csharp/ui/src/ui_container.cs
index fd1bdf15..609bfb36 100644
--- a/reference/csharp/ui/src/ui_container.cs
+++ b/reference/csharp/ui/src/ui_container.cs
@@ -7,7 +7,7 @@
 
 using System;
 
-public class Example
+public class Example : Efl.Csharp.Application
 {
     // Create a box container full of buttons
     static Efl.Ui.Box CreateBox(Efl.Ui.Win win)
@@ -57,14 +57,8 @@ public class Example
         return table;
     }
 
-#if WIN32
-    [STAThreadAttribute()]
-#endif
-    public static void Main()
+    protected override void OnInitialize(Eina.Array<System.String> args)
     {
-        // Initialize EFL and all UI components
-        Efl.All.Init(Efl.Components.Ui);
-
         // Create a window and initialize it
         Efl.Ui.Win win = new Efl.Ui.Win(null);
         win.SetWinType(Efl.Ui.WinType.Basic);
@@ -110,12 +104,15 @@ public class Example
             Efl.Ui.Config.Exit();
         };
         
Efl.IContentConcrete.static_cast(hsplit.GetPart("second")).SetContent(quit_btn);
+    }
 
-        // Start the EFL main loop
-        Efl.Ui.Config.Run();
-
-        // Shutdown EFL
-        Efl.All.Shutdown();
+#if WIN32
+    [STAThreadAttribute()]
+#endif
+    public static void Main()
+    {
+        var example = new Example();
+        example.Launch();
     }
 }
 
diff --git a/reference/csharp/ui/src/ui_sizing.cs 
b/reference/csharp/ui/src/ui_sizing.cs
index f84fc4bd..96a2b967 100644
--- a/reference/csharp/ui/src/ui_sizing.cs
+++ b/reference/csharp/ui/src/ui_sizing.cs
@@ -8,16 +8,10 @@
 
 using System;
 
-public class Example
+public class Example : Efl.Csharp.Application
 {
-#if WIN32
-    [STAThreadAttribute()]
-#endif
-    public static void Main()
+    protected override void OnInitialize(Eina.Array<System.String> args)
     {
-        // Initialize EFL and all UI components
-        Efl.All.Init(Efl.Components.Ui);
-
         // Create a window and initialize it
         Efl.Ui.Win win = new Efl.Ui.Win(null);
         win.SetWinType(Efl.Ui.WinType.Basic);
@@ -49,12 +43,15 @@ public class Example
         button.SetText("Big button");
         button.SetHintSizeMin(new Eina.Size2D(100,100));
         box.DoPack(button);
+    }
 
-        // Start the EFL main loop
-        Efl.Ui.Config.Run();
-
-        // Shutdown EFL
-        Efl.All.Shutdown();
+#if WIN32
+    [STAThreadAttribute()]
+#endif
+    public static void Main()
+    {
+        var example = new Example();
+        example.Launch();
     }
 }
 
diff --git a/tutorial/csharp/eo-intro/src/eo_intro_main.cs 
b/tutorial/csharp/eo-intro/src/eo_intro_main.cs
index db9ce451..4aa8ac63 100644
--- a/tutorial/csharp/eo-intro/src/eo_intro_main.cs
+++ b/tutorial/csharp/eo-intro/src/eo_intro_main.cs
@@ -1,6 +1,6 @@
 using System;
 
-public class Example
+public class Example : Efl.Csharp.Application
 {
     static Efl.GenericModel root, child2;
 
@@ -32,16 +32,23 @@ public class Example
         child2.Dispose();
     }
 
-    public static void Main()
+    protected override void OnInitialize(Eina.Array<System.String> args)
     {
-        Efl.All.Init(Efl.Components.Ui);
-
         // Create all objects
         ObjCreate();
 
         // Destroy all objects
         ObjDestroy();
 
-        Efl.All.Shutdown();
+        Efl.App.AppMain.Quit(0);
+    }
+
+#if WIN32
+    [STAThreadAttribute()]
+#endif
+    public static void Main()
+    {
+        var example = new Example();
+        example.Launch();
     }
 }
diff --git a/tutorial/csharp/hello-gui/src/gui_main.cs 
b/tutorial/csharp/hello-gui/src/gui_main.cs
index 28ce619f..4000c9b9 100644
--- a/tutorial/csharp/hello-gui/src/gui_main.cs
+++ b/tutorial/csharp/hello-gui/src/gui_main.cs
@@ -1,23 +1,17 @@
 using System;
 
-public class Example
+public class Example : Efl.Csharp.Application
 {
     // Callback to quit the application
     public static void QuitCb(object sender, 
Efl.Gfx.IEntityVisibilityChangedEvt_Args e)
     {
         // Exit the EFL main loop
         if (e.arg == false)
-          Efl.Ui.Config.Exit();
+          Efl.App.AppMain.Quit(0);
     }
 
-#if WIN32
-    [STAThreadAttribute()]
-#endif
-    public static void Main()
+    protected override void OnInitialize(Eina.Array<System.String> args)
     {
-        // Initialize EFL and all UI components
-        Efl.All.Init(Efl.Components.Ui);
-
         // Create a window and initialize it
         Efl.Ui.Win win = new Efl.Ui.Win(Efl.App.AppMain);
         // Set the window's title
@@ -52,15 +46,18 @@ public class Example
         button.SetText("Quit");
         button.SetHintWeight(1.0, 0.1);
         // Set the method to be called when the button is pressed
-        button.ClickedEvt += (object sender, EventArgs e) => { 
Efl.Ui.Config.Exit(); };
+        button.ClickedEvt += (object sender, EventArgs e) => { 
Efl.App.AppMain.Quit(0); };
         // Add the button to the box container
         box.DoPack(button);
+    }
 
-        // Start the EFL main loop
-        Efl.Ui.Config.Run();
-
-        // Shutdown EFL
-        Efl.All.Shutdown();
+#if WIN32
+    [STAThreadAttribute()]
+#endif
+    public static void Main()
+    {
+        var example = new Example();
+        example.Launch();
     }
 }
 
diff --git a/tutorial/csharp/hello-world/src/hello-world.cs 
b/tutorial/csharp/hello-world/src/hello-world.cs
index a490f921..5d1695fb 100644
--- a/tutorial/csharp/hello-world/src/hello-world.cs
+++ b/tutorial/csharp/hello-world/src/hello-world.cs
@@ -1,15 +1,9 @@
 using System;
 
-public class Example
+public class Example : Efl.Csharp.Application
 {
-#if WIN32
-    [STAThreadAttribute()]
-#endif
-    public static void Main()
+    protected override void OnInitialize(Eina.Array<System.String> args)
     {
-        // Initialize EFL and all UI components
-        Efl.All.Init(Efl.Components.Ui);
-
         // Create a window and initialize it
         Efl.Ui.Win win = new Efl.Ui.Win(Efl.App.AppMain);
         // Set the window's title
@@ -20,11 +14,14 @@ public class Example
         // Window size must be explicitly set, otherwise it will be invisible
         // due to its lack of content.
         win.SetSize(new Eina.Size2D(360, 240));
+    }
 
-        // Start the EFL main loop
-        Efl.Ui.Config.Run();
-
-        // Shutdown EFL
-        Efl.All.Shutdown();
+#if WIN32
+    [STAThreadAttribute()]
+#endif
+    public static void Main()
+    {
+        var example = new Example();
+        example.Launch();
     }
 }

-- 


Reply via email to