summaryrefslogtreecommitdiff
path: root/unsorted/ecore/efl_loop_callback_add_event.cs
blob: fe81bfd9adc1f3a0f0c8c3f377f1add8bf83bef9 (plain) (blame)
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
using System;
using System.Runtime.InteropServices;
using System.Runtime.CompilerServices;

class TestMain
{
    /* private efl.Loop loop; */

    public TestMain(efl.Loop loop)
    {
        /* this.loop = loop; */
    }

    static void Main(string[] args)
    {
        efl.All.Init();

        efl.Loop loop = new efl.LoopConcrete();

        TestMain listener = new TestMain(loop);

        loop.CALLBACK_ADD += listener.callback_added_cb;

        loop.CALLBACK_ADD += listener.on_idle_enter;
        loop.CALLBACK_ADD -= listener.on_idle_enter;

        loop.IDLE += listener.on_idle_enter; // Will trigger CALLBACK_ADD

        efl.All.Shutdown();
    }

    public void on_idle_enter(object sender, EventArgs e)
    {
        Console.WriteLine("I should not be called while the loop is not running...");
    }

    public void callback_added_cb(object sender, EventArgs e)
    {
        Console.WriteLine("Looks like we added a new callback.");
    }
}