summaryrefslogtreecommitdiff
path: root/reference/csharp/core
diff options
context:
space:
mode:
authorXavi Artigas <xavierartigas@yahoo.es>2019-01-18 16:53:55 +0100
committerXavi Artigas <xavierartigas@yahoo.es>2019-01-23 14:49:38 +0100
commit500049f1eb376dbd0b07a3688546c4f11a567d6b (patch)
treeac687fb0badf8c5c3aefe45e816bf1735e44a0af /reference/csharp/core
parente674ff0d9754586e7f0c2413327c3383ab3ad7ae (diff)
mono-examples: Adapt to latest syntax
Summary: Removed initializer methods as much as possible to prepare for when they are removed from the C# bindings. No functional changes in the examples. Tutorial text needs to be adapted now. Test Plan: All examples work as before (the containers one is currently broken, FML). Reviewers: lauromoura, felipealmeida, vitor.sousa Reviewed By: lauromoura Maniphest Tasks: T7508 Differential Revision: https://phab.enlightenment.org/D7695
Diffstat (limited to 'reference/csharp/core')
-rw-r--r--reference/csharp/core/src/core_event.cs48
-rw-r--r--reference/csharp/core/src/core_idler.cs10
-rw-r--r--reference/csharp/core/src/core_poll.cs10
3 files changed, 34 insertions, 34 deletions
diff --git a/reference/csharp/core/src/core_event.cs b/reference/csharp/core/src/core_event.cs
index 20f38b7..2cb6d8e 100644
--- a/reference/csharp/core/src/core_event.cs
+++ b/reference/csharp/core/src/core_event.cs
@@ -31,33 +31,33 @@ public class Example
31 mainloop.PollHighEvt += PollCb; 31 mainloop.PollHighEvt += PollCb;
32 32
33 // This timer will control events fired by the main loop 33 // This timer will control events fired by the main loop
34 new Efl.LoopTimer(mainloop, (Efl.LoopTimer etimer) => { 34 var timer = new Efl.LoopTimer(mainloop, (Efl.LoopTimer etimer) => {
35 etimer.SetName("Timer");
36 // Trigger every 100ms 35 // Trigger every 100ms
37 etimer.SetInterval(0.1); 36 etimer.SetInterval(0.1);
38 // To count number of timer triggers
39 int tick_count = 0;
40 etimer.TickEvt += (object sender, EventArgs e) => {
41 string message = "Tick {0} from {1}: ";
42 // Depending on the number of timer ticks, it does a different thing
43 switch (tick_count) {
44 case 0:
45 message += "Freezing Mainloop events";
46 mainloop.FreezeEvent();
47 break;
48 case 1:
49 message += "Thawing Mainloop events";
50 mainloop.ThawEvent();
51 break;
52 default:
53 message += "Quitting";
54 mainloop.Quit(new Eina.Value(0));
55 break;
56 }
57 Console.WriteLine(message, tick_count, ((Efl.Object)sender).GetName());
58 tick_count++;
59 };
60 }); 37 });
38 timer.SetName("Timer");
39 // To count number of timer triggers
40 int tick_count = 0;
41 timer.TickEvt += (object sender, EventArgs e) => {
42 string message = "Tick {0} from {1}: ";
43 // Depending on the number of timer ticks, it does a different thing
44 switch (tick_count) {
45 case 0:
46 message += "Freezing Mainloop events";
47 mainloop.FreezeEvent();
48 break;
49 case 1:
50 message += "Thawing Mainloop events";
51 mainloop.ThawEvent();
52 break;
53 default:
54 message += "Quitting";
55 mainloop.Quit(new Eina.Value(0));
56 break;
57 }
58 Console.WriteLine(message, tick_count, ((Efl.Object)sender).GetName());
59 tick_count++;
60 };
61 61
62 Console.WriteLine("Waiting for Timer to call back..."); 62 Console.WriteLine("Waiting for Timer to call back...");
63 63
diff --git a/reference/csharp/core/src/core_idler.cs b/reference/csharp/core/src/core_idler.cs
index 85c5f45..e8853e5 100644
--- a/reference/csharp/core/src/core_idler.cs
+++ b/reference/csharp/core/src/core_idler.cs
@@ -34,14 +34,14 @@ public class Example
34 }; 34 };
35 35
36 // Use a timer to exit the application 36 // Use a timer to exit the application
37 new Efl.LoopTimer(mainloop, (Efl.LoopTimer etimer) => { 37 var timer = new Efl.LoopTimer(mainloop, (Efl.LoopTimer etimer) => {
38 // Trigger after 10ms 38 // Trigger after 10ms
39 etimer.SetInterval(0.01); 39 etimer.SetInterval(0.01);
40 etimer.TickEvt += (object sender, EventArgs e) => {
41 Console.WriteLine("TIMER: timer callback called, exiting.");
42 mainloop.Quit(new Eina.Value(0));
43 };
44 }); 40 });
41 timer.TickEvt += (object sender, EventArgs e) => {
42 Console.WriteLine("TIMER: timer callback called, exiting.");
43 mainloop.Quit(new Eina.Value(0));
44 };
45 45
46 // Start the EFL main loop (and the experiment) 46 // Start the EFL main loop (and the experiment)
47 mainloop.Begin(); 47 mainloop.Begin();
diff --git a/reference/csharp/core/src/core_poll.cs b/reference/csharp/core/src/core_poll.cs
index 6c7c16a..3ecf7bc 100644
--- a/reference/csharp/core/src/core_poll.cs
+++ b/reference/csharp/core/src/core_poll.cs
@@ -33,14 +33,14 @@ public class Example
33 }; 33 };
34 34
35 // Use a timer to exit the application 35 // Use a timer to exit the application
36 new Efl.LoopTimer(mainloop, (Efl.LoopTimer etimer) => { 36 var timer = new Efl.LoopTimer(mainloop, (Efl.LoopTimer etimer) => {
37 // Trigger after 30s 37 // Trigger after 30s
38 etimer.SetInterval(30); 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 }); 39 });
40 timer.TickEvt += (object sender, EventArgs e) => {
41 Console.WriteLine("\nTIMER: timer callback called, exiting.");
42 mainloop.Quit(new Eina.Value(0));
43 };
44 44
45 // Start the EFL main loop (and the experiment) 45 // Start the EFL main loop (and the experiment)
46 mainloop.Begin(); 46 mainloop.Begin();