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.
kev/Drawer/UCDraw/SymbolLibInterface/WellGroupEditorHelp.cs

66 lines
2.5 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="geo">GeoSigmaXY</param>
/// <param name="symbolPath">符号库路径</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;
}
}
}