<Compile Include="src\GraphicObjects\TreeView.cs" />
<Compile Include="src\GraphicObjects\TabView.cs" />
<Compile Include="src\GraphicObjects\TabItem.cs" />
- <Compile Include="src\GraphicObjects\DummyTemplate.cs" />
<Compile Include="src\Input\KeyboardKeyEventArgs.cs" />
<Compile Include="src\Input\Buttons.cs" />
<Compile Include="src\Input\ButtonState.cs" />
//testFiles = new string [] { @"Interfaces/Unsorted/testFileDialog.crow" };
//testFiles = new string [] { @"Interfaces/Divers/colorPicker.crow" };
- testFiles = new string [] { @"Interfaces/Divers/welcome.crow" };
+ testFiles = new string [] { @"Interfaces/TemplatedContainer/testTabView.crow" };
testFiles = testFiles.Concat (Directory.GetFiles (@"Interfaces/GraphicObject", "*.crow")).ToArray ();
testFiles = testFiles.Concat (Directory.GetFiles (@"Interfaces/Container", "*.crow")).ToArray ();
testFiles = testFiles.Concat (Directory.GetFiles (@"Interfaces/Group", "*.crow")).ToArray ();
base.OnLoad (e);
AddWidget(
- new Window ()
+ new Window (this.CurrentInterface)
{
Caption = "Hello World"
}
{
base.OnLoad (e);
+ Container c = (Container) Instantiator.CreateFromImlFragment (@"<Border BorderWidth='1' Background='Red' Foreground='White' Width='50%'></Border>").CreateInstance (CurrentInterface);
+ GraphicObject obj = new GraphicObject (this.CurrentInterface)
+ {
+ Background = Color.AirForceBlueRaf,
+ Margin = 10,
+ Width = 100,
+ Height = 100
+ };
+ c.SetChild (obj);
+ AddWidget (c);
- AddWidget(Instantiator.CreateFromImlFragment (@"<Border Fit='true' BorderWidth='2' BorderStyle='Normal' MouseDown='{BorderStyle=Sunken}' MouseUp='{BorderStyle=Raised}' MouseEnter='{BorderStyle=Raised}' MouseLeave='{BorderStyle=Normal}'><Label Margin='50'/></Border>").CreateInstance (CurrentInterface));
- //Load(@"Interfaces/GraphicObject/0.crow");
+ //Load(@"Interfaces/GraphicObject/2.crow");
}
[STAThread]
using System.Collections.Generic;
using System.Reflection;
using System.Linq;
+using System.Text;
namespace Tests
{
try {
lock (this.ifaceControl [0].CrowInterface.UpdateMutex) {
Instantiator inst = null;
- using (MemoryStream ms = new MemoryStream (System.Text.Encoding.Unicode.GetBytes (e.Text))){
+ using (MemoryStream ms = new MemoryStream (Encoding.UTF8.GetBytes (e.Text))){
inst = new Instantiator (ms);
}
g = inst.CreateInstance (this.ifaceControl [0].CrowInterface);
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<ItemGroup>
- <Compile Include="Interfaces\testBorder.goml.cs" />
<Compile Include="BasicTests.cs" />
<Compile Include="OpenGL\Shader.cs" />
<Compile Include="OpenGL\vaoMesh.cs" />
internal static MethodInfo miDSChangeEmitHelper = typeof(Instantiator).GetMethod("dataSourceChangedEmitHelper", BindingFlags.Instance | BindingFlags.NonPublic);
internal static MethodInfo miDSReverseBinding = typeof(Instantiator).GetMethod("dataSourceReverseBinding", BindingFlags.Static | BindingFlags.NonPublic);
- internal static FieldInfo miSetCurIface = typeof(GraphicObject).GetField ("currentInterface", BindingFlags.NonPublic | BindingFlags.Instance);
+ internal static FieldInfo miSetCurIface = typeof(GraphicObject).GetField ("CurrentInterface", BindingFlags.Public | BindingFlags.Instance);
internal static MethodInfo miFindByName = typeof (GraphicObject).GetMethod ("FindByName");
internal static MethodInfo miGetGObjItem = typeof(List<GraphicObject>).GetMethod("get_Item", new Type[] { typeof(Int32) });
internal static MethodInfo miLoadDefaultVals = typeof (GraphicObject).GetMethod ("loadDefaultValues");
public class AnalogMeter : NumericControl
{
#region CTOR
- public AnalogMeter() : base()
- {}
- public AnalogMeter(double minimum, double maximum, double step)
- : base(minimum,maximum,step)
- {
- }
+ public AnalogMeter () : base(){}
+ public AnalogMeter (Interface iface) : base(iface){}
#endregion
#region GraphicObject Overrides
{
#region CTOR
public Border () : base(){}
+ public Border (Interface iface) : base(iface){}
#endregion
#region private fields
{
public class Button : TemplatedContainer
{
+ #region CTOR
+ public Button() : base() {}
+ public Button (Interface iface) : base(iface){}
+ #endregion
+
string image;
bool isPressed;
Container _contentContainer;
- #region CTOR
- public Button() : base()
- {}
- #endregion
-
public event EventHandler Pressed;
public event EventHandler Released;
{
public class CheckBox : TemplatedControl
{
- bool isChecked;
-
#region CTOR
- public CheckBox() : base()
- {}
+ public CheckBox () : base(){}
+ public CheckBox (Interface iface) : base(iface){}
#endregion
+ bool isChecked;
+
public event EventHandler Checked;
public event EventHandler Unchecked;
{
public class ColorPicker : TemplatedControl
{
- public ColorPicker () : base ()
- {
- }
+ #region CTOR
+ public ColorPicker () : base(){}
+ public ColorPicker (Interface iface) : base(iface){}
+ #endregion
const double div = 255.0;
const double colDiv = 1.0 / div;
{
public class ColorSelector : GraphicObject
{
- public ColorSelector (): base()
- {
- }
+ #region CTOR
+ public ColorSelector () : base(){}
+ public ColorSelector (Interface iface) : base(iface){}
+ #endregion
const double div = 255.0;
const double colDiv = 1.0 / div;
namespace Crow
{
public class ComboBox : ListBox
- {
+ {
#region CTOR
- public ComboBox() : base(){ }
+ public ComboBox () : base(){}
+ public ComboBox (Interface iface) : base(iface){}
#endregion
Size minimumPopupSize = "10,10";
public class Container : PrivateContainer
{
#region CTOR
- public Container()
- : base()
- {
- }
+ public Container () : base(){}
+ public Container (Interface iface) : base(iface){}
#endregion
- [XmlIgnore]
- public GraphicObject Child {
+ [XmlIgnore]public GraphicObject Child {
get { return child; }
- set { child = value; }
+ set { base.SetChild(value); }
}
+ /// <summary>
+ /// override this to handle specific steps in child addition in derived class,
+ /// and don't forget to call the base.SetChild
+ /// </summary>
public virtual void SetChild(GraphicObject _child)
{
base.SetChild (_child);
public class DirectoryView : TemplatedControl
{
#region CTOR
- public DirectoryView ()
- : base()
- {}
+ public DirectoryView () : base(){}
+ public DirectoryView (Interface iface) : base(iface){}
#endregion
#region events
+++ /dev/null
-//
-// DummyTemplate.cs
-//
-// Author:
-// Jean-Philippe Bruyère <jp.bruyere@hotmail.com>
-//
-// Copyright (c) 2013-2017 Jean-Philippe Bruyère
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-
-using System;
-
-namespace Crow
-{
- public class DummyTemplate : TemplatedControl
- {
- public DummyTemplate () : base()
- {
- }
- }
-}
-
public class Expandable : TemplatedContainer
{
#region CTOR
- public Expandable() : base()
- {
- }
+ public Expandable () : base(){}
+ public Expandable (Interface iface) : base(iface){}
#endregion
#region Private fields
{
public class FileDialog: Window
{
+ #region CTOR
+ public FileDialog () : base(){}
+ public FileDialog (Interface iface) : base(iface){}
+ #endregion
+
string searchPattern, curDir, _selectedFile, _selectedDir;
#region events
public event EventHandler OkClicked;
#endregion
- #region CTOR
- public FileDialog () : base()
- {
- }
- #endregion
-
[XmlAttributeAttribute][DefaultValue("/home")]
public virtual string CurrentDirectory {
get { return curDir; }
public class GenericStack : Group
{
#region CTOR
- public GenericStack()
- : base()
- {
- }
+ public GenericStack () : base(){}
+ public GenericStack(Interface iface) : base(iface){}
#endregion
#region Private fields
public class GraduatedSlider : Slider
{
#region CTOR
- public GraduatedSlider() : base()
+ public GraduatedSlider () : base(){}
+ public GraduatedSlider(Interface iface) : base(iface)
{}
- public GraduatedSlider(double minimum, double maximum, double step)
- : base()
- {
- Minimum = minimum;
- Maximum = maximum;
- SmallIncrement = step;
- LargeIncrement = step * 5;
- }
+// public GraduatedSlider(double minimum, double maximum, double step)
+// : base()
+// {
+// Minimum = minimum;
+// Maximum = maximum;
+// SmallIncrement = step;
+// LargeIncrement = step * 5;
+// }
#endregion
protected override void DrawGraduations(Context gr, PointD pStart, PointD pEnd)
if (IsQueueForRedraw)
throw new Exception("Trying to dispose an object queued for Redraw: " + this.ToString());
#endif
- if (currentInterface.HoverWidget != null) {
- if (currentInterface.HoverWidget.IsOrIsInside(this))
- currentInterface.HoverWidget = null;
+ if (CurrentInterface.HoverWidget != null) {
+ if (CurrentInterface.HoverWidget.IsOrIsInside(this))
+ CurrentInterface.HoverWidget = null;
}
- if (currentInterface.ActiveWidget != null) {
- if (currentInterface.ActiveWidget.IsOrIsInside (this))
- currentInterface.ActiveWidget = null;
+ if (CurrentInterface.ActiveWidget != null) {
+ if (CurrentInterface.ActiveWidget.IsOrIsInside (this))
+ CurrentInterface.ActiveWidget = null;
}
- if (currentInterface.FocusedWidget != null) {
- if (currentInterface.FocusedWidget.IsOrIsInside (this))
- currentInterface.FocusedWidget = null;
+ if (CurrentInterface.FocusedWidget != null) {
+ if (CurrentInterface.FocusedWidget.IsOrIsInside (this))
+ CurrentInterface.FocusedWidget = null;
}
if (!localDataSourceIsNull)
DataSource = null;
internal static ulong currentUid = 0;
internal ulong uid = 0;
- Interface currentInterface = null;
-
- [XmlIgnore]public Interface CurrentInterface {
- get {
- if (currentInterface == null) {
- currentInterface = Interface.CurrentInterface;
- Initialize ();
- }
- return currentInterface;
- }
- set {
- currentInterface = value;
- }
- }
+ public Interface CurrentInterface = null;
public Region Clipping;
#endregion
#region CTOR
- public GraphicObject ()
- {
+ /// <summary>
+ /// default private parameter less constructor use in instantiators
+ /// </summary>
+ protected GraphicObject () {
Clipping = new Region ();
#if DEBUG
uid = currentUid;
currentUid++;
- #endif
+ #endif
+ }
+ public GraphicObject (Interface iface) : this()
+ {
+ CurrentInterface = iface;
+ Initialize ();
}
#endregion
internal bool initialized = false;
/// Initialize this Graphic object instance by setting style and default values and loading template if required
/// </summary>
public virtual void Initialize(){
- if (currentInterface == null)
- currentInterface = Interface.CurrentInterface;
+// if (CurrentInterface == null)
+// CurrentInterface = Interface.CurrentInterface;
loadDefaultValues ();
initialized = true;
}
if (CurrentInterface.eligibleForDoubleClick == this && CurrentInterface.clickTimer.ElapsedMilliseconds < Interface.DoubleClick)
onMouseDoubleClick (this, e);
else
- currentInterface.clickTimer.Restart();
+ CurrentInterface.clickTimer.Restart();
CurrentInterface.eligibleForDoubleClick = null;
if (CurrentInterface.ActiveWidget == null)
public class Grid : Group
{
#region CTOR
- public Grid()
- : base()
+ public Grid () : base(){}
+ public Grid(Interface iface) : base(iface)
{
}
#endregion
public class Group : GraphicObject
{
#region CTOR
- public Group()
- : base(){}
+ public Group () : base(){}
+ public Group(Interface iface) : base(iface){}
#endregion
#region EVENT HANDLERS
Container _contentContainer;
#region CTOR
- public GroupBox() : base(){}
+ public GroupBox () : base(){}
+ public GroupBox(Interface iface) : base(iface){}
#endregion
#region Template overrides
{
public class HorizontalStack : GenericStack
{
- public HorizontalStack()
- : base()
+ #region CTOR
+ public HorizontalStack () : base(){}
+ public HorizontalStack(Interface iface) : base(iface)
{
}
+ #endregion
[XmlIgnore]
public override Orientation Orientation
{
public class HueSelector : ColorSelector
{
- public HueSelector () : base()
+ #region CTOR
+ public HueSelector () : base(){}
+ public HueSelector (Interface iface) : base(iface)
{
}
+ #endregion
Orientation _orientation;
double hue;
#endregion
#region CTOR
- public Image () : base()
+ public Image () : base(){}
+ public Image (Interface iface) : base(iface)
{
}
#endregion
public class Label : GraphicObject
{
#region CTOR
- public Label()
- {
+ public Label () : base(){}
- }
- public Label(string _text)
- : base()
+ public Label(Interface iface) : base(iface)
{
- Text = _text;
+
}
+// public Label(string _text)
+// : base()
+// {
+// Text = _text;
+// }
#endregion
public event EventHandler<TextChangeEventArgs> TextChanged;
public class ListBox : TemplatedGroup
{
#region CTOR
- public ListBox () : base() {}
+ public ListBox () : base(){}
+ public ListBox (Interface iface) : base(iface) {}
#endregion
}
public class Menu : TemplatedGroup
{
#region CTOR
- public Menu () : base() {}
+ public Menu () : base(){}
+ public Menu (Interface iface) : base(iface) {}
#endregion
Orientation orientation;
public class MenuItem : Menu
{
#region CTOR
- public MenuItem () : base() {}
+ public MenuItem () : base(){}
+ public MenuItem (Interface iface) : base(iface) {}
#endregion
public event EventHandler Open;
{
public class MessageBox : Window
{
+ #region CTOR
+ public MessageBox () : base(){}
+ public MessageBox (Interface iface) : base(iface){}
+ #endregion
+
public enum Type {
Information,
YesNo,
Alert,
Error
}
- public MessageBox (): base(){}
protected override void loadTemplate (GraphicObject template)
{
}
public static MessageBox Show (Type msgBoxType, string message, string okMsg = "", string cancelMsg = ""){
lock (Interface.CurrentInterface.UpdateMutex) {
- MessageBox mb = new MessageBox ();
- mb.Initialize ();
+ MessageBox mb = new MessageBox (Interface.CurrentInterface);
mb.CurrentInterface.AddWidget (mb);
mb.MsgType = msgBoxType;
mb.Message = message;
public abstract class NumericControl : TemplatedControl
{
#region CTOR
- public NumericControl () : base()
- {
- }
- public NumericControl(double minimum, double maximum, double step)
- : base()
+ public NumericControl () : base(){}
+ public NumericControl (Interface iface) : base(iface)
{
}
+// public NumericControl(double minimum, double maximum, double step)
+// : base()
+// {
+// }
#endregion
#region private fields
public class Popper : TemplatedContainer
{
#region CTOR
- public Popper() : base()
- {
- }
+ public Popper () : base(){}
+ public Popper (Interface iface) : base(iface){}
#endregion
bool _isPopped, _canPop;
public class PrivateContainer : GraphicObject
{
#region CTOR
- public PrivateContainer()
- : base()
- {
- }
+ public PrivateContainer () : base(){}
+ public PrivateContainer (Interface iface) : base(iface){}
#endregion
protected GraphicObject child;
public class ProgressBar : NumericControl
{
#region CTOR
- public ProgressBar() : base(){}
+ public ProgressBar () : base(){}
+ public ProgressBar(Interface iface) : base(iface){}
#endregion
protected override void loadTemplate (GraphicObject template)
bool isChecked;
#region CTOR
- public RadioButton() : base(){}
+ public RadioButton () : base(){}
+ public RadioButton(Interface iface) : base(iface){}
#endregion
public event EventHandler Checked;
{
public class SaturationValueSelector : ColorSelector
{
- public SaturationValueSelector () : base()
+ public SaturationValueSelector () : base(){}
+ public SaturationValueSelector (Interface iface) : base(iface)
{
}
Orientation _orientation;
#region CTOR
- public ScrollBar() : base() {}
+ public ScrollBar () : base(){}
+ public ScrollBar(Interface iface) : base(iface) {}
#endregion
[XmlAttributeAttribute()][DefaultValue(Orientation.Vertical)]
{
public class Scroller : Container
{
+ #region CTOR
+ public Scroller () : base(){}
+ public Scroller (Interface iface) : base(iface){}
+ #endregion
+
bool _verticalScrolling;
bool _horizontalScrolling;
bool _scrollbarVisible;
}
#endregion
- public Scroller()
- : base(){}
-
#region GraphicObject Overrides
public override void OnLayoutChanges (LayoutingType layoutType)
{
public class ScrollingObject : GraphicObject
{
#region CTOR
- public ScrollingObject ():base()
- {
- }
+ public ScrollingObject ():base(){}
+ public ScrollingObject (Interface iface):base(iface){}
#endregion
int scrollX, scrollY, maxScrollX, maxScrollY, mouseWheelSpeed;
public class ScrollingTextBox : ScrollingObject
{
#region CTOR
+ public ScrollingTextBox (Interface iface):base(iface){
+ KeyEventsOverrides = true;
+ }
public ScrollingTextBox ():base()
{
KeyEventsOverrides = true;
public class Slider : NumericControl
{
#region CTOR
- public Slider() : base()
+ public Slider() : base(){}
+ public Slider(Interface iface) : base(iface)
{}
- public Slider(double minimum, double maximum, double step)
- : base(minimum,maximum,step)
- {
- }
+// public Slider(double minimum, double maximum, double step)
+// : base(minimum,maximum,step)
+// {
+// }
#endregion
#region implemented abstract members of TemplatedControl
public class Spinner : NumericControl
{
#region CTOR
- public Spinner () : base()
+ public Spinner() : base(){}
+ public Spinner (Interface iface) : base(iface)
{
- }
- public Spinner (double minimum, double maximum, double step) :
- base (minimum, maximum, step)
- {
-
}
#endregion
public class Splitter : GraphicObject
{
#region CTOR
- public Splitter (): base(){}
+ public Splitter() : base(){}
+ public Splitter (Interface iface) : base(iface){}
#endregion
int thickness;
public class TabItem : TemplatedContainer
{
#region CTOR
- public TabItem () : base() {}
+ public TabItem() : base(){}
+ public TabItem (Interface iface) : base(iface){}
#endregion
#region Private fields
public class TabView : Group
{
#region CTOR
- public TabView () : base() {}
+ public TabView() : base(){}
+ public TabView (Interface iface) : base(iface){}
#endregion
#region Private fields
public abstract class TemplatedContainer : TemplatedControl
{
#region CTOR
- public TemplatedContainer () : base(){}
+ public TemplatedContainer() : base(){}
+ public TemplatedContainer (Interface iface) : base(iface){}
#endregion
[XmlAttributeAttribute]public virtual GraphicObject Content{ get; set;}
public abstract class TemplatedControl : PrivateContainer
{
#region CTOR
- public TemplatedControl () : base()
- {
- }
+ public TemplatedControl() : base(){}
+ public TemplatedControl (Interface iface) : base(iface){}
#endregion
string _template;
public abstract class TemplatedGroup : TemplatedControl
{
#region CTOR
- public TemplatedGroup () : base(){}
+ public TemplatedGroup() : base(){}
+ public TemplatedGroup (Interface iface) : base(iface){}
#endregion
protected Group items;
page = items;
itemPerPage = int.MaxValue;
} else if (typeof(GenericStack).IsAssignableFrom (items.GetType ())) {
- GenericStack gs = new GenericStack ();
- gs.CurrentInterface = items.CurrentInterface;
- gs.Initialize ();
+ GenericStack gs = new GenericStack (items.CurrentInterface);
gs.Orientation = (items as GenericStack).Orientation;
gs.Width = items.Width;
gs.Height = items.Height;
public class TextBox : Label
{
#region CTOR
- public TextBox()
+ public TextBox() : base(){}
+ public TextBox(Interface iface) : base(iface)
{ }
- public TextBox(string _initialValue)
- : base(_initialValue)
- {
-
- }
+// public TextBox(string _initialValue)
+// : base(_initialValue)
+// {
+//
+// }
#endregion
#region GraphicObject overrides
public class TextRun : GraphicObject
{
#region CTOR
- public TextRun ()
- {
-
- }
- public TextRun (string _text)
- : base ()
- {
- Text = _text;
- }
+ public TextRun () : base(){}
+ public TextRun (Interface iface) : base (iface){}
#endregion
//TODO:change protected to private
bool isRoot;
#region CTOR
- public TreeView () : base()
+ public TreeView() : base(){}
+ public TreeView (Interface iface) : base(iface)
{
}
#endregion
{
public class VerticalStack : GenericStack
{
- public VerticalStack()
- : base()
+ public VerticalStack() : base(){}
+ public VerticalStack(Interface iface) : base(iface)
{
}
#endregion
#region CTOR
- public Window () : base() {
-
- }
+ public Window() : base(){}
+ public Window (Interface iface) : base(iface){}
#endregion
#region TemplatedContainer overrides
{
public class Wrapper : GenericStack
{
- public Wrapper () : base()
- {}
+ #region CTOR
+ public Wrapper() : base(){}
+ public Wrapper (Interface iface) : base(iface){}
+ #endregion
#region Group Overrides
public override void ChildrenLayoutingConstraints (ref LayoutingType layoutType)
il.DeclareLocal (typeof (GraphicObject));
il.Emit (OpCodes.Nop);
- //set local GraphicObject to root object
- il.Emit (OpCodes.Newobj, rootType.GetConstructors () [0]);
+ //set local GraphicObject to root object
+ ConstructorInfo ci = rootType.GetConstructor (
+ BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public,
+ null, Type.EmptyTypes, null);
+ if (ci == null)
+ throw new Exception ("No default parameterless constructor found in " + rootType.Name);
+ il.Emit (OpCodes.Newobj, ci);
il.Emit (OpCodes.Stloc_0);
CompilerServices.emitSetCurInterface (il);
}
//emitCheckAndBindValueChanged (ctx);
}
+ /// <summary>
+ /// process template and item template definition prior to
+ /// other attributes or childs processing
+ /// </summary>
+ /// <param name="ctx">Loading Context</param>
+ /// <param name="tmpXml">xml fragment</param>
void emitTemplateLoad (Context ctx, string tmpXml) {
//if its a template, first read template elements
using (XmlTextReader reader = new XmlTextReader (tmpXml, XmlNodeType.Element, null)) {
}
}
}
+ /// <summary>
+ /// process styling, attributes and children loading.
+ /// </summary>
+ /// <param name="ctx">parsing context</param>
+ /// <param name="tmpXml">xml fragment</param>
void emitGOLoad (Context ctx, string tmpXml) {
using (XmlTextReader reader = new XmlTextReader (tmpXml, XmlNodeType.Element, null)) {
reader.Read ();
#region Styling and default values loading
+ //first check for Style attribute then trigger default value loading
if (reader.HasAttributes) {
string style = reader.GetAttribute ("Style");
if (!string.IsNullOrEmpty (style))
Type t = tryGetGOType (reader.Name);
if (t == null)
throw new Exception (reader.Name + " type not found");
-
- ctx.il.Emit (OpCodes.Newobj, t.GetConstructors () [0]);//TODO:search parameterless ctor
+ ConstructorInfo ci = t.GetConstructor (
+ BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public,
+ null, Type.EmptyTypes, null);
+ if (ci == null)
+ throw new Exception ("No default parameterless constructor found in " + t.Name);
+ ctx.il.Emit (OpCodes.Newobj, ci);
ctx.il.Emit (OpCodes.Stloc_0);//child is now loc_0
CompilerServices.emitSetCurInterface (ctx.il);