examples/tutorial/csharp/eo-intro/src/eo_intro_main.cs

51 lines
1.2 KiB
C#

using System;
public class Example
{
static efl.IModel_Item root, child2;
// Create our test hierarchy
static void ObjCreate()
{
// First create a root element
root = new efl.Model_Item(null, (efl.IModel_Item eroot) => {
eroot.SetName("Root");
});
// Create the first child element
new efl.Model_Item(root, (efl.IModel_Item eroot) => {
eroot.SetName("Child1");
});
// Create the second child element, this time, with an extra reference
child2 = new efl.Model_Item(root, (efl.IModel_Item eroot) => {
eroot.SetName("Child2");
});
}
// Destroy the test hierarchy
static void ObjDestroy()
{
// Destroy the root element
Console.WriteLine ("Deleting Root...\n");
root.Dispose();
// Destroy the child2 element, for which we were keeping an extra reference
Console.WriteLine ("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();
}
}