Navigation

    • Register
    • Login
    • Search
    • Recent
    • Popular

    Editor.Command(...), Editor.CommanAsync(...) n'existent pas en ZWCAD

    LISP VBA .NET et Applicatifs
    1
    1
    57
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • S
      SoBuild Développeur last edited by

      Salut à tous,

      Les méthodes "Command" et "CommanAsync" n'existent pas dans la classe ZwSoft.ZwCAD.EditorInput.Editor :

      J'ai trouvé sur le net un bout de code permettant de refaire la méthode "Command" :

       public static PromptStatus Command(this Editor ed, params object[] args)
          {
            if (ed == null)
              throw new ArgumentNullException("ed");
            return runCommand(ed, args);
          }

          static Func<Editor, object[], PromptStatus> runCommand = GenerateRunCommand();

          static Func<Editor, object[], PromptStatus> GenerateRunCommand()
          {
            MethodInfo method = typeof(Editor).GetMethod(
              "RunCommand", BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public);
            ParameterExpression instance = Expression.Parameter(typeof(Editor), "ed");
            ParameterExpression args = Expression.Parameter(typeof(object[]), "args");
            return Expression.Lambda<Func<Editor, object[], PromptStatus>>(
              Expression.Call(instance, method, args), instance, args)
               .Compile();
          }

      Par contre pour la "CommanAsync", si quelqu'un sait la refaire. Je suis preneur !!!

      @+

      1 Reply Last reply Reply Quote
      • First post
        Last post