aboutsummaryrefslogtreecommitdiffstatsci
path: root/Samples
diff options
context:
space:
mode:
Diffstat (limited to 'Samples')
-rw-r--r--Samples/HelloWorld/main.cs36
-rw-r--r--Samples/HelloWorld/ui/helloworld.crow33
2 files changed, 37 insertions, 32 deletions
diff --git a/Samples/HelloWorld/main.cs b/Samples/HelloWorld/main.cs
index 44ec3fb8..3efd1096 100644
--- a/Samples/HelloWorld/main.cs
+++ b/Samples/HelloWorld/main.cs
@@ -1,14 +1,48 @@
using System;
+using System.Reflection;
+using System.Reflection.Emit;
using Crow;
+using Crow.IML;
namespace HelloWorld
{
class Program {
- static void Main (string[] args) {
+ /*static void Main (string[] args) {
using (Interface app = new Interface ()) {
app.Initialized += (sender, e) => (sender as Interface).Load ("#HelloWorld.helloworld.crow");
app.Run ();
}
+ }*/
+ public static void testMethod (Group w, Widget z) {
+ Console.WriteLine (w);
+ Console.WriteLine (z);
}
+ static void Main (string[] args) {
+ using (Interface app = new Interface ()) {
+ Instantiator inst = new Instantiator (app);
+ IMLContext ctx = new IMLContext (typeof (Widget));
+
+ ctx.EmitCreateWidget (typeof (Group));
+ MethodInfo mi = typeof (Program).GetMethod ("testMethod", BindingFlags.Static | BindingFlags.Public);
+ ctx.Emit (OpCodes.Ldloc_0);//load child on stack for parenting
+ ctx.il.Emit (OpCodes.Castclass, typeof (Group));
+
+ ctx.Emit (OpCodes.Dup);
+ ctx.EmitCreateWidget (typeof (Widget));
+ ctx.Emit (OpCodes.Ldloc_0);//load child on stack for parenting
+
+ ctx.il.Emit (OpCodes.Call, mi);
+ ctx.Emit (OpCodes.Stloc_0);
+
+ //ctx.Emit (OpCodes.Pop);
+ //ctx.Emit (OpCodes.Pop);
+
+ InstanciatorInvoker del = ctx.CreateDelegate (inst);
+
+ Widget w = (Widget)del (app);
+ Console.WriteLine ("widget ok");
+ }
+ }
+
}
}
diff --git a/Samples/HelloWorld/ui/helloworld.crow b/Samples/HelloWorld/ui/helloworld.crow
index 5c0fbbaf..25f27c2f 100644
--- a/Samples/HelloWorld/ui/helloworld.crow
+++ b/Samples/HelloWorld/ui/helloworld.crow
@@ -1,35 +1,6 @@
<?xml version="1.0"?>
-<VerticalStack Background="DimGrey">
- <ColorPicker Name="cp" Width="Stretched"/>
- <HorizontalStack Fit="True" Margin="10" Background="Jet">
- <Widget Width="100" Height="60" Background="{../../cp.CurrentColor}"/>
- <Widget Width="100" Height="60" Background="{../../cp.CurrentColor2}"/>
- </HorizontalStack>
- <HorizontalStack DataSource="{../cp.CurrentColor}" Fit="True" Margin="10" Background="Jet">
- <Label Width="100" Text="Red"/>
- <Label Width="100" Text="{R}"/>
- </HorizontalStack>
- <HorizontalStack DataSource="{../cp.CurrentColor}" Fit="True" Margin="10" Background="Jet">
- <Label Width="100" Text="Blue"/>
- <Label Width="100" Text="{B}"/>
- </HorizontalStack>
- <HorizontalStack DataSource="{../cp.CurrentColor}" Fit="True" Margin="10" Background="Jet">
- <Label Width="100" Text="Green"/>
- <Label Width="100" Text="{G}"/>
- </HorizontalStack>
- <HorizontalStack DataSource="{../cp.CurrentColor}" Fit="True" Margin="10" Background="Jet">
- <Label Width="100" Text="Hue"/>
- <Label Width="100" Text="{Hue}"/>
- </HorizontalStack>
- <HorizontalStack DataSource="{../cp.CurrentColor}" Fit="True" Margin="10" Background="Jet">
- <Label Width="100" Text="Saturation"/>
- <Label Width="100" Text="{Saturation}"/>
- </HorizontalStack>
- <HorizontalStack DataSource="{../cp.CurrentColor}" Fit="True" Margin="10" Background="Jet">
- <Label Width="100" Text="Value"/>
- <Label Width="100" Text="{Value}"/>
- </HorizontalStack>
-</VerticalStack>
+<Image Path="#Crow.Icons.crow.svg" Background="Blue" Width="100" Height="100"/>
+