diff options
| author | Jean-Philippe Bruyère <jp_bruyere@hotmail.com> | 2019-08-21 16:03:14 +0200 |
|---|---|---|
| committer | Jean-Philippe Bruyère <jp_bruyere@hotmail.com> | 2019-08-21 16:03:14 +0200 |
| commit | c39fc133477d483648ce05cc1c656d9cdf2e1d3b (patch) | |
| tree | 1b7529c667166a57a2ed6f59b629be8c9727b5e1 /Samples/HelloWorld/main.cs | |
| parent | 351fcf0e73381f5dfba14185f1aaea592f9283c4 (diff) | |
Cairo namespace renamed to Crow.Cairo to avoid md addins fault
Diffstat (limited to 'Samples/HelloWorld/main.cs')
| -rw-r--r-- | Samples/HelloWorld/main.cs | 33 |
1 files changed, 31 insertions, 2 deletions
diff --git a/Samples/HelloWorld/main.cs b/Samples/HelloWorld/main.cs index a9d48fc9..14a1a2ad 100644 --- a/Samples/HelloWorld/main.cs +++ b/Samples/HelloWorld/main.cs @@ -1,13 +1,42 @@ -using Crow; +using System; +using Crow; namespace HelloWorld { class Program : Interface { + Command CMDQuit; static void Main (string[] args) { using (Program vke = new Program ()) { - vke.Load ("#HelloWorld.helloworld.crow"); vke.Run (); } } + protected override void Startup () + { + CMDQuit = new Command (new Action (() => running = false)) { Caption = "Quit", Icon = new SvgPicture ("#Crow.Icons.exit-symbol.svg") }; + + Widget w = Load ("#HelloWorld.helloworld.crow"); + w.KeyPress += W_KeyPress; + w.DataSource = this; + } + + Color [] colors = { Color.Blue, Color.DarkGoldenRod, Color.Red, Color.Azure, Color.Brown, Color.Black, Color.White, Color.Pink }; + int ptr = 0; + + void W_KeyPress (object sender, KeyPressEventArgs e) + { + switch (e.KeyChar) { + case 'w': + LoadIMLFragment ($"<DockWindow Name='win{ptr}' Left='450' Top='450' Width='150' Height='150' Background='{colors [ptr]}'/>"); + break; + case 'x': + LoadIMLFragment ($"<Window Name='win{ptr}' Left='450' Top='450' Width='150' Height='150' Background='{colors [ptr]}'/>"); + break; + } + + ptr++; + if (ptr == colors.Length) + ptr = 0; + } + } } |