//----------------------------------------------------------------------- public override void Paste() { if (WrappedItem != null) { WrappedItem.Paste(); } else { GraphNodeDefinition chosen = null; foreach (var def in ReferenceDef.Definitions.Values) { if (Clipboard.ContainsData(def.CopyKey)) { var flat = Clipboard.GetData(def.CopyKey) as string; var root = XElement.Parse(flat); if (root.Name == def.Name) { chosen = def; break; } } } if (chosen == null) { return; } GraphNodeItem item = null; using (UndoRedo.DisableUndoScope()) { item = chosen.CreateData(UndoRedo) as GraphNodeItem; if (item is GraphStructItem && item.Children.Count == 0) { (item.Definition as GraphStructDefinition).CreateChildren(item as GraphStructItem, UndoRedo); } item.Paste(); } UndoRedo.ApplyDoUndo(delegate { ChosenDefinition = chosen; WrappedItem = item; }, delegate { ChosenDefinition = null; WrappedItem = null; }, "Paste Item " + item.Name); } }
//----------------------------------------------------------------------- public override void Paste() { WrappedItem.Paste(); }