Add Variant sample
This commit is contained in:
parent
893703018f
commit
4c72b23216
3 changed files with 44 additions and 1 deletions
|
@ -8,7 +8,7 @@ DOTNET_TARGETS=
|
||||||
DOTNET_ASSEMBLY=
|
DOTNET_ASSEMBLY=
|
||||||
endif
|
endif
|
||||||
|
|
||||||
TARGETS = gtk-hello-world.exe async-sample.exe button.exe calendar.exe subclass.exe menu.exe treeviewdemo.exe managedtreeviewdemo.exe nodeviewdemo.exe treemodeldemo.exe actions.exe spawn.exe assistant.exe registerprop.exe gexceptiontest.exe native-instantiation.exe polarfixed.exe cairo-sample.exe scribble.exe testdnd.exe custom-cellrenderer.exe custom-widget.exe custom-scrollable.exe cairo-png.exe #scribble-xinput.exe $(DOTNET_TARGETS)
|
TARGETS = gtk-hello-world.exe async-sample.exe button.exe calendar.exe subclass.exe menu.exe treeviewdemo.exe managedtreeviewdemo.exe nodeviewdemo.exe treemodeldemo.exe actions.exe spawn.exe assistant.exe registerprop.exe gexceptiontest.exe native-instantiation.exe polarfixed.exe cairo-sample.exe scribble.exe testdnd.exe custom-cellrenderer.exe custom-widget.exe custom-scrollable.exe cairo-png.exe variantdemo.exe #scribble-xinput.exe $(DOTNET_TARGETS)
|
||||||
|
|
||||||
DEBUGS = $(addsuffix .mdb, $(TARGETS))
|
DEBUGS = $(addsuffix .mdb, $(TARGETS))
|
||||||
|
|
||||||
|
@ -106,6 +106,9 @@ gexceptiontest.exe: $(srcdir)/GExceptionTest.cs $(assemblies)
|
||||||
cairo-png.exe: $(srcdir)/CairoPng.cs $(top_builddir)/cairo/cairo-sharp.dll
|
cairo-png.exe: $(srcdir)/CairoPng.cs $(top_builddir)/cairo/cairo-sharp.dll
|
||||||
$(CSC) $(CSFLAGS) -out:cairo-png.exe -r:$(top_builddir)/cairo/cairo-sharp.dll $(srcdir)/CairoPng.cs
|
$(CSC) $(CSFLAGS) -out:cairo-png.exe -r:$(top_builddir)/cairo/cairo-sharp.dll $(srcdir)/CairoPng.cs
|
||||||
|
|
||||||
|
variantdemo.exe: $(srcdir)/VariantDemo.cs $(assemblies)
|
||||||
|
$(CSC) $(CSFLAGS) -out:variantdemo.exe $(references) $(srcdir)/VariantDemo.cs
|
||||||
|
|
||||||
EXTRA_DIST = \
|
EXTRA_DIST = \
|
||||||
HelloWorld.cs \
|
HelloWorld.cs \
|
||||||
Assistant.cs \
|
Assistant.cs \
|
||||||
|
|
39
sample/VariantDemo.cs
Normal file
39
sample/VariantDemo.cs
Normal file
|
@ -0,0 +1,39 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using GLib;
|
||||||
|
|
||||||
|
namespace sample
|
||||||
|
{
|
||||||
|
public class VariantDemo
|
||||||
|
{
|
||||||
|
public VariantDemo ()
|
||||||
|
{
|
||||||
|
var strv = new string[] {"String 1", "String 2"};
|
||||||
|
var variant = new Variant (strv);
|
||||||
|
Console.WriteLine (variant.Print (true));
|
||||||
|
|
||||||
|
variant = Variant.NewTuple (new Variant[] {variant, new Variant ("String 3")});
|
||||||
|
Console.WriteLine (variant.Print (true));
|
||||||
|
|
||||||
|
variant = Variant.NewTuple (null);
|
||||||
|
Console.WriteLine (variant.Print (true));
|
||||||
|
|
||||||
|
variant = Variant.NewArray (null, new Variant[] {new Variant ("String 4"), new Variant ("String 5")});
|
||||||
|
Console.WriteLine (variant.Print (true));
|
||||||
|
|
||||||
|
variant = Variant.NewArray (VariantType.String, null);
|
||||||
|
Console.WriteLine (variant.Print (true));
|
||||||
|
|
||||||
|
var dict = new Dictionary<string, Variant> ();
|
||||||
|
dict.Add ("strv", new Variant (strv));
|
||||||
|
dict.Add ("unit", Variant.NewTuple (null));
|
||||||
|
variant = new Variant (dict);
|
||||||
|
Console.WriteLine (variant.Print (true));
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void Main (string[] args)
|
||||||
|
{
|
||||||
|
new VariantDemo ();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -112,6 +112,7 @@
|
||||||
<Compile Include="GtkDemo\DemoSpinner.cs" />
|
<Compile Include="GtkDemo\DemoSpinner.cs" />
|
||||||
<Compile Include="GtkDemo\DemoCssBasics.cs" />
|
<Compile Include="GtkDemo\DemoCssBasics.cs" />
|
||||||
<Compile Include="GtkDemo\DemoThemingStyleClasses.cs" />
|
<Compile Include="GtkDemo\DemoThemingStyleClasses.cs" />
|
||||||
|
<Compile Include="VariantDemo.cs" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|
Loading…
Add table
Reference in a new issue