diff --git a/tutorial/csharp/hello-gui/src/gui_main.cs b/tutorial/csharp/hello-gui/src/gui_main.cs index 0c125552..0c07b6f6 100644 --- a/tutorial/csharp/hello-gui/src/gui_main.cs +++ b/tutorial/csharp/hello-gui/src/gui_main.cs @@ -9,59 +9,55 @@ public class Example efl.ui.Config.Exit(); } +#if WIN32 + [STAThreadAttribute()] +#endif public static void Main() { // Initialize EFL and all UI components efl.All.Init(efl.Components.Ui); // Create a window and initialize it - efl.ui.IWin win = new efl.ui.Win(null, (efl.ui.IWin ewin) => { - // Request a simple window - ewin.SetWinType(efl.ui.Win_Type.Basic); + efl.ui.IWin win = new efl.ui.Win(efl.App.GetLoopMain(), (efl.ui.IWin ewin) => { // Set the window's title ewin.SetText("Hello World"); // Request that the window is automatically hidden when the "close" // button is pressed ewin.SetAutohide(true); + // Hook to the Hide event + ewin.HideEvt += QuitCb; }); - // Hook to the Hide event - win.HideEvt += QuitCb; - // Create a box container - efl.ui.IBox box = new efl.ui.Box(win); - // Set its minimum size - eina.Size2D sz; - sz.W = 360; - sz.H = 240; - box.SetHintMin(sz); - - // Set the box as the content for the window - // The window size will adapt to the box size - win.SetContent(box); + efl.ui.IBox box = new efl.ui.Box(win, (efl.ui.IBox ebox) => { + // Set its minimum size + ebox.SetHintMin(new eina.Size2D(360, 240)); + // Set the box as the content for the window + // The window size will adapt to the box size + win.SetContent(ebox); + }); // Create a text label widget - efl.ui.IText text = new efl.ui.Text(box); - // Set its content and customize it - text.SetText("Hello World. This is an Efl.Ui application!"); - text.SetSelectionAllowed(false); - text.SetHintWeight(1.0, 0.9); - text.SetHintAlign(0.5, 0.5); - - // Add the text to the box container - box.DoPack(text); + new efl.ui.Text(box, (efl.ui.IText etext) => { + // Set its content and customize it + etext.SetText("Hello World. This is an Efl.Ui application!"); + etext.SetSelectionAllowed(false); + etext.SetHintWeight(1.0, 0.9); + etext.SetHintAlign(0.5, 0.5); + // Add the text to the box container + box.DoPack(etext); + }); // Create a button widget - efl.ui.IButton button = new efl.ui.Button(box); - // Customize it - button.SetText("Quit"); - button.SetHintWeight(1.0, 0.1); - - // Set the method to be called when the button is pressed - button.ClickedEvt += QuitCb; - - // Add the button to the box container - box.DoPack(button); + new efl.ui.Button(box, (efl.ui.IButton ebutton) => { + // Customize it + ebutton.SetText("Quit"); + ebutton.SetHintWeight(1.0, 0.1); + // Set the method to be called when the button is pressed + ebutton.ClickedEvt += QuitCb; + // Add the button to the box container + box.DoPack(ebutton); + }); // Start the EFL main loop efl.ui.Config.Run();