summaryrefslogtreecommitdiff
path: root/tutorial/csharp/eo-intro/src/eo_intro_main.cs
blob: 0a7779af8712fa2032750e737dbeee955d4975a1 (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
using System;

public class Example
{
    static Efl.ModelItem root, child2;

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

        // Create the first child element
        new Efl.ModelItem(root, (Efl.ModelItem eroot) => {
            eroot.SetName("Child1");
        });

        // Create the second child element, this time, with an extra reference
        child2 = new Efl.ModelItem(root, (Efl.ModelItem eroot) => {
            eroot.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();
    }

    public static void Main()
    {
        Efl.All.Init(Efl.Components.Ui);

        // Create all objects
        ObjCreate();

        // Destroy all objects
        ObjDestroy();

        Efl.All.Shutdown();
    }
}