void GraphView_DragDrop(object sender, DragEventArgs e) { if (e.Data.GetDataPresent("WindowsForms10PersistentObject", false)) { BaseTreeNode SourceNode = (BaseTreeNode)e.Data.GetData("WindowsForms10PersistentObject"); DataDictionaryView.FunctionTreeNode functionTreeNode = SourceNode as DataDictionaryView.FunctionTreeNode; if (functionTreeNode != null) { AddFunction(functionTreeNode.Item); } else { Shortcuts.ShortcutTreeNode shortcutTreeNode = SourceNode as Shortcuts.ShortcutTreeNode; if (shortcutTreeNode != null) { AddFunction(shortcutTreeNode.Item.GetReference() as Function); } } } }
/// <summary> /// Handles drop event /// </summary> /// <param name="SourceNode"></param> public override void AcceptDrop(BaseTreeNode SourceNode) { if (SourceNode is ShortcutTreeNode) { ShortcutTreeNode shortcut = SourceNode as ShortcutTreeNode; if (shortcut.Item.Dictionary == Item.Dictionary) { DataDictionary.Shortcuts.Shortcut otherShortcut = (DataDictionary.Shortcuts.Shortcut)DataDictionary.Generated.acceptor.getFactory().createShortcut(); shortcut.Item.copyTo(otherShortcut); createShortcut(otherShortcut); shortcut.Delete(); } } else if (SourceNode is ShortcutFolderTreeNode) { ShortcutFolderTreeNode folder = SourceNode as ShortcutFolderTreeNode; if (folder.Item.Dictionary == Item.Dictionary) { DataDictionary.Shortcuts.ShortcutFolder otherFolder = (DataDictionary.Shortcuts.ShortcutFolder)DataDictionary.Generated.acceptor.getFactory().createShortcutFolder(); folder.Item.copyTo(otherFolder); createFolder(otherFolder); folder.Delete(); } } else if (SourceNode is DataDictionaryView.RuleTreeNode) { DataDictionaryView.RuleTreeNode rule = SourceNode as DataDictionaryView.RuleTreeNode; if (rule.Item.Dictionary == Item.Dictionary) { DataDictionary.Shortcuts.Shortcut shortcut = (DataDictionary.Shortcuts.Shortcut)DataDictionary.Generated.acceptor.getFactory().createShortcut(); shortcut.CopyFrom(rule.Item); createShortcut(shortcut); } } else if (SourceNode is DataDictionaryView.FunctionTreeNode) { DataDictionaryView.FunctionTreeNode function = SourceNode as DataDictionaryView.FunctionTreeNode; if (function.Item.Dictionary == Item.Dictionary) { DataDictionary.Shortcuts.Shortcut shortcut = (DataDictionary.Shortcuts.Shortcut)DataDictionary.Generated.acceptor.getFactory().createShortcut(); shortcut.CopyFrom(function.Item); createShortcut(shortcut); } } else if (SourceNode is DataDictionaryView.ProcedureTreeNode) { DataDictionaryView.ProcedureTreeNode procedure = SourceNode as DataDictionaryView.ProcedureTreeNode; if (procedure.Item.Dictionary == Item.Dictionary) { DataDictionary.Shortcuts.Shortcut shortcut = (DataDictionary.Shortcuts.Shortcut)DataDictionary.Generated.acceptor.getFactory().createShortcut(); shortcut.CopyFrom(procedure.Item); createShortcut(shortcut); } } else if (SourceNode is DataDictionaryView.VariableTreeNode) { DataDictionaryView.VariableTreeNode variable = SourceNode as DataDictionaryView.VariableTreeNode; if (variable.Item.Dictionary == Item.Dictionary) { DataDictionary.Shortcuts.Shortcut shortcut = (DataDictionary.Shortcuts.Shortcut)DataDictionary.Generated.acceptor.getFactory().createShortcut(); shortcut.CopyFrom(variable.Item); createShortcut(shortcut); } } }