简体   繁体   中英

use .net dll in electron

I am a .NET developer and new to electron and node.js .

From my electron application, I need to call one function inside a .NET class library DLL which will generate some document and will send to print.

I need to use this electron application only on the windows machine. I see plugin Edge.js , but am not sure this will work for me and also don't know how to include in my project.

Edge.js will do the trick.

See the following snippet:


    var edge = remote.require('electron-edge');

    var toErMahGerd = edge.func({
         assemblyFile: 'ERMAHGERD.dll',
         typeName: 'ERMAHGERD.Translate',
         methodName: "ToErMahGerd"
    });
    
    document.getElementById("translate-btn").addEventListener("click", function (e) { 
         var inputText = document.getElementById("input-text").value;
    
         toErMahGerd(inputText, function (error, result) {
              document.getElementById("output-text").innerHTML = result; 
         }); 
    });

And here is the GitHub-repo with not only good docs to dive in but a simple getting started.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM