using System; using System.Collections.Generic; using System.Linq; using System.Reflection; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; namespace SymbolLibInterface { public interface IWellGroupEditorManager { DialogResult ShowEditor(object sender, string elementData, GeoSigmaDrawLib.GeoSigmaXY geo, Func afterEdit); Form CreateEditorForm(object sender, string elementData, GeoSigmaDrawLib.GeoSigmaXY geo, Func afterEdit); } public class WellGroupEditorHelp { public static DialogResult ShowEditor(object sender, string elementData , GeoSigmaDrawLib.GeoSigmaXY geo, Func afterEdit) { string path = AppDomain.CurrentDomain.BaseDirectory + "WellGroupEditor.exe"; Assembly assembly = Assembly.LoadFrom(path); IWellGroupEditorManager groupEditor = null; if (assembly != null) { Type type = assembly.GetType("WellGroupEditor.WellGroupEditorManager"); if (type != null) { groupEditor = Activator.CreateInstance(type) as IWellGroupEditorManager; } } if (groupEditor != null) { return groupEditor.ShowEditor(sender, elementData, geo, afterEdit); } return DialogResult.Cancel; } /// /// 创建一个符号编辑器窗口对象 /// /// 触发创建表单的事件发送者对象 /// 要编辑的元素数据字符串 /// 图件信息对象 /// 编辑完成后的回调函数,接收编辑后的数据和布尔值作为参数,返回处理结果字符串 /// 返回创建的编辑器表单对象 public static Form CreateEditorForm(object sender, string elementData , GeoSigmaDrawLib.GeoSigmaXY geo, Func afterDataEdit) { string path = AppDomain.CurrentDomain.BaseDirectory + "SymbolLibManager.exe"; Assembly assembly = Assembly.LoadFrom(path); IWellGroupEditorManager groupEditor = null; if (assembly != null) { Type type = assembly.GetType("SymbolLibManager.SymbolManager"); if (type != null) { groupEditor = Activator.CreateInstance(type) as IWellGroupEditorManager; } } if (groupEditor != null) { return groupEditor.CreateEditorForm(sender, elementData, geo, afterDataEdit); } return null; } } }