forked from agracio/electron-edge-js-quick-start
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.js
More file actions
35 lines (27 loc) · 1.08 KB
/
app.js
File metadata and controls
35 lines (27 loc) · 1.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
const { ipcMain} = require("electron");
const path = require('path');
var net = process.argv[1].replace('--', '');
var namespace = 'QuickStart.' + net.charAt(0).toUpperCase() + net.substr(1);
if(net === 'core') net = '';
var version = net === 'standard' ? '2.0' : '7.0'
const baseNetAppPath = path.join(__dirname, '/src/'+ namespace +'/bin/Debug/net' + net + version);
process.env.EDGE_USE_CORECLR = 1;
if(net !== 'standard')
{
process.env.EDGE_APP_ROOT = baseNetAppPath;
}
var edge = require('electron-edge-js');
var baseDll = path.join(baseNetAppPath, namespace + '.dll');
var localTypeName = 'QuickStart.LocalMethods';
var createOutlook = edge.func({
assemblyFile: baseDll,
typeName: localTypeName,
methodName: 'CreateOutlook'
});
exports.invokeCreateOutlook = function (window, {toEmail, body, subject, ccEmail, bccEmail, attachment}) {
createOutlook({toEmail, body, subject, ccEmail, bccEmail, attachment}, function(error, result) {
if (error) throw error;
window.webContents.send("fromMain", 'createOutlook', result);
window.setTitle(result);
});
}