API Help
Eplan.EplApi.Starter Namespace / AssemblyResolver Class / PinToEplan Method
Example

In This Topic
    PinToEplan Method
    In This Topic
    Pin an offline application to a eplan application. When the eplan bin path is known, an Offline Application using the Eplan Api dll can pinned to this version. This means all referenced Eplan Api dlls will be loaded. Note: For already loaded linked dlls the AssemblyResolve event is not fired.
    Syntax
    public void PinToEplan()
    public:
    void PinToEplan(); 
    Example
    This code is in a separate exe or dll. Its not allowed to link directly some EPLAN dlls from the bin path. (This causes an error at start when the dlls are not available.) Separate all Eplan references in another dll and link to this. The Class "EplanAppStarter" can be defined in this dll and contains you code.
    // Use the finder to find the correct eplan version if not yet known
    EplanFinder finder = new EplanFinder();
    string binPath = finder.SelectEplanVersion();
                
    // Now use the Assemblyresolver to let the program know where all eplan assemblies can be found.
    AssemblyResolver resolver = new AssemblyResolver();
    resolver.SetEplanBinPath(binPath);
    // Pin to eplan does the actual preparation. All referenced eplan assemblies are loaded from the bin path.
    resolver.PinToEplan();
                
    // Now the next (referenced) dll can be used. All Eplan references of this dll are known now.
    EplanAppStarter app = new EplanAppStarter();
    app.startEplan(binPath);
                
    //In the other dll, EplanAppStarter is implemented:
        public class EplanAppStarter
        {
            public void startEplan(string strVariant, string binPath)
            {
               Eplan.EplApi.System.EplApplication app = new Eplan.EplApi.System.EplApplication();
                app.EplanBinFolder = binPath;
                app.Init("");
            }
        }
    See Also