diff --git a/tutorial/csharp/eo-intro/meson.build b/tutorial/csharp/eo-intro/meson.build new file mode 100644 index 00000000..6177eb5a --- /dev/null +++ b/tutorial/csharp/eo-intro/meson.build @@ -0,0 +1,10 @@ +project( + 'efl-example-eo-intro', 'cs', + version : '0.0.1', + meson_version : '>= 0.38.0') + +efl_mono = dependency('efl-mono', version : '>=1.20.99') +efl_mono_libs = efl_mono.get_pkgconfig_variable('mono_libs') + +subdir('src') + 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 00000000..fc5e68ed --- /dev/null +++ b/tutorial/csharp/eo-intro/src/eo_intro_main.cs @@ -0,0 +1,50 @@ + +public class Example +{ + efl.model.Item root, child2; + + // Create our test hierarchy + static void ObjCreate() + { + // First create a root element + root = new efl.model.Item(null, (efl.model.Item eroot) => { + eroot.SetName("Root"); + }); + + // Create the first child element + new efl.model.Item(root, (efl.model.Item eroot) => { + eroot.SetName("Child1"); + }); + + // Create the second child element, this time, with an extra reference + child2 = new efl.model.Item(root, (efl.model.Item eroot) => { + eroot.SetName("Child2"); + }); + } + + // Destroy the test hierarchy + static void ObjDestroy() + { + // Destroy the root element + printf ("Deleting Root...\n"); + efl_unref(root); + root.Dispose(); + + // Destroy the child2 element, for which we were keeping an extra reference + printf ("Deleting Child2...\n"); + child2.Dispose(); + } + + public static void Main() + { + efl.All.Init(efl.Components.Ui); + + // Create all objects + ObjCreate(); + + // Destroy all objects + ObjDestroy(); + + efl.All.Shutdown(); + } +} \ 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 00000000..10b14e10 --- /dev/null +++ b/tutorial/csharp/eo-intro/src/meson.build @@ -0,0 +1,12 @@ +src = files([ + 'eo_intro_main.cs', +]) + +deps = [efl_mono] + +executable('efl_example_eo_intro', src, + dependencies : deps, + cs_args : efl_mono_libs, + install : true +) +