效果如下:
namespace IfoxDemo
{
public static class 暂停调试
{
/// <summary>
/// 提示用户按Esc继续执行代码,输入1则退出主程序。
/// </summary>
/// <param name="ed">AutoCAD的编辑器对象。</param>
public static void 暂停()
{
Document doc = Application.DocumentManager.MdiActiveDocument;
Editor ed = doc.Editor;
PromptDoubleOptions pdo = new PromptDoubleOptions("");
pdo.AllowNegative = true; // 根据需要允许负数
pdo.AllowZero = true; // 根据需要允许零
try
{
double value = ed.GetDouble(pdo).Value;
if (value == 1)
{
throw new InvalidOperationException("1抛出异常,退出程序");