summaryrefslogtreecommitdiff
path: root/reference/csharp/core
diff options
context:
space:
mode:
authorXavi Artigas <xavierartigas@yahoo.es>2018-09-06 11:46:02 -0300
committerVitor Sousa <vitorsousa@expertisesolutions.com.br>2018-09-06 12:01:25 -0300
commita473380cc78e2bbb79e2fce5b43114b0d211df33 (patch)
tree6107e0dd6c7e81656a0f99a79f930ccb5f11efc8 /reference/csharp/core
parentc371e6f7606c49787eb29f01f57e97b72b3ec308 (diff)
Add Polling tutorial
Reviewers: lauromoura, vitor.sousa, felipealmeida Reviewed By: vitor.sousa Differential Revision: https://phab.enlightenment.org/D6991
Diffstat (limited to 'reference/csharp/core')
-rw-r--r--reference/csharp/core/src/core_poll.cs51
-rw-r--r--reference/csharp/core/src/meson.build7
2 files changed, 58 insertions, 0 deletions
diff --git a/reference/csharp/core/src/core_poll.cs b/reference/csharp/core/src/core_poll.cs
new file mode 100644
index 0000000..a05e7b9
--- /dev/null
+++ b/reference/csharp/core/src/core_poll.cs
@@ -0,0 +1,51 @@
1/*
2 * Efl Core Poll examples.
3 *
4 * This example sets up poll callbacks for LOW, MEDIUM and HIGH frequency events.
5 * We run for 30 seconds and print to stdout to show when each is called.
6 * Depending on your system this may not include any LOW frequency polls.
7 */
8
9using System;
10
11public class Example
12{
13#if WIN32
14 [STAThreadAttribute()]
15#endif
16 public static void Main()
17 {
18 // Initialize EFL and all UI components
19 efl.All.Init();
20
21 // Retrieve the application's main loop
22 var mainloop = efl.App.GetLoopMain();
23
24 // Register to all Poll events
25 mainloop.PollLowEvt += (object sender, EventArgs e) => {
26 Console.Write("L");
27 };
28 mainloop.PollMediumEvt += (object sender, EventArgs e) => {
29 Console.Write("M");
30 };
31 mainloop.PollHighEvt += (object sender, EventArgs e) => {
32 Console.Write(".");
33 };
34
35 // Use a timer to exit the application
36 new efl.Loop_Timer(mainloop, (efl.ILoop_Timer etimer) => {
37 // Trigger after 30s
38 etimer.SetInterval(30);
39 etimer.TickEvt += (object sender, EventArgs e) => {
40 Console.WriteLine("\nTIMER: timer callback called, exiting.");
41 mainloop.Quit(new eina.Value(0));
42 };
43 });
44
45 // Start the EFL main loop (and the experiment)
46 mainloop.Begin();
47
48 // Shutdown EFL
49 efl.All.Shutdown();
50 }
51}
diff --git a/reference/csharp/core/src/meson.build b/reference/csharp/core/src/meson.build
index 3235e71..e4a6f37 100644
--- a/reference/csharp/core/src/meson.build
+++ b/reference/csharp/core/src/meson.build
@@ -13,3 +13,10 @@ executable('efl_reference_core_idler',
13 cs_args : efl_mono_libs, 13 cs_args : efl_mono_libs,
14 install : true 14 install : true
15) 15)
16
17executable('efl_reference_core_poll',
18 files(['core_poll.cs']),
19 dependencies : deps,
20 cs_args : efl_mono_libs,
21 install : true
22)