├── .github
└── FUNDING.yml
├── .gitignore
├── .idea
├── modules.xml
├── src.iml
└── vcs.xml
├── LICENSE
├── README.md
├── app.js
├── default.css
├── index.html
├── main.js
├── package-lock.json
├── package.json
├── preload.js
├── renderer.js
└── src
├── .idea
└── .idea.QuickStart
│ └── .idea
│ ├── .name
│ ├── indexLayout.xml
│ ├── projectSettingsUpdater.xml
│ └── vcs.xml
├── ExternalLibrary
├── ExternalLibrary.csproj
└── Libarary.cs
├── QuickStart.Core
└── QuickStart.Core.csproj
├── QuickStart.Standard
└── QuickStart.Standard.csproj
├── QuickStart.sln
└── shared
├── ExternalLibarary.cs
└── LocalMethods.cs
/.github/FUNDING.yml:
--------------------------------------------------------------------------------
1 | # These are supported funding model platforms
2 |
3 | github: [agracio]
4 | patreon: # Replace with a single Patreon username
5 | open_collective: # Replace with a single Open Collective username
6 | ko_fi: # Replace with a single Ko-fi username
7 | tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
8 | community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
9 | liberapay: # Replace with a single Liberapay username
10 | issuehunt: # Replace with a single IssueHunt username
11 | lfx_crowdfunding: # Replace with a single LFX Crowdfunding project-name e.g., cloud-foundry
12 | polar: # Replace with a single Polar username
13 | buy_me_a_coffee: # Replace with a single Buy Me a Coffee username
14 | custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']
15 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | .idea/workspace.xml
2 | node_modules/
3 | .vs/
4 | bin/
5 | obj/
6 | /src/.idea/.idea.QuickStart/.idea/workspace.xml
7 | /src/.idea/.idea.QuickStart/.idea/contentModel.xml
8 |
--------------------------------------------------------------------------------
/.idea/modules.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/.idea/src.iml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/.idea/vcs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2017
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | ## Quick start for [electron-edge-js](https://github.com/agracio/electron-edge-js)
2 |
3 | ## electron-edge-js-quick-start
4 |
5 | 1. Install dependencies `npm install`
6 | 2. Build dotnet project `dotnet build src/QuickStart.sln`
7 | 3. To run the app using .NET Core use `npm start`
8 | 4. To run the app using .NET Standard use `npm run start:standard`
9 |
--------------------------------------------------------------------------------
/app.js:
--------------------------------------------------------------------------------
1 | const { ipcMain} = require("electron");
2 | const path = require('path');
3 | var net = process.argv[1].replace('--', '');
4 | var framework = net.charAt(0).toUpperCase() + net.substr(1);
5 | var namespace = 'QuickStart.' + framework;
6 | if(net === 'core') net = '';
7 | var version = net === 'standard' ? '2.0' : '8.0'
8 |
9 | const baseNetAppPath = path.join(__dirname, '/src/'+ namespace +'/bin/Debug/net' + net + version);
10 | //const baseNetAppPath = path.join(__dirname, '/src/QuickStart.Core/bin/Release/net8.0/win-x64/publish');
11 |
12 | process.env.EDGE_USE_CORECLR = 1;
13 | if(net !== 'standard')
14 | {
15 | process.env.EDGE_APP_ROOT = baseNetAppPath;
16 | }
17 |
18 | var edge = require('electron-edge-js');
19 |
20 | var baseDll = path.join(baseNetAppPath, namespace + '.dll');
21 |
22 | var localTypeName = 'QuickStart.LocalMethods';
23 | var externalTypeName = 'QuickStart.ExternalMethods';
24 |
25 | var getAppDomainDirectory = edge.func({
26 | assemblyFile: baseDll,
27 | typeName: localTypeName,
28 | methodName: 'GetAppDomainDirectory'
29 | });
30 |
31 | var getCurrentTime = edge.func({
32 | assemblyFile: baseDll,
33 | typeName: localTypeName,
34 | methodName: 'GetCurrentTime'
35 | });
36 |
37 | var useDynamicInput = edge.func({
38 | assemblyFile: baseDll,
39 | typeName: localTypeName,
40 | methodName: 'UseDynamicInput'
41 | });
42 |
43 | var getPerson = edge.func({
44 | assemblyFile: baseDll,
45 | typeName: externalTypeName,
46 | methodName: 'GetPersonInfo'
47 | });
48 |
49 | var handleException = edge.func({
50 | assemblyFile: baseDll,
51 | typeName: localTypeName,
52 | methodName: 'ThrowException'
53 | });
54 |
55 | if(net !== 'standard'){
56 | var getInlinePerson = edge.func({
57 | source: function () {/*
58 | using System.Threading.Tasks;
59 | using System;
60 |
61 | public class Person
62 | {
63 | public Person(string name, string email, int age)
64 | {
65 | Id = Guid.NewGuid();
66 | Name = name;
67 | Email = email;
68 | Age = age;
69 | }
70 | public Guid Id {get;}
71 | public string Name {get;set;}
72 | public string Email {get;set;}
73 | public int Age {get;set;}
74 | }
75 |
76 | public class Startup
77 | {
78 | public async Task