csharp tutorials: Add comments to hello-world-gui

Reviewers: lauromoura, vitor.sousa

Reviewed By: vitor.sousa

Differential Revision: https://phab.enlightenment.org/D6892
devs/xartigas/fix_text_changed
Xavi Artigas 4 years ago committed by Vitor Sousa
parent f36e0f43da
commit f6cc19575f
  1. 24
      tutorial/csharp/hello-gui/src/gui_main.cs

@ -2,51 +2,71 @@ using System;
public class Example
{
// Callback to quit the application
public static void QuitCb(object sender, EventArgs e)
{
// Exit the EFL main loop
efl.ui.Config.Exit();
}
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);
// 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);
});
// when the user clicks "close" on a window there is a request to hide
// 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);
// Create a text label widget
efl.ui.IText text = new efl.ui.Text(box);
// text.SetMarkup("Hello World.<br>This is an <b>Efl.Ui</b> application!"); // TODO: Correct .eo inheritance
// 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);
// 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);
// Start the EFL main loop
efl.ui.Config.Run();
// Shutdown EFL
efl.All.Shutdown();
}
}

Loading…
Cancel
Save