You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
68 lines
2.8 KiB
C#
68 lines
2.8 KiB
C#
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<string, bool, string> afterEdit);
|
|
Form CreateEditorForm(object sender, string elementData, GeoSigmaDrawLib.GeoSigmaXY geo, Func<string, bool, string> afterEdit);
|
|
}
|
|
public class WellGroupEditorHelp
|
|
{
|
|
public static DialogResult ShowEditor(object sender, string elementData
|
|
, GeoSigmaDrawLib.GeoSigmaXY geo, Func<string, bool, string> 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;
|
|
}
|
|
/// <summary>
|
|
/// 创建一个符号编辑器窗口对象
|
|
/// </summary>
|
|
/// <param name="sender">触发创建表单的事件发送者对象</param>
|
|
/// <param name="elementData">要编辑的元素数据字符串</param>
|
|
/// <param name="geo">图件信息对象</param>
|
|
/// <param name="afterDataEdit">编辑完成后的回调函数,接收编辑后的数据和布尔值作为参数,返回处理结果字符串</param>
|
|
/// <returns>返回创建的编辑器表单对象</returns>
|
|
public static Form CreateEditorForm(object sender, string elementData
|
|
, GeoSigmaDrawLib.GeoSigmaXY geo, Func<string,bool, string> 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;
|
|
}
|
|
}
|
|
}
|