summaryrefslogtreecommitdiff
path: root/tutorial/csharp/hello-world/src/hello-world.cs
blob: 2eac0bfe8a98fe6ad1072173a1078a4e66add2a7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
using System;

public class Example : Efl.Csharp.Application
{
    // Callback to quit the application
    public static void QuitCb(object sender, Efl.Gfx.EntityVisibilityChangedEventArgs e)
    {
        // Exit the EFL main loop
        if (e.arg == false)
          Efl.App.AppMain.Quit(0);
    }

    protected override void OnInitialize(string[] args)
    {
        // Create a window and initialize it
        Efl.Ui.Win win = new Efl.Ui.Win(Efl.App.AppMain);
        // Set the window's title
        win.SetText("Hello World");
        // Request that the window is automatically hidden when the "close"
        // button is pressed
        win.SetAutohide(true);
        // Window size must be explicitly set, otherwise it will be invisible
        // due to its lack of content.
        win.SetSize(new Eina.Size2D(360, 240));
        win.VisibilityChangedEvent += QuitCb;
    }

#if WIN32
    [STAThreadAttribute()]
#endif
    public static void Main()
    {
        var example = new Example();
        example.Launch();
    }
}