4 Comments

  1. Johann,

    I was thinking of proposing to you that all your scripts should be modified to add the following conditional compile directive:

    /*
    The following compiler directive is necessary to enable editing scripts
    within Visual Studio.

    It requires that the “Conditional compilation symbol” SCRIPTENV be defined
    in the Visual Studio project properties

    This is because EPLAN’s internal scripting engine already adds “using directives”
    when you load the script in EPLAN. Having them twice would cause errors.
    */

    #if SCRIPTENV
    using Eplan.EplApi.ApplicationFramework;
    using Eplan.EplApi.Scripting;
    using Eplan.EplApi.Base;
    using Eplan.EplApi.Gui;
    #endif

    /*
    On the other hand, some namespaces are not automatically added by EPLAN when
    you load a script. Those have to be outside of the previous conditional compiler directive
    */

    using System;
    using System.IO;
    using System.Windows.Forms;
    using System.Collections.Generic;
    using System.Linq;

     

    By using this method, it allows you to have “using” directives that would otherwise make EPLAN throw an error when loading the scripts.

    What do you think?

  2. I forgot to mention in my last comment that the compile directive depends on defining a “conditional compilation symbol” in Visual Studio, like so:

  3. Hey Luc, thanks for your suggestion. I know about that (descriped it in the book as well). But i think there is no problem at Runtime still 2.1 (or 2.3?).

    The only negative side effect without compiler attribut:
    If the Script has errors at compile time. The using directives are also listet.

    For me its a not necessary overhead.

    Or have you other reasons why that is recommend?

    Thanks for your suggestion!

Schreibe einen Kommentar

Deine E-Mail-Adresse wird nicht veröffentlicht. Erforderliche Felder sind mit * markiert.