/// <summary> /// Accepts the move of a base tree node on this node /// </summary> /// <param name="SourceNode"></param> public virtual void AcceptMove(BaseTreeNode SourceNode) { System.Collections.ArrayList SourceCollection = SourceNode.Model.EnclosingCollection; System.Collections.ArrayList ThisCollection = Model.EnclosingCollection; if (ThisCollection != null && SourceCollection == ThisCollection) { // This is a reordering int sourceIndex = ThisCollection.IndexOf(SourceNode.Model); int thisIndex = ThisCollection.IndexOf(Model); if (thisIndex >= 0 && thisIndex >= 0 && thisIndex != sourceIndex) { ThisCollection.Remove(SourceNode.Model); thisIndex = ThisCollection.IndexOf(Model); ThisCollection.Insert(thisIndex, SourceNode.Model); MainWindow.RefreshModel(); } } }
/// <summary> /// Accepts the drop of a base tree node on this node /// </summary> /// <param name="SourceNode"></param> public virtual void AcceptCopy(BaseTreeNode SourceNode) { XmlBooster.XmlBBase xmlBBase = SourceNode.Model as XmlBooster.XmlBBase; if (xmlBBase != null) { string data = xmlBBase.ToXMLString(); XmlBooster.XmlBStringContext ctxt = new XmlBooster.XmlBStringContext(data); try { DataDictionary.ModelElement copy = DataDictionary.Generated.acceptor.accept(ctxt) as DataDictionary.ModelElement; Model.AddModelElement(copy); MainWindow.RefreshModel(); } catch (Exception) { MessageBox.Show("Cannot copy element\n" + data); } } }