/// <inheritdoc/> public IAsyncResult BeginRun(AcadCommand command, IProcess process, AsyncCallback completionCallback, object asyncState) { if (command == null) throw new ArgumentNullException("command"); if (process == null) throw new ArgumentNullException("process"); if (process.HasExited) throw new ArgumentNullException("process", "Process has exited."); var task = new CommandTask(command, process, completionCallback, asyncState); return task.Begin(); }
private static void SendCommand(object application, AcadCommand command) { try { var document = GetActiveDocument(application); var parameters = new object[] { command.ToLispExpression(application) }; document.GetType().InvokeMember("SendCommand", BindingFlags.InvokeMethod, null, document, parameters); GC.KeepAlive(application); } catch (COMException e) { throw new TimeoutException("Unable to send messages to the AutoCAD process.", e); } }
/// <inheritdoc/> public IAsyncResult BeginRun(AcadCommand command, IProcess process, AsyncCallback completionCallback, object asyncState) { if (command == null) { throw new ArgumentNullException("command"); } if (process == null) { throw new ArgumentNullException("process"); } if (process.HasExited) { throw new ArgumentNullException("process", "Process has exited."); } var task = new CommandTask(command, process, completionCallback, asyncState); return(task.Begin()); }
public CommandTask(AcadCommand command, IProcess process, AsyncCallback completionCallback, object asyncState) { this.command = command; this.process = process; this.result = new CommandTaskResult(completionCallback, asyncState); }