summaryrefslogtreecommitdiff
path: root/tutorial/csharp/eo-intro
diff options
context:
space:
mode:
authorVitor Sousa <vitorsousasilva@gmail.com>2018-02-26 14:09:07 -0300
committerVitor Sousa <vitorsousasilva@gmail.com>2018-02-26 14:09:07 -0300
commite989e18864af37cb05b733d29d803070f36eed22 (patch)
tree003581666f005eef6b4b2bb9ead3a8cf730599e3 /tutorial/csharp/eo-intro
parent6009c1046cb77de93c5bcd524e73897d4dbcfa33 (diff)
eo_mono: add eo-intro tutorial for C#
Diffstat (limited to 'tutorial/csharp/eo-intro')
-rw-r--r--tutorial/csharp/eo-intro/meson.build10
-rw-r--r--tutorial/csharp/eo-intro/src/eo_intro_main.cs50
-rw-r--r--tutorial/csharp/eo-intro/src/meson.build12
3 files changed, 72 insertions, 0 deletions
diff --git a/tutorial/csharp/eo-intro/meson.build b/tutorial/csharp/eo-intro/meson.build
new file mode 100644
index 0000000..6177eb5
--- /dev/null
+++ b/tutorial/csharp/eo-intro/meson.build
@@ -0,0 +1,10 @@
1project(
2 'efl-example-eo-intro', 'cs',
3 version : '0.0.1',
4 meson_version : '>= 0.38.0')
5
6efl_mono = dependency('efl-mono', version : '>=1.20.99')
7efl_mono_libs = efl_mono.get_pkgconfig_variable('mono_libs')
8
9subdir('src')
10
diff --git a/tutorial/csharp/eo-intro/src/eo_intro_main.cs b/tutorial/csharp/eo-intro/src/eo_intro_main.cs
new file mode 100644
index 0000000..fc5e68e
--- /dev/null
+++ b/tutorial/csharp/eo-intro/src/eo_intro_main.cs
@@ -0,0 +1,50 @@
1
2public class Example
3{
4 efl.model.Item root, child2;
5
6 // Create our test hierarchy
7 static void ObjCreate()
8 {
9 // First create a root element
10 root = new efl.model.Item(null, (efl.model.Item eroot) => {
11 eroot.SetName("Root");
12 });
13
14 // Create the first child element
15 new efl.model.Item(root, (efl.model.Item eroot) => {
16 eroot.SetName("Child1");
17 });
18
19 // Create the second child element, this time, with an extra reference
20 child2 = new efl.model.Item(root, (efl.model.Item eroot) => {
21 eroot.SetName("Child2");
22 });
23 }
24
25 // Destroy the test hierarchy
26 static void ObjDestroy()
27 {
28 // Destroy the root element
29 printf ("Deleting Root...\n");
30 efl_unref(root);
31 root.Dispose();
32
33 // Destroy the child2 element, for which we were keeping an extra reference
34 printf ("Deleting Child2...\n");
35 child2.Dispose();
36 }
37
38 public static void Main()
39 {
40 efl.All.Init(efl.Components.Ui);
41
42 // Create all objects
43 ObjCreate();
44
45 // Destroy all objects
46 ObjDestroy();
47
48 efl.All.Shutdown();
49 }
50} \ No newline at end of file
diff --git a/tutorial/csharp/eo-intro/src/meson.build b/tutorial/csharp/eo-intro/src/meson.build
new file mode 100644
index 0000000..10b14e1
--- /dev/null
+++ b/tutorial/csharp/eo-intro/src/meson.build
@@ -0,0 +1,12 @@
1src = files([
2 'eo_intro_main.cs',
3])
4
5deps = [efl_mono]
6
7executable('efl_example_eo_intro', src,
8 dependencies : deps,
9 cs_args : efl_mono_libs,
10 install : true
11)
12