examples/tutorial/csharp/hello-gui/src/gui_main.cs

54 lines
1.3 KiB
C#

using System;
public class Example
{
public static void QuitCb(object sender, EventArgs e)
{
efl.ui.Config.Exit();
}
public static void Main()
{
efl.All.Init(efl.Components.Ui);
efl.ui.IWin win = new efl.ui.Win(null, (efl.ui.IWin ewin) => {
ewin.SetWinType(efl.ui.Win_Type.Basic);
ewin.SetText("Hello World");
ewin.SetAutohide(true);
});
// when the user clicks "close" on a window there is a request to hide
win.HideEvt += QuitCb;
efl.ui.IBox box = new efl.ui.Box(win);
eina.Size2D sz;
sz.W = 360;
sz.H = 240;
box.SetHintMin(sz);
win.SetContent(box);
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
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);
box.DoPack(text);
efl.ui.IButton button = new efl.ui.Button(box);
button.SetText("Quit");
button.SetHintWeight(1.0, 0.1);
button.ClickedEvt += QuitCb;
box.DoPack(button);
efl.ui.Config.Run();
efl.All.Shutdown();
}
}