summaryrefslogtreecommitdiff
path: root/unsorted/ecore/efl_loop_callback_add_event.cs
blob: f0a52628713f8eda4c610c4dcd7c586fd0394375 (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.");
    }
}