Example #1
0
        protected override void HandleMenuOption(string text, object tag)
        {
            if (mListDataObjectType != null && mObjectList != null)
            {
                object newObj = null;


                ////TTEEEMP
                if (mObjectList.Count > 0 && mObjectList[0] is ICloneTemplate)
                {
                    mCloneTemplate = (ICloneTemplate)mObjectList[0];
                }

                if (mCloneTemplate != null)
                {
                    object clone;
                    mCloneTemplate.TryCloneEntry(out newObj);
                }
                else
                {
                    newObj = mListDataObjectType.GetConstructor(new Type[] { }).Invoke(new object[] { });
                }


                ObjectEditorControl editorCtrl = AddPropertyControl(newObj);

                mObjectList.Add(newObj);

                if (NewObjectAdded != null)
                {
                    NewObjectAdded.Invoke(editorCtrl, newObj);
                }
            }
        }
Example #2
0
        virtual public bool TryCloneEntry(out object clone)
        {
            LambdaObject copy = new LambdaObject(mParentName, mParentType, null);

            List <INamedTypedProperty> copyProps = new List <INamedTypedProperty>();

            foreach (INamedTypedProperty prop in mProperties)
            {
                ICloneTemplate cl = prop as ICloneTemplate;
                object         newChild;
                if (cl.TryCloneEntry(out newChild))
                {
                    if (newChild is INamedTypedProperty)
                    {
                        copyProps.Add((INamedTypedProperty)newChild);
                    }
                }
            }
            copy.mProperties = copyProps.ToArray();
            clone            = copy;
            return(true);
        }