diff options
Diffstat (limited to 'Samples')
| -rw-r--r-- | Samples/HelloWorld/main.cs | 33 | ||||
| -rw-r--r-- | Samples/ShowCase/main.cs | 18 | ||||
| -rwxr-xr-x | Samples/common/ui/Interfaces/Container/1.crow | 4 | ||||
| -rwxr-xr-x | Samples/common/ui/Interfaces/Container/3.crow | 4 | ||||
| -rwxr-xr-x | Samples/common/ui/Interfaces/Divers/testBind0.crow | 2 | ||||
| -rwxr-xr-x | Samples/common/ui/Interfaces/TemplatedContainer/test_Listbox.crow | 2 | ||||
| -rwxr-xr-x | Samples/common/ui/Interfaces/TemplatedControl/testCombobox.crow | 2 |
7 files changed, 49 insertions, 16 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; + } + } } diff --git a/Samples/ShowCase/main.cs b/Samples/ShowCase/main.cs index c6ffc408..a2b263fe 100644 --- a/Samples/ShowCase/main.cs +++ b/Samples/ShowCase/main.cs @@ -45,18 +45,22 @@ namespace tests using (Showcase app = new Showcase ()) { //app.Keyboard.KeyDown += App_KeyboardKeyDown; - Widget g = app.Load ("#ShowCase.showcase.crow"); - g.DataSource = app; - app.crowContainer = g.FindByName ("CrowContainer") as Container; - //I set an empty object as datasource at this level to force update when new - //widgets are added to the interface - app.crowContainer.DataSource = new object (); - app.hideError (); app.Run (); } } + protected override void Startup () + { + Widget g = Load ("#ShowCase.showcase.crow"); + g.DataSource = this; + crowContainer = g.FindByName ("CrowContainer") as Container; + //I set an empty object as datasource at this level to force update when new + //widgets are added to the interface + crowContainer.DataSource = new object (); + hideError (); + } + static void App_KeyboardKeyDown (object sender, KeyEventArgs e) { #if DEBUG_LOG diff --git a/Samples/common/ui/Interfaces/Container/1.crow b/Samples/common/ui/Interfaces/Container/1.crow index 19af5237..df935b1d 100755 --- a/Samples/common/ui/Interfaces/Container/1.crow +++ b/Samples/common/ui/Interfaces/Container/1.crow @@ -1,5 +1,5 @@ <?xml version="1.0"?> -<Container Background="Yellow" Margin="10" Width="90%" Height="90%"> - <Widget Margin="10" Width="50%" Height="50%" Background="Yellow" +<Container Background="Blue" Margin="1" Width="90%" Height="90%"> + <Widget Margin="1" Width="50%" Height="50%" Background="Red" MinimumSize="50,50"/> </Container>
\ No newline at end of file diff --git a/Samples/common/ui/Interfaces/Container/3.crow b/Samples/common/ui/Interfaces/Container/3.crow index 94655ca3..5ca515a8 100755 --- a/Samples/common/ui/Interfaces/Container/3.crow +++ b/Samples/common/ui/Interfaces/Container/3.crow @@ -1,4 +1,4 @@ <?xml version="1.0"?> -<Container Background="DimGrey" Margin="10" Fit="true"> - <Label Text="{fps}" Margin="10" Fit="true" Background="SeaGreen"/> +<Container Background="Blue" Margin="10" Fit="true"> + <Label Text="tes" Margin="10" Fit="true" Background="SeaGreen"/> </Container>
\ No newline at end of file diff --git a/Samples/common/ui/Interfaces/Divers/testBind0.crow b/Samples/common/ui/Interfaces/Divers/testBind0.crow index d8991c71..5d8f226c 100755 --- a/Samples/common/ui/Interfaces/Divers/testBind0.crow +++ b/Samples/common/ui/Interfaces/Divers/testBind0.crow @@ -1,5 +1,5 @@ <?xml version="1.0"?> <VerticalStack Fit="true"> <TextBox Text="{Datas}" Width="100" /> - <Button Text="Set Text to Null" MouseClick="onSetDataToNull"/> + <Button Caption="Set Text to Null" MouseClick="onSetDataToNull"/> </VerticalStack>
\ No newline at end of file diff --git a/Samples/common/ui/Interfaces/TemplatedContainer/test_Listbox.crow b/Samples/common/ui/Interfaces/TemplatedContainer/test_Listbox.crow index 47adb8ce..90fccf4f 100755 --- a/Samples/common/ui/Interfaces/TemplatedContainer/test_Listbox.crow +++ b/Samples/common/ui/Interfaces/TemplatedContainer/test_Listbox.crow @@ -6,7 +6,7 @@ <Label Text="{Hover}" Background="DarkGreen"/> <Button Caption="Clear" Width="Stretched" MouseClick="OnClear"/> <ListBox Name="ColorList" Data="{TestList}" Width="200" Height="200" - ItemTemplate="#Tests.Interfaces.colorItem.crow"> + ItemTemplate="Interfaces/colorItem.crow"> </ListBox> <Button Caption="Load list" Width="Stretched" MouseClick="OnLoadList"/> </VerticalStack> diff --git a/Samples/common/ui/Interfaces/TemplatedControl/testCombobox.crow b/Samples/common/ui/Interfaces/TemplatedControl/testCombobox.crow index 4363986e..4bfb41fb 100755 --- a/Samples/common/ui/Interfaces/TemplatedControl/testCombobox.crow +++ b/Samples/common/ui/Interfaces/TemplatedControl/testCombobox.crow @@ -1,4 +1,4 @@ <?xml version="1.0"?> <Container Background="DimGrey" Width="300"> - <ComboBox Data="{TestList}" ItemTemplate="#Tests.Interfaces.colorItem.crow"/> + <ComboBox Data="{TestList}" ItemTemplate="Interfaces/colorItem.crow"/> </Container>
\ No newline at end of file |