I would like to allow users to add shapes to a specific library but once added that the newly added master be replaced with my MasterEx class retaining all information from the master.
Everything works fine (including persisting) but I cannot figure out how I can transfer the master to MasterEx class.
Also, I am not sure how to update the history once I remove/add the master and don't know how to properly skip events.
Here is what I have so far:
void Library_NodeInserted(Dom.NChildNodeEventArgs args)
{
if (_skipEvents)
return;
NLibraryDocument doc = args.Node as NLibraryDocument;
switch (doc.Tag.ToString())
{
case "ACTORS":
NMaster master = args.Child as NMaster;
//This is what I have problems with
custom.Shapes.MasterEx masterEx = (custom.Shapes.MasterEx)master.Clone();
if (masterEx != null)
{
int idx = doc.IndexOfChild(args.Child);
_skipEvents = true;
doc.RemoveChildAt(idx);
doc.InsertChild(idx, masterEx);
_skipEvents = false;
//doc.UpdateAllViews();
}
//...