Ooui-tws-port/Ooui.Wasm/ooui-sample.cs

39 lines
719 B
C#
Raw Normal View History

2018-03-09 23:58:17 +00:00
using System;
using Ooui;
2018-03-10 00:44:10 +00:00
public class Program
{
static Element GetButtonElement ()
{
var l = new Label { Text = "Hello" };
var b = new Button ("Click Me");
var e = new Div (new Div (l), b);
int count = 0;
b.Click += (s, ee) => {
count++;
b.Text = $"Clicked {count} times";
};
return e;
}
2018-03-13 03:56:43 +00:00
static Element GetXamarinFormsElement ()
{
2018-03-13 03:56:43 +00:00
var s = new Samples.XamlPreviewPageSample ();
return s.CreateElement ();
}
2018-03-10 00:44:10 +00:00
public static string Main (string a0, string a1)
{
Xamarin.Forms.Forms.Init ();
2018-03-09 23:58:17 +00:00
try {
2018-03-13 03:56:43 +00:00
var e = GetXamarinFormsElement ();
2018-03-10 00:44:10 +00:00
UI.SetGlobalElement ("main", e);
return e.ToString ();
2018-03-09 23:58:17 +00:00
}
catch (Exception e) {
Console.WriteLine (e);
return e.ToString ();
}
}
}