eo_mono: add eo-intro tutorial for C#

This commit is contained in:
Vitor Sousa 2018-02-26 14:09:07 -03:00
parent 6009c1046c
commit e989e18864
3 changed files with 72 additions and 0 deletions

View File

@ -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')

View File

@ -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();
}
}

View File

@ -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
)