internal ReaderWriterLockSlim parentRWLock = new ReaderWriterLockSlim();
#if DESIGN_MODE
+ public volatile bool HasChanged = false;
+ public string design_id;
public int design_line;
public int design_column;
public string design_imlPath;
public Dictionary<string,string> design_members = new Dictionary<string, string>();
public bool design_isTGItem = false;
+ public virtual bool FindByDesignID(string designID, out GraphicObject go){
+ go = null;
+ if (this.design_id == designID){
+ go = this;
+ return true;
+ }
+ return false;
+ }
+
public string GetIML(){
XmlDocument doc = new XmlDocument( );
getIML (doc, (XmlNode)doc);
doc.WriteTo (xtw);
}
+ this.HasChanged = false;
return sw.ToString ();
}
}
public class Group : GraphicObject
{
#if DESIGN_MODE
+ public override bool FindByDesignID(string designID, out GraphicObject go){
+ go = null;
+ if (base.FindByDesignID (designID, out go))
+ return true;
+ childrenRWLock.EnterReadLock ();
+ foreach (GraphicObject w in Children) {
+ if (!w.FindByDesignID (designID, out go))
+ continue;
+ childrenRWLock.ExitReadLock ();
+ return true;
+ }
+ childrenRWLock.ExitReadLock ();
+ return false;
+ }
public override void getIML (System.Xml.XmlDocument doc, System.Xml.XmlNode parentElem)
{
if (this.design_isTGItem)
public PrivateContainer (Interface iface) : base(iface){}
#endregion
+ #if DESIGN_MODE
+ public override bool FindByDesignID(string designID, out GraphicObject go){
+ go = null;
+ if (base.FindByDesignID (designID, out go))
+ return true;
+ return (bool)child?.FindByDesignID (designID, out go);
+ }
+ #endif
protected GraphicObject child;
protected virtual void SetChild(GraphicObject _child)
internal string sourcePath;
+ #if DESIGN_MODE
+ public static int NextInstantiatorID = 0;
+ public int currentInstantiatorID = 0;
+ int currentDesignID = 0;
+ internal string NextDesignID { get { return string.Format ("{0}_{1}",currentInstantiatorID, currentDesignID++); }}
+ #endif
+
#region CTOR
/// <summary>
/// Initializes a new instance of the Instantiator class.
/// </summary>
public Instantiator (Interface _iface, Stream stream, string srcPath = null)
{
+ #if DESIGN_MODE
+ currentInstantiatorID = NextInstantiatorID++;
+ #endif
iface = _iface;
sourcePath = srcPath;
#if DEBUG_LOAD
/// positionned on the start tag inside the itemTemplate
/// </summary>
public Instantiator (Interface _iface, XmlReader itr){
+ #if DESIGN_MODE
+ currentInstantiatorID = NextInstantiatorID++;
+ #endif
iface = _iface;
parseIML (itr);
}
//TODO:check if still used
public Instantiator (Interface _iface, Type _root, InstanciatorInvoker _loader)
{
+ #if DESIGN_MODE
+ currentInstantiatorID = NextInstantiatorID++;
+ #endif
iface = _iface;
RootType = _root;
loader = _loader;
#if DESIGN_MODE
IXmlLineInfo li = (IXmlLineInfo)reader;
ctx.il.Emit (OpCodes.Ldloc_0);
+ ctx.il.Emit (OpCodes.Ldstr, this.NextDesignID);
+ ctx.il.Emit (OpCodes.Stfld, typeof(GraphicObject).GetField("design_id"));
+ ctx.il.Emit (OpCodes.Ldloc_0);
ctx.il.Emit (OpCodes.Ldc_I4, ctx.curLine + li.LineNumber);
ctx.il.Emit (OpCodes.Stfld, typeof(GraphicObject).GetField("design_line"));
ctx.il.Emit (OpCodes.Ldloc_0);