summaryrefslogtreecommitdiff
path: root/tutorial/csharp/eo-intro/src/eo_intro_main.cs
blob: b5ee7730769cc298cbb0db97fba4007b4d9902c0 (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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
using System;

public class Example : Efl.Csharp.Application
{
    static Efl.GenericModel root, child2;

    // Create our test hierarchy
    static void ObjCreate()
    {
        // First create a root element
        root = new Efl.GenericModel(null);
        root.SetName("Root");

        // Create the first child element
        var child = new Efl.GenericModel(root);
        child.SetName("Child1");

        // Create the second child element, this time, with an extra reference
        child2 = new Efl.GenericModel(root);
        child2.SetName("Child2");
    }

    // Destroy the test hierarchy
    static void ObjDestroy()
    {
        // Destroy the root element
        Console.WriteLine ("Deleting Root...\n");
        root.Dispose();

        // Destroy the child2 element, for which we were keeping an extra reference
        Console.WriteLine ("Deleting Child2...\n");
        child2.Dispose();
    }

    protected override void OnInitialize(string[] args)
    {
        // Create all objects
        ObjCreate();

        // Destroy all objects
        ObjDestroy();

        Efl.App.AppMain.Quit(0);
    }

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