Skip to content

Instantly share code, notes, and snippets.

@handicraftsman
Created June 25, 2019 19:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save handicraftsman/3d815b92bb8b5a04f08aca98285fc84d to your computer and use it in GitHub Desktop.
Save handicraftsman/3d815b92bb8b5a04f08aca98285fc84d to your computer and use it in GitHub Desktop.
Some more GUI stuff, in C#
using System;
using AirKit;
using AirKit.Layout;
using AirKit.Material;
namespace AirKit.Demo
{
class MainView : View
{
int value;
public override Element* Build()
{
return new MatScaffold(
appbar: new MatAppBar(
title: "AirKit Demo",
new LayCenter(
horizontal: true,
vertical: true,
new LayBox(
orientation: LayOrientation.VERTICAL,
new MatText(
text: $"I am ${value}"
),
new MatButtonBox(
new MatButton(
raised: true,
text: "Increment",
onClicked: () => {
update(() => {
value += 1;
});
}
),
new MatButton(
raised: true,
text: "Decrement",
onClicked: () => {
update(() => {
value -= 1;
});
}
)
)
)
)
)
);
}
}
class Program
{
[STAThread]
static void Main(string[] args)
{
var app = new Application(
name: "AirKit Demo",
mainView: new MainView()
);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment