mirror of
https://github.com/ElectronNET/Electron.NET.git
synced 2026-09-22 15:04:47 +00:00
Compare commits
335 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a0c0523c7d | ||
|
|
6d94cf9538 | ||
|
|
521e7c935a | ||
|
|
730eacbd52 | ||
|
|
deca8166ec | ||
|
|
a04ca0b9bc | ||
|
|
fffd7dfb79 | ||
|
|
98c72af3d6 | ||
|
|
703cf8f880 | ||
|
|
248d4bd664 | ||
|
|
d5da1dbc9b | ||
|
|
672ff6c40d | ||
|
|
7cd552a78f | ||
|
|
042d8e6c70 | ||
|
|
0140749753 | ||
|
|
7af2e954c7 | ||
|
|
da0e1f17db | ||
|
|
9cb210040d | ||
|
|
7e8f45b16d | ||
|
|
76dc687269 | ||
|
|
dcf4585510 | ||
|
|
a6d7434adf | ||
|
|
76ff44f67e | ||
|
|
20ab82b16d | ||
|
|
b27f705a6a | ||
|
|
8697c4de44 | ||
|
|
376a791e48 | ||
|
|
195a29052e | ||
|
|
f577a53227 | ||
|
|
382d544468 | ||
|
|
18f08f9aff | ||
|
|
def289ab54 | ||
|
|
4011f3d30b | ||
|
|
26b9d86ee4 | ||
|
|
3b57de976a | ||
|
|
d9e9b3d2e6 | ||
|
|
1ec1fde3c6 | ||
|
|
e5ccf75c9f | ||
|
|
819e643ab8 | ||
|
|
7fe3f9b5b6 | ||
|
|
16cbc5f2a4 | ||
|
|
3a2c997e6a | ||
|
|
f88f5f8b18 | ||
|
|
4e39f5f377 | ||
|
|
7fa5ec5b0b | ||
|
|
2f8f717dbb | ||
|
|
525d6185fb | ||
|
|
73703819be | ||
|
|
09249f74c6 | ||
|
|
cfd8be36f3 | ||
|
|
6055635eb5 | ||
|
|
74a734ae58 | ||
|
|
d4402d1040 | ||
|
|
4b65ed26a4 | ||
|
|
e12145004e | ||
|
|
3e8ebde05b | ||
|
|
820d7bbcec | ||
|
|
5eeab1bd24 | ||
|
|
1fff688098 | ||
|
|
9b701f5258 | ||
|
|
b41c7e51b1 | ||
|
|
1d24067f4b | ||
|
|
44e5c4e230 | ||
|
|
0b3053477d | ||
|
|
3fecc0ee1b | ||
|
|
95089e1721 | ||
|
|
cec178cf50 | ||
|
|
20af8a692c | ||
|
|
4e69bcf030 | ||
|
|
5ae5bf0df7 | ||
|
|
5da5d1c618 | ||
|
|
b6e496b2c6 | ||
|
|
5974cb9e43 | ||
|
|
d4d4e9dddd | ||
|
|
3b5f21c724 | ||
|
|
5aebe807c3 | ||
|
|
bdee008cc8 | ||
|
|
7fc5c9b611 | ||
|
|
86e5d74c03 | ||
|
|
e79b029e16 | ||
|
|
5bdf6230b9 | ||
|
|
8c2382a05c | ||
|
|
10b1b686cb | ||
|
|
d7d2521d0c | ||
|
|
392419e5a7 | ||
|
|
f92f07a378 | ||
|
|
9b045cbf01 | ||
|
|
94ff3c1c4d | ||
|
|
773937448d | ||
|
|
b094051dcb | ||
|
|
3a10e7e98d | ||
|
|
056661028b | ||
|
|
27a8c69a9a | ||
|
|
8e900655b9 | ||
|
|
066efa80e2 | ||
|
|
18944fe222 | ||
|
|
0e83af032c | ||
|
|
1ec84cfef0 | ||
|
|
1620c50627 | ||
|
|
295b250e58 | ||
|
|
644628c803 | ||
|
|
a18944d4a4 | ||
|
|
b5858a697a | ||
|
|
58b9ad0125 | ||
|
|
e44927a655 | ||
|
|
ed9a24bb5e | ||
|
|
94df47efa6 | ||
|
|
d9f3da87a8 | ||
|
|
a33d76ae2f | ||
|
|
15d6a23016 | ||
|
|
c76ce9702d | ||
|
|
279a823eb7 | ||
|
|
fdab81a3a6 | ||
|
|
558e582789 | ||
|
|
c4251955d9 | ||
|
|
af5e70c000 | ||
|
|
fee3806953 | ||
|
|
979b25ffe7 | ||
|
|
07be82cca6 | ||
|
|
fe939e0fda | ||
|
|
50c9076af6 | ||
|
|
d7e1a09880 | ||
|
|
30b7b1d251 | ||
|
|
e9b3ba0add | ||
|
|
89f721d1b3 | ||
|
|
833d288891 | ||
|
|
e529d092c3 | ||
|
|
11f71feeb8 | ||
|
|
1e8b02648a | ||
|
|
2a14840c6b | ||
|
|
005feddcc5 | ||
|
|
3f14f9ae7e | ||
|
|
ce271fd30a | ||
|
|
1d1b9537b5 | ||
|
|
4c48588ce2 | ||
|
|
c9945a87a9 | ||
|
|
8fc197b32a | ||
|
|
7930831b6d | ||
|
|
201046164c | ||
|
|
b8151a2fad | ||
|
|
c1bf6d9423 | ||
|
|
c8268fae0e | ||
|
|
8eead56cbc | ||
|
|
e28eadc32d | ||
|
|
9a935c009e | ||
|
|
c22c248f0b | ||
|
|
842e8700ef | ||
|
|
3850a71579 | ||
|
|
d5df30718b | ||
|
|
77ca79acc9 | ||
|
|
05fb9e5a29 | ||
|
|
850d8f6902 | ||
|
|
497e6aa423 | ||
|
|
41c5b5af62 | ||
|
|
10679029e8 | ||
|
|
a451e3a599 | ||
|
|
09c735a10f | ||
|
|
8009348941 | ||
|
|
b3b124bde1 | ||
|
|
21226e1ef0 | ||
|
|
7174118a3e | ||
|
|
092789a5ec | ||
|
|
bff3fffcbd | ||
|
|
f4da9588c9 | ||
|
|
04c1415f6d | ||
|
|
456135a562 | ||
|
|
300f52510c | ||
|
|
d85a64f515 | ||
|
|
53698d1d44 | ||
|
|
04a224aa4f | ||
|
|
891da140b7 | ||
|
|
17f761d184 | ||
|
|
9f6489891e | ||
|
|
c8f1cdf59f | ||
|
|
6c95dfd476 | ||
|
|
b180fc2ea8 | ||
|
|
682a1c38ed | ||
|
|
809b0a6be7 | ||
|
|
ae3f755648 | ||
|
|
7e6760a428 | ||
|
|
29fdbb5315 | ||
|
|
36bba6a49f | ||
|
|
44a010e0ed | ||
|
|
25770db138 | ||
|
|
1c99ab02cc | ||
|
|
73c56e2450 | ||
|
|
30037fce69 | ||
|
|
69048d5565 | ||
|
|
d9c8e04b5c | ||
|
|
368ef412bb | ||
|
|
cb20fbad25 | ||
|
|
89cdf2f55b | ||
|
|
1c62c1f132 | ||
|
|
d3e3188681 | ||
|
|
4f95043309 | ||
|
|
13f1203ccc | ||
|
|
9d0378798b | ||
|
|
1d6ef7a250 | ||
|
|
2d6d4e2320 | ||
|
|
df8e269d5c | ||
|
|
bdfbcd5b77 | ||
|
|
19e785f53f | ||
|
|
0b453177b5 | ||
|
|
8ed7f27722 | ||
|
|
321b8cd9e5 | ||
|
|
b326f863d8 | ||
|
|
f148fe6a14 | ||
|
|
515d325731 | ||
|
|
f32a40fe17 | ||
|
|
c53a5a9163 | ||
|
|
8d4cdddc46 | ||
|
|
70e8f85123 | ||
|
|
5a7cbd972f | ||
|
|
33da428c45 | ||
|
|
f1b4766360 | ||
|
|
e070759645 | ||
|
|
49eaa5e129 | ||
|
|
b3f5a3c52b | ||
|
|
0d732ce99e | ||
|
|
218b99808b | ||
|
|
7f507a6d86 | ||
|
|
81b3793966 | ||
|
|
1baa5c6200 | ||
|
|
5f76804065 | ||
|
|
70ffebf39d | ||
|
|
0a54735f35 | ||
|
|
1ac371b3da | ||
|
|
e854451043 | ||
|
|
331c2f548c | ||
|
|
b00adcbd38 | ||
|
|
ed6d24dbb1 | ||
|
|
2c82206c62 | ||
|
|
d0eb0880b1 | ||
|
|
0321804128 | ||
|
|
f548ff08d4 | ||
|
|
bbc7c79d5a | ||
|
|
2389ae32bd | ||
|
|
42fecbdc98 | ||
|
|
95e02e2655 | ||
|
|
153625ba51 | ||
|
|
c97f914e7a | ||
|
|
d95b41fbae | ||
|
|
2b2b26e13b | ||
|
|
9bb2adca78 | ||
|
|
88d2daacb1 | ||
|
|
c90f003519 | ||
|
|
daa9f399e9 | ||
|
|
6246b44d68 | ||
|
|
347c1ef0e4 | ||
|
|
7c8eeef225 | ||
|
|
44a820e285 | ||
|
|
8ccc7bfdd0 | ||
|
|
cf185fd2fb | ||
|
|
4ee11aaeae | ||
|
|
f1063bbe98 | ||
|
|
7c39d28f81 | ||
|
|
e52bf69dee | ||
|
|
46d395ad12 | ||
|
|
c0e3a595c3 | ||
|
|
65db66b4e9 | ||
|
|
ce8a86baf5 | ||
|
|
7eaf84a021 | ||
|
|
90f5f5dbe2 | ||
|
|
e09ef35be4 | ||
|
|
dae521180f | ||
|
|
c81ed54fff | ||
|
|
276ce8f4dc | ||
|
|
20212cdca7 | ||
|
|
0acdc65271 | ||
|
|
c92a54fbda | ||
|
|
4de7760556 | ||
|
|
3821ca60ea | ||
|
|
59887cce5f | ||
|
|
77834d0f2e | ||
|
|
6761119241 | ||
|
|
41d9f0afc7 | ||
|
|
1d554fda60 | ||
|
|
2f4d37d823 | ||
|
|
1815951092 | ||
|
|
aa483ebaa4 | ||
|
|
9b4e0e4504 | ||
|
|
d05191d1e2 | ||
|
|
ef41329a91 | ||
|
|
edafa8ccdb | ||
|
|
55c035323b | ||
|
|
2e5c6200a6 | ||
|
|
be518a7a10 | ||
|
|
9e9558b837 | ||
|
|
5f6e4a9e9d | ||
|
|
b89c08ee96 | ||
|
|
8ff875435b | ||
|
|
bfad0cd45a | ||
|
|
91ed116cb1 | ||
|
|
54eac4b521 | ||
|
|
ac05ded844 | ||
|
|
5434b0ec8e | ||
|
|
20acd31f1a | ||
|
|
f53d071bd9 | ||
|
|
2cf3095450 | ||
|
|
0ec791da9d | ||
|
|
0580942a59 | ||
|
|
8e8d88c48f | ||
|
|
61476e3ca4 | ||
|
|
9488576d8f | ||
|
|
ff1b802838 | ||
|
|
c98ad58290 | ||
|
|
a30239e3a6 | ||
|
|
17f24749cd | ||
|
|
7558037b91 | ||
|
|
e4485fd483 | ||
|
|
1a964b405e | ||
|
|
dfcb2345f3 | ||
|
|
3f10d6b5dd | ||
|
|
90c3eb2c88 | ||
|
|
dbf76a1d6d | ||
|
|
8e7892ebd4 | ||
|
|
30b547b8d3 | ||
|
|
30b4d92291 | ||
|
|
6c9027faf3 | ||
|
|
c712027ea3 | ||
|
|
7889057022 | ||
|
|
68c50f1c1e | ||
|
|
1006355bb7 | ||
|
|
12c5391164 | ||
|
|
8ba24c0f2f | ||
|
|
bb7ae8d711 | ||
|
|
385dcfbf52 | ||
|
|
515430ff96 | ||
|
|
a6d67a4dfe | ||
|
|
946b2af81a | ||
|
|
1e483e9cc4 | ||
|
|
5305e17ba9 | ||
|
|
442084a3e5 | ||
|
|
cd205edabb | ||
|
|
10bf461b51 |
149
.github/CONTRIBUTING.md
vendored
Normal file
149
.github/CONTRIBUTING.md
vendored
Normal file
@@ -0,0 +1,149 @@
|
|||||||
|
# Contributing
|
||||||
|
|
||||||
|
## Project Scope
|
||||||
|
|
||||||
|
The Electron.NET project ultimately tries to provide a framework for developing cross-platform client applications on the basis of .NET and Electron. Anything that is related to this goal will be considered. The project aims to be as close to Electron with .NET as a basis as possible. If your contribution does not reflect that goal, the chances of accepting it are limited.
|
||||||
|
|
||||||
|
## Code License
|
||||||
|
|
||||||
|
This is an open source project falling under the [MIT License](../LICENSE). By using, distributing, or contributing to this project, you accept and agree that all code within the Electron.NET project and its libraries are licensed under MIT license.
|
||||||
|
|
||||||
|
## Becoming a Contributor
|
||||||
|
|
||||||
|
Usually appointing someone as a contributor follows this process:
|
||||||
|
|
||||||
|
1. An individual contributes actively via discussions (reporting bugs, giving feedback to existing or opening new issues) and / or pull requests
|
||||||
|
2. The individual is either directly asked, invited or asks for contributor rights on the project
|
||||||
|
3. The individual uses the contribution rights to sustain or increase the active contributions
|
||||||
|
|
||||||
|
Every contributor might have to sign the contributor's license agreement (CLA) to establish a legal trust between the project and its contributors.
|
||||||
|
|
||||||
|
## Working on Electron.NET
|
||||||
|
|
||||||
|
### Issue Discussion
|
||||||
|
|
||||||
|
Discussion of issues should be placed transparently in the issue tracker here on GitHub.
|
||||||
|
|
||||||
|
* [General issues, bugs, new features](https://github.com/ElectronNET/Electron.NET/issues)
|
||||||
|
* [General discussions, help, exchange of ideas](https://github.com/ElectronNET/Electron.NET/discussions)
|
||||||
|
|
||||||
|
### Modifying the code
|
||||||
|
|
||||||
|
Electron.NET and its libraries uses features from the latest versions of C# (e.g., C# 10). You will therefore need a C# compiler that is up for the job.
|
||||||
|
|
||||||
|
1. Fork and clone the repo.
|
||||||
|
2. First try to build the ElectronNET.Core library and see if you get the tests running.
|
||||||
|
3. You will be required to resolve some dependencies via NuGet.
|
||||||
|
|
||||||
|
The build system of Electron.NET uses NUKE.
|
||||||
|
|
||||||
|
### Code Conventions
|
||||||
|
|
||||||
|
Most parts in the Electron.NET project are fairly straight forward. Among these are:
|
||||||
|
|
||||||
|
* Always use statement blocks for control statements, e.g., in a for-loop, if-condition, ...
|
||||||
|
* You may use a simple (throw) statement in case of enforcing contracts on argument
|
||||||
|
* Be explicit about modifiers (some files follow an older convention of the code base, but we settled on the explicit style)
|
||||||
|
|
||||||
|
### Development Workflow
|
||||||
|
|
||||||
|
1. If no issue already exists for the work you'll be doing, create one to document the problem(s) being solved and self-assign.
|
||||||
|
2. Otherwise please let us know that you are working on the problem. Regular status updates (e.g. "still in progress", "no time anymore", "practically done", "pull request issued") are highly welcome.
|
||||||
|
3. Create a new branch—please don't work in the `main` branch directly. It is reserved for releases. We recommend naming the branch to match the issue being addressed (`feature/#777` or `issue-777`).
|
||||||
|
4. Add failing tests for the change you want to make. Tests are crucial and should be taken from W3C (or other specification).
|
||||||
|
5. Fix stuff. Always go from edge case to edge case.
|
||||||
|
6. All tests should pass now. Also your new implementation should not break existing tests.
|
||||||
|
7. Update the documentation to reflect any changes. (or document such changes in the original issue)
|
||||||
|
8. Push to your fork or push your issue-specific branch to the main repository, then submit a pull request against `develop`.
|
||||||
|
|
||||||
|
Just to illustrate the git workflow for Electron.NET a little bit more we've added the following graphs.
|
||||||
|
|
||||||
|
Initially, Electron.NET starts at the `main` branch. This branch should contain the latest stable (or released) version.
|
||||||
|
|
||||||
|
Here we now created a new branch called `develop`. This is the development branch.
|
||||||
|
|
||||||
|
Now active work is supposed to be done. Therefore a new branch should be created. Let's create one:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
git checkout -b feature/#777
|
||||||
|
```
|
||||||
|
|
||||||
|
There may be many of these feature branches. Most of them are also pushed to the server for discussion or synchronization.
|
||||||
|
|
||||||
|
```sh
|
||||||
|
git push -u origin feature/#777
|
||||||
|
```
|
||||||
|
|
||||||
|
Now feature branches may be closed when they are done. Here we simply merge with the feature branch(es). For instance the following command takes the `feature/#777` branch from the server and merges it with the `develop` branch.
|
||||||
|
|
||||||
|
```sh
|
||||||
|
git checkout develop
|
||||||
|
git pull
|
||||||
|
git pull origin feature/#777
|
||||||
|
git push
|
||||||
|
```
|
||||||
|
|
||||||
|
Finally, we may have all the features that are needed to release a new version of Electron.NET. Here we tag the release. For instance for the 1.0 release we use `v1.0`.
|
||||||
|
|
||||||
|
```sh
|
||||||
|
git checkout main
|
||||||
|
git merge develop
|
||||||
|
git tag v1.0
|
||||||
|
```
|
||||||
|
|
||||||
|
(The last part is automatically performed by our CI system. Don't tag manually.)
|
||||||
|
|
||||||
|
### Versioning
|
||||||
|
|
||||||
|
The rules of [semver](http://semver.org/) don't necessarily apply here, but we will try to stay quite close to them.
|
||||||
|
|
||||||
|
Prior to version 1.0.0 we use the following scheme:
|
||||||
|
|
||||||
|
1. MINOR versions for reaching a feature milestone potentially combined with dramatic API changes
|
||||||
|
2. PATCH versions for refinements (e.g. performance improvements, bug fixes)
|
||||||
|
|
||||||
|
After releasing version 1.0.0 the scheme changes to become:
|
||||||
|
|
||||||
|
1. MAJOR versions at maintainers' discretion following significant changes to the codebase (e.g., API changes)
|
||||||
|
2. MINOR versions for backwards-compatible enhancements (e.g., performance improvements)
|
||||||
|
3. PATCH versions for backwards-compatible bug fixes (e.g., spec compliance bugs, support issues)
|
||||||
|
|
||||||
|
#### Code style
|
||||||
|
|
||||||
|
Regarding code style like indentation and whitespace, **follow the conventions you see used in the source already.** In general most of the [C# coding guidelines from Microsoft](https://msdn.microsoft.com/en-us/library/ff926074.aspx) are followed. This project prefers type inference with `var` to explicitly stating (redundant) information.
|
||||||
|
|
||||||
|
It is also important to keep a certain `async`-flow and to always use `ConfigureAwait(false)` in conjunction with an `await` expression.
|
||||||
|
|
||||||
|
## Backwards Compatibility
|
||||||
|
|
||||||
|
We always try to remain backwards compatible beyond the currently supported versions of .NET.
|
||||||
|
|
||||||
|
For instance, in December 2025 there have been activity to remove .NET 6 support from the codebase. We rejected this. Key points:
|
||||||
|
|
||||||
|
1. We have absolutely no need to drop `.net6` support. It doesn't hurt us in any way.
|
||||||
|
2. Many are still using `.net6`, including Electron.NET (non-Core) users. It doesn't make sense to force them to update two things at the same time (.NET + Electron.NET).
|
||||||
|
3. We MUST NOT and NEVER update `Microsoft.Build.Utilities.Core`. This will make Electron.NET stop working on older Visual Studio and MSBuild versions. There's are also no reasons to update it in the first place.
|
||||||
|
|
||||||
|
It's important to note that the Microsoft label of "Out of support" on .NET has almost no practical meaning. We've rarely (if ever) seen any bugs fixed in the same .NET version which mattered. The bugs that all new .NET versions have are much worse than mature .NET versions which are declared as "out of support". Keep in mind that the LTS matters most for active development / ongoing supported projects. If, e.g., a TV has been released a decade ago it most likely won't be patched. Still, you might want to deploy applications to it, which then naturally would involve being based on "out of support" versions of the framework.
|
||||||
|
|
||||||
|
TL;DR: Unless there is a technical reason (e.g., a crucial new API not being available) we should not drop "out of support" .NET versions. At the time of writing (December 2025) the minimum supported .NET version remains at `.net6`.
|
||||||
|
|
||||||
|
## Timeline
|
||||||
|
|
||||||
|
**All of this information is related to ElectronNET.Core pre-v1!**
|
||||||
|
|
||||||
|
We pretty much release whenever we have something new (i.e., do fixes such as a 0.1.1, or add new features, such as a 0.2.0) quite quickly.
|
||||||
|
|
||||||
|
We will go for a 1.0.0 release of this as early as ~mid of June 2026 (unless we find some critical things or want to extend the beta phase for ElectronNET.Core). This should be sufficient time to get some user input and have enough experience to call it stable.
|
||||||
|
|
||||||
|
## Updating Electron Versions
|
||||||
|
|
||||||
|
The releases of Electron are found on the [releases.electronjs.org](https://releases.electronjs.org/release?page=1) website.
|
||||||
|
|
||||||
|
You can update the `src\ElectronNET\build\ElectronNETRules.Project.xaml` file with new entries using the following script (run it in the browser's console when being on the Electron Releases website):
|
||||||
|
|
||||||
|
```js
|
||||||
|
[...new Set([...document.querySelectorAll('tbody tr a[href^="/release/v"]')].map(m => m.getAttribute('href').replace('/release/v', '')))].map(m => `<EnumValue Name="${m}" DisplayName="${m}" />`).sort().join('\n')
|
||||||
|
```
|
||||||
|
|
||||||
|
Alternatively, use the website's information to feed into an AI agent of your choice.
|
||||||
@@ -1,33 +1,27 @@
|
|||||||
name: CI
|
name: Build and Publish
|
||||||
|
|
||||||
on: [push, pull_request]
|
on:
|
||||||
|
push:
|
||||||
|
branches: [main, develop]
|
||||||
|
|
||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }}
|
NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }}
|
||||||
|
|
||||||
|
concurrency:
|
||||||
|
group: build-publish-${{ github.ref }}
|
||||||
|
cancel-in-progress: true
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
# linux:
|
Integration-Tests:
|
||||||
# runs-on: ubuntu-latest
|
uses: ./.github/workflows/integration-tests.yml
|
||||||
# timeout-minutes: 10
|
name: '1'
|
||||||
|
|
||||||
# steps:
|
Publish:
|
||||||
# - uses: actions/checkout@v4
|
needs: [Integration-Tests]
|
||||||
|
|
||||||
# - name: Setup dotnet
|
|
||||||
# uses: actions/setup-dotnet@v4
|
|
||||||
# with:
|
|
||||||
# dotnet-version: |
|
|
||||||
# 6.0.x
|
|
||||||
# 8.0.x
|
|
||||||
# 10.0.x
|
|
||||||
|
|
||||||
# - name: Build
|
|
||||||
# run: ./build.sh
|
|
||||||
|
|
||||||
windows:
|
|
||||||
runs-on: windows-latest
|
runs-on: windows-latest
|
||||||
timeout-minutes: 10
|
timeout-minutes: 10
|
||||||
|
name: '2 / Publish'
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
39
.github/workflows/PR Validation.yml
vendored
Normal file
39
.github/workflows/PR Validation.yml
vendored
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
name: PR Validation
|
||||||
|
|
||||||
|
on: [pull_request]
|
||||||
|
|
||||||
|
concurrency:
|
||||||
|
group: pr-validation-${{ github.ref }}
|
||||||
|
cancel-in-progress: true
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
Whitespace-Check:
|
||||||
|
uses: ./.github/workflows/trailing-whitespace-check.yml
|
||||||
|
secrets: inherit
|
||||||
|
name: '1'
|
||||||
|
|
||||||
|
Tests:
|
||||||
|
needs: Whitespace-Check
|
||||||
|
uses: ./.github/workflows/integration-tests.yml
|
||||||
|
secrets: inherit
|
||||||
|
name: '2'
|
||||||
|
|
||||||
|
build:
|
||||||
|
needs: [Whitespace-Check, Tests]
|
||||||
|
runs-on: windows-latest
|
||||||
|
timeout-minutes: 10
|
||||||
|
name: '3 / Build'
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Setup dotnet
|
||||||
|
uses: actions/setup-dotnet@v4
|
||||||
|
with:
|
||||||
|
dotnet-version: |
|
||||||
|
6.0.x
|
||||||
|
8.0.x
|
||||||
|
10.0.x
|
||||||
|
|
||||||
|
- name: Build
|
||||||
|
run: .\build.ps1
|
||||||
219
.github/workflows/integration-tests.yml
vendored
Normal file
219
.github/workflows/integration-tests.yml
vendored
Normal file
@@ -0,0 +1,219 @@
|
|||||||
|
name: Tests
|
||||||
|
|
||||||
|
on:
|
||||||
|
workflow_call:
|
||||||
|
|
||||||
|
concurrency:
|
||||||
|
group: integration-tests-${{ github.workflow }}-${{ github.ref }}
|
||||||
|
cancel-in-progress: true
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
tests:
|
||||||
|
name: ${{ matrix.os }} API-${{ matrix.electronVersion }}
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
|
timeout-minutes: 25
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
os: [ubuntu-22.04, ubuntu-24.04, windows-2022, windows-2025, macos-14, macos-15-intel, macos-26]
|
||||||
|
electronVersion: ['30.4.0', '38.2.2']
|
||||||
|
include:
|
||||||
|
- os: ubuntu-22.04
|
||||||
|
rid: linux-x64
|
||||||
|
- os: ubuntu-24.04
|
||||||
|
rid: linux-x64
|
||||||
|
- os: windows-2022
|
||||||
|
rid: win-x64
|
||||||
|
- os: windows-2025
|
||||||
|
rid: win-x64
|
||||||
|
- os: macos-14
|
||||||
|
rid: osx-arm64
|
||||||
|
- os: macos-15-intel
|
||||||
|
rid: osx-x64
|
||||||
|
- os: macos-26
|
||||||
|
rid: osx-arm64
|
||||||
|
|
||||||
|
env:
|
||||||
|
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1
|
||||||
|
DOTNET_NOLOGO: 1
|
||||||
|
CI: true
|
||||||
|
ELECTRON_ENABLE_LOGGING: 1
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Setup .NET
|
||||||
|
uses: actions/setup-dotnet@v4
|
||||||
|
with:
|
||||||
|
dotnet-version: '10.0.x'
|
||||||
|
|
||||||
|
- name: Setup Node.js
|
||||||
|
uses: actions/setup-node@v4
|
||||||
|
with:
|
||||||
|
node-version: '22'
|
||||||
|
|
||||||
|
- name: Restore
|
||||||
|
run: dotnet restore -r ${{ matrix.rid }} -p:RuntimeIdentifier=${{ matrix.rid }} -p:ElectronVersion=${{ matrix.electronVersion }} src/ElectronNET.IntegrationTests/ElectronNET.IntegrationTests.csproj
|
||||||
|
|
||||||
|
- name: Build
|
||||||
|
run: dotnet build --no-restore -c Release -r ${{ matrix.rid }} -p:RuntimeIdentifier=${{ matrix.rid }} -p:ElectronVersion=${{ matrix.electronVersion }} src/ElectronNET.IntegrationTests/ElectronNET.IntegrationTests.csproj
|
||||||
|
|
||||||
|
- name: Install Linux GUI dependencies
|
||||||
|
if: runner.os == 'Linux'
|
||||||
|
run: |
|
||||||
|
set -e
|
||||||
|
sudo apt-get update
|
||||||
|
. /etc/os-release
|
||||||
|
if [ "$VERSION_ID" = "24.04" ]; then ALSA_PKG=libasound2t64; else ALSA_PKG=libasound2; fi
|
||||||
|
echo "Using ALSA package: $ALSA_PKG"
|
||||||
|
sudo apt-get install -y xvfb \
|
||||||
|
libgtk-3-0 libnss3 libgdk-pixbuf-2.0-0 libdrm2 libgbm1 libxss1 libxtst6 libatk-bridge2.0-0 libatk1.0-0 libatspi2.0-0 libx11-xcb1 "$ALSA_PKG"
|
||||||
|
|
||||||
|
- name: Run tests (Linux)
|
||||||
|
if: runner.os == 'Linux'
|
||||||
|
continue-on-error: true
|
||||||
|
timeout-minutes: 15
|
||||||
|
run: |
|
||||||
|
mkdir -p test-results
|
||||||
|
xvfb-run -a dotnet test src/ElectronNET.IntegrationTests/ElectronNET.IntegrationTests.csproj \
|
||||||
|
-c Release --no-build -r ${{ matrix.rid }} -p:RuntimeIdentifier=${{ matrix.rid }} -p:ElectronVersion=${{ matrix.electronVersion }} \
|
||||||
|
--logger "trx;LogFileName=${{ matrix.os }}-electron-${{ matrix.electronVersion }}.trx" \
|
||||||
|
--logger "console;verbosity=detailed" \
|
||||||
|
--blame-hang --blame-hang-timeout 5min \
|
||||||
|
--results-directory test-results
|
||||||
|
|
||||||
|
- name: Run tests (Windows)
|
||||||
|
if: runner.os == 'Windows'
|
||||||
|
continue-on-error: true
|
||||||
|
timeout-minutes: 15
|
||||||
|
run: |
|
||||||
|
New-Item -ItemType Directory -Force -Path test-results | Out-Null
|
||||||
|
dotnet test src/ElectronNET.IntegrationTests/ElectronNET.IntegrationTests.csproj -c Release --no-build -r ${{ matrix.rid }} -p:RuntimeIdentifier=${{ matrix.rid }} -p:ElectronVersion=${{ matrix.electronVersion }} --logger "trx;LogFileName=${{ matrix.os }}-electron-${{ matrix.electronVersion }}.trx" --logger "console;verbosity=detailed" --blame-hang --blame-hang-timeout 5min --results-directory test-results
|
||||||
|
|
||||||
|
- name: Run tests (macOS)
|
||||||
|
if: runner.os == 'macOS'
|
||||||
|
continue-on-error: true
|
||||||
|
timeout-minutes: 15
|
||||||
|
run: |
|
||||||
|
mkdir -p test-results
|
||||||
|
dotnet test src/ElectronNET.IntegrationTests/ElectronNET.IntegrationTests.csproj -c Release --no-build -r ${{ matrix.rid }} -p:RuntimeIdentifier=${{ matrix.rid }} -p:ElectronVersion=${{ matrix.electronVersion }} --logger "trx;LogFileName=${{ matrix.os }}-electron-${{ matrix.electronVersion }}.trx" --logger "console;verbosity=detailed" --blame-hang --blame-hang-timeout 5min --results-directory test-results
|
||||||
|
|
||||||
|
- name: Upload raw test results
|
||||||
|
if: always()
|
||||||
|
uses: actions/upload-artifact@v4
|
||||||
|
with:
|
||||||
|
name: test-results-${{ matrix.os }}-electron-${{ matrix.electronVersion }}
|
||||||
|
path: test-results/*.trx
|
||||||
|
retention-days: 7
|
||||||
|
|
||||||
|
summary:
|
||||||
|
name: Test Results
|
||||||
|
runs-on: ubuntu-24.04
|
||||||
|
if: always()
|
||||||
|
needs: [tests]
|
||||||
|
timeout-minutes: 10
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
actions: read
|
||||||
|
contents: read
|
||||||
|
checks: write
|
||||||
|
pull-requests: write
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Download all test results
|
||||||
|
uses: actions/download-artifact@v4
|
||||||
|
with:
|
||||||
|
path: test-results
|
||||||
|
|
||||||
|
- name: Setup .NET (for CTRF conversion)
|
||||||
|
uses: actions/setup-dotnet@v4
|
||||||
|
with:
|
||||||
|
dotnet-version: '10.0.x'
|
||||||
|
|
||||||
|
- name: Install CTRF TRX→CTRF converter (dotnet tool)
|
||||||
|
run: |
|
||||||
|
dotnet new tool-manifest
|
||||||
|
dotnet tool install DotnetCtrfJsonReporter --local
|
||||||
|
|
||||||
|
- name: Convert TRX → CTRF and clean names (filePath=OS|Electron X.Y.Z)
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
set -euo pipefail
|
||||||
|
mkdir -p ctrf
|
||||||
|
shopt -s globstar nullglob
|
||||||
|
conv=0
|
||||||
|
for trx in test-results/**/*.trx; do
|
||||||
|
base="$(basename "$trx" .trx)" # e.g. ubuntu-22.04-electron-30.4.0
|
||||||
|
os="${base%%-electron-*}"
|
||||||
|
electron="${base#*-electron-}"
|
||||||
|
label="$os|Electron $electron"
|
||||||
|
outdir="ctrf/${label}"
|
||||||
|
mkdir -p "$outdir"
|
||||||
|
out="${outdir}/ctrf-report.json"
|
||||||
|
|
||||||
|
dotnet tool run DotnetCtrfJsonReporter -p "$trx" -d "$outdir" -f "ctrf-report.json"
|
||||||
|
|
||||||
|
jq --arg fp "$label" '.results.tests |= map(.filePath = $fp)' "$out" > "${out}.tmp" && mv "${out}.tmp" "$out"
|
||||||
|
|
||||||
|
echo "Converted & normalized $trx -> $out"
|
||||||
|
conv=$((conv+1))
|
||||||
|
done
|
||||||
|
echo "Processed $conv TRX file(s)"
|
||||||
|
|
||||||
|
- name: Publish Test Report
|
||||||
|
if: always()
|
||||||
|
uses: ctrf-io/github-test-reporter@v1
|
||||||
|
with:
|
||||||
|
report-path: 'ctrf/**/*.json'
|
||||||
|
summary: true
|
||||||
|
pull-request: false
|
||||||
|
status-check: false
|
||||||
|
status-check-name: 'Integration Tests'
|
||||||
|
use-suite-name: true
|
||||||
|
update-comment: true
|
||||||
|
always-group-by: true
|
||||||
|
overwrite-comment: true
|
||||||
|
exit-on-fail: true
|
||||||
|
group-by: 'suite'
|
||||||
|
upload-artifact: true
|
||||||
|
fetch-previous-results: true
|
||||||
|
summary-report: false
|
||||||
|
summary-delta-report: true
|
||||||
|
github-report: true
|
||||||
|
test-report: false
|
||||||
|
test-list-report: false
|
||||||
|
failed-report: true
|
||||||
|
failed-folded-report: false
|
||||||
|
skipped-report: true
|
||||||
|
suite-folded-report: true
|
||||||
|
suite-list-report: false
|
||||||
|
file-report: true
|
||||||
|
previous-results-report: true
|
||||||
|
insights-report: true
|
||||||
|
flaky-report: true
|
||||||
|
flaky-rate-report: true
|
||||||
|
fail-rate-report: false
|
||||||
|
slowest-report: false
|
||||||
|
report-order: 'summary-delta-report,failed-report,skipped-report,suite-folded-report,file-report,previous-results-report,github-report'
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ github.token }}
|
||||||
|
|
||||||
|
- name: Save PR Number
|
||||||
|
if: github.event_name == 'pull_request'
|
||||||
|
run: echo "PR_NUMBER=${{ github.event.pull_request.number }}" >> $GITHUB_ENV
|
||||||
|
|
||||||
|
- name: Write PR Number to File
|
||||||
|
if: github.event_name == 'pull_request'
|
||||||
|
run: echo "$PR_NUMBER" > pr_number.txt
|
||||||
|
shell: bash
|
||||||
|
|
||||||
|
- name: Upload PR Number Artifact
|
||||||
|
if: github.event_name == 'pull_request'
|
||||||
|
uses: actions/upload-artifact@v4
|
||||||
|
with:
|
||||||
|
name: pr_number
|
||||||
|
path: pr_number.txt
|
||||||
|
|
||||||
|
- name: Summary
|
||||||
|
run: echo "All matrix test jobs completed."
|
||||||
81
.github/workflows/pr-comment.yml
vendored
Normal file
81
.github/workflows/pr-comment.yml
vendored
Normal file
@@ -0,0 +1,81 @@
|
|||||||
|
name: Create PR Comments
|
||||||
|
|
||||||
|
on:
|
||||||
|
workflow_run:
|
||||||
|
workflows: [ "PR Validation" ]
|
||||||
|
types: [completed]
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
actions: read
|
||||||
|
pull-requests: write
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
pr-comment:
|
||||||
|
name: Post Test Result as PR comment
|
||||||
|
runs-on: ubuntu-24.04
|
||||||
|
if: github.event.workflow_run.event == 'pull_request' && github.event.workflow_run.conclusion != 'cancelled'
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Download CTRF artifact
|
||||||
|
uses: dawidd6/action-download-artifact@v8
|
||||||
|
with:
|
||||||
|
github_token: ${{ github.token }}
|
||||||
|
run_id: ${{ github.event.workflow_run.id }}
|
||||||
|
name: ctrf-report
|
||||||
|
path: ctrf
|
||||||
|
|
||||||
|
- name: Download PR Number Artifact
|
||||||
|
uses: dawidd6/action-download-artifact@v8
|
||||||
|
with:
|
||||||
|
github_token: ${{ github.token }}
|
||||||
|
run_id: ${{ github.event.workflow_run.id }}
|
||||||
|
name: pr_number
|
||||||
|
path: pr_number
|
||||||
|
|
||||||
|
- name: Read PR Number
|
||||||
|
run: |
|
||||||
|
set -Eeuo pipefail
|
||||||
|
FILE='pr_number/pr_number.txt'
|
||||||
|
|
||||||
|
# Ensure file exists
|
||||||
|
if [ ! -f "$FILE" ] || [ -L "$FILE" ]; then
|
||||||
|
echo "Error: $FILE is missing or is not a regular file." >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Chec file size
|
||||||
|
if [ "$(wc -c < "$FILE" | tr -d ' ')" -gt 200 ]; then
|
||||||
|
echo "Error: $FILE is too large." >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Read first line
|
||||||
|
PR_NUMBER=""
|
||||||
|
IFS= read -r PR_NUMBER < "$FILE" || true
|
||||||
|
|
||||||
|
# Validate whether it's a number
|
||||||
|
if ! [[ "$PR_NUMBER" =~ ^[0-9]{1,10}$ ]]; then
|
||||||
|
echo "Error: PR_NUMBER is not a valid integer on the first line." >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
printf 'PR_NUMBER=%s\n' "$PR_NUMBER" >> "$GITHUB_ENV"
|
||||||
|
|
||||||
|
- name: Post PR Comment
|
||||||
|
uses: ctrf-io/github-test-reporter@v1
|
||||||
|
with:
|
||||||
|
report-path: 'ctrf/**/*.json'
|
||||||
|
issue: ${{ env.PR_NUMBER }}
|
||||||
|
|
||||||
|
summary: true
|
||||||
|
pull-request: true
|
||||||
|
use-suite-name: true
|
||||||
|
update-comment: true
|
||||||
|
always-group-by: true
|
||||||
|
overwrite-comment: true
|
||||||
|
upload-artifact: false
|
||||||
|
|
||||||
|
pull-request-report: true
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ github.token }}
|
||||||
49
.github/workflows/retry-test-jobs.yml
vendored
Normal file
49
.github/workflows/retry-test-jobs.yml
vendored
Normal file
@@ -0,0 +1,49 @@
|
|||||||
|
name: Tests auto-rerun
|
||||||
|
|
||||||
|
on:
|
||||||
|
workflow_run:
|
||||||
|
workflows: [ "PR Validation", "Build and Publish" ]
|
||||||
|
types: [ completed ]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
rerun-failed-matrix-jobs-once:
|
||||||
|
if: >
|
||||||
|
${{
|
||||||
|
github.event.workflow_run.conclusion == 'failure' &&
|
||||||
|
github.event.workflow_run.run_attempt == 1
|
||||||
|
}}
|
||||||
|
runs-on: ubuntu-24.04
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
actions: write
|
||||||
|
contents: read
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Decide whether to rerun (only if matrix jobs failed)
|
||||||
|
env:
|
||||||
|
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
REPO: ${{ github.repository }}
|
||||||
|
RUN_ID: ${{ github.event.workflow_run.id }}
|
||||||
|
run: |
|
||||||
|
echo "Inspecting jobs of workflow run $RUN_ID in $REPO"
|
||||||
|
|
||||||
|
jobs_json="$(gh api repos/$REPO/actions/runs/$RUN_ID/jobs)"
|
||||||
|
|
||||||
|
echo "Jobs and conclusions:"
|
||||||
|
echo "$jobs_json" | jq '.jobs[] | {name: .name, conclusion: .conclusion}'
|
||||||
|
|
||||||
|
failed_matrix_jobs=$(echo "$jobs_json" | jq -r '
|
||||||
|
[ .jobs[]
|
||||||
|
| select(.conclusion == "failure"
|
||||||
|
and (.name | contains(" API-")))
|
||||||
|
]
|
||||||
|
| length // 0
|
||||||
|
')
|
||||||
|
failed_matrix_jobs=${failed_matrix_jobs:-0}
|
||||||
|
|
||||||
|
if [ "${failed_matrix_jobs}" -gt 0 ]; then
|
||||||
|
echo "Detected failing Integration Tests jobs – re-running failed jobs for this run."
|
||||||
|
gh run rerun -R "$REPO" "$RUN_ID" --failed
|
||||||
|
else
|
||||||
|
echo "Only non-matrix jobs (like Test Results) failed – not auto-rerunning."
|
||||||
|
fi
|
||||||
84
.github/workflows/trailing-whitespace-check.yml
vendored
Normal file
84
.github/workflows/trailing-whitespace-check.yml
vendored
Normal file
@@ -0,0 +1,84 @@
|
|||||||
|
name: Whitespace Check
|
||||||
|
|
||||||
|
on:
|
||||||
|
workflow_call:
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
check-whitespace:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout code
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
|
||||||
|
- name: Check for trailing whitespace
|
||||||
|
run: |
|
||||||
|
echo "Checking for trailing whitespace in changed files..."
|
||||||
|
|
||||||
|
# Get the base branch
|
||||||
|
BASE_SHA="${{ github.event.pull_request.base.sha }}"
|
||||||
|
HEAD_SHA="${{ github.event.pull_request.head.sha }}"
|
||||||
|
|
||||||
|
# Get list of changed files (excluding deleted files)
|
||||||
|
CHANGED_FILES=$(git diff --name-only --diff-filter=d "$BASE_SHA" "$HEAD_SHA")
|
||||||
|
|
||||||
|
if [ -z "$CHANGED_FILES" ]; then
|
||||||
|
echo "No files to check."
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
# File patterns to check (text files)
|
||||||
|
PATTERNS="\.cs$|\.csproj$|\.sln$|\.ts$|\.html$|\.css$|\.scss$"
|
||||||
|
|
||||||
|
# Directories and file patterns to exclude
|
||||||
|
EXCLUDE_PATTERNS="(^|\/)(\.|node_modules|bin|obj|artifacts|packages|\.vs|\.nuke\/temp)($|\/)"
|
||||||
|
|
||||||
|
ERRORS_FOUND=0
|
||||||
|
TEMP_FILE=$(mktemp)
|
||||||
|
|
||||||
|
while IFS= read -r file; do
|
||||||
|
# Skip if file doesn't exist (shouldn't happen with --diff-filter=d, but just in case)
|
||||||
|
if [ ! -f "$file" ]; then
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Check if file matches patterns to check
|
||||||
|
if ! echo "$file" | grep -qE "$PATTERNS"; then
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Check if file should be excluded
|
||||||
|
if echo "$file" | grep -qE "$EXCLUDE_PATTERNS"; then
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Find trailing whitespace lines, excluding XML doc placeholder lines that are exactly "/// " (one space)
|
||||||
|
MATCHES=$(grep -n '[[:space:]]$' "$file" | grep -vE '^[0-9]+:[[:space:]]*/// $' || true)
|
||||||
|
|
||||||
|
if [ -n "$MATCHES" ]; then
|
||||||
|
echo "❌ Trailing whitespace found in: $file"
|
||||||
|
echo "$MATCHES" | head -10
|
||||||
|
TOTAL=$(echo "$MATCHES" | wc -l)
|
||||||
|
if [ "$TOTAL" -gt 10 ]; then
|
||||||
|
echo " ... and $(($TOTAL - 10)) more lines"
|
||||||
|
fi
|
||||||
|
echo "1" >> "$TEMP_FILE"
|
||||||
|
fi
|
||||||
|
done <<< "$CHANGED_FILES"
|
||||||
|
|
||||||
|
ERRORS_FOUND=$(wc -l < "$TEMP_FILE" 2>/dev/null || echo "0")
|
||||||
|
rm -f "$TEMP_FILE"
|
||||||
|
|
||||||
|
if [ "$ERRORS_FOUND" -gt 0 ]; then
|
||||||
|
echo ""
|
||||||
|
echo "❌ Found trailing whitespace in $ERRORS_FOUND file(s)."
|
||||||
|
echo "Please remove trailing whitespace from the files listed above."
|
||||||
|
exit 1
|
||||||
|
else
|
||||||
|
echo "✅ No trailing whitespace found in changed files."
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
121
Changelog.md
121
Changelog.md
@@ -1,3 +1,124 @@
|
|||||||
|
# 0.6.0
|
||||||
|
|
||||||
|
## ElectronNET.Core
|
||||||
|
|
||||||
|
- Updated dependencies
|
||||||
|
- Updated `WebContents` zoom level APIs to use `double` instead of `int` (#956)
|
||||||
|
- Improved migration checks to honor custom output paths and to detect `ProjectGuid` in publish profiles (#946)
|
||||||
|
- Fixed single instance handling on macOS (#1040)
|
||||||
|
- Fixed slow socket bridge startup by binding to an explicit loopback address (#1103)
|
||||||
|
- Fixed socket bridge connection when a system proxy is configured (#1105)
|
||||||
|
- Fixed electron-builder using the host RID instead of the target RID (#1097)
|
||||||
|
- Fixed cross-compilation behavior on same platform (#1098) @epsnm
|
||||||
|
- Fixed resolution of unrelated target (#1099) @epsnm
|
||||||
|
- Fixed false alarm for `ELECTRON001` on a root `package-lock.json` (#946)
|
||||||
|
- Added `ElectronNET.Core.Templates` package with a `dotnet new electron-blazor` template (#414)
|
||||||
|
- Added `WebContents.OnZoomChanged` event (#956)
|
||||||
|
- Added `WebContents` page loading APIs `LoadFileAsync`, `IsLoadingAsync`, `IsLoadingMainFrameAsync`, `IsWaitingForResponseAsync`, `Reload`, `ReloadIgnoringCache` and `Stop` (#956)
|
||||||
|
- Added `WebContents.InsertCSSAsync` and `WebContents.RemoveInsertedCSSAsync` for dynamic CSS (#956)
|
||||||
|
- Added `WebContents` editing and selection APIs (undo, redo, cut, copy, paste, insert text, select, ...) (#956)
|
||||||
|
- Added `WebContents.FindInPageAsync`, `WebContents.StopFindInPage` and the `OnFoundInPage` event (#956)
|
||||||
|
- Added `WebContents` audio events `OnAudioStateChanged`, `OnMediaStartedPlaying` and `OnMediaPaused` (#956)
|
||||||
|
- Added `WebContents.ScrollToTop` and `WebContents.ScrollToBottom` (#956)
|
||||||
|
- Added target framework customization (#1095) @epsnm
|
||||||
|
- Added configurable Electron root directory for custom packaging layouts (#1106) @DYH1319
|
||||||
|
- Added ability for `custom_main.js` to modify command line switches (#1029) @AeonSake
|
||||||
|
- Added migration checks for incomplete `ElectronHostHook` folders (`ELECTRON010`, `ELECTRON011`) (#946)
|
||||||
|
- Added `ElectronExecutableName` to separate the product name from the executable name (#1003) @AeonSake
|
||||||
|
- Added build extensibility properties `ElectronSkipExecCommands` and `ElectronIntermediatePublishDir` (#1106) @DYH1319
|
||||||
|
|
||||||
|
# 0.5.2
|
||||||
|
|
||||||
|
## ElectronNET.Core
|
||||||
|
|
||||||
|
- Fixed token param being appended to external URLs (#1075)
|
||||||
|
- Fixed startup mode discriminator in case of existing `wwwroot` (#1050)
|
||||||
|
- Fixed CA1416 on ASP.NET project (#1091) @epsnm
|
||||||
|
- Fixed loading issue in plain Visual Studio (#1084) @epsnm
|
||||||
|
- Fixed bloated ASAR file (#1080) @epsnm
|
||||||
|
- Improved selection of runtime identifier (#1081) @epsnm
|
||||||
|
- Added more variants for `UseElectron` (#1076) @AeonSake
|
||||||
|
- Added support for modern MacOS app icon (#1047)
|
||||||
|
|
||||||
|
# 0.5.1
|
||||||
|
|
||||||
|
## ElectronNET.Core
|
||||||
|
|
||||||
|
- Fixed slicing of arguments for packaged applications (#1072)
|
||||||
|
- Added support for Electron 42+ (#1073)
|
||||||
|
|
||||||
|
# 0.5.0
|
||||||
|
|
||||||
|
## ElectronNET.Core
|
||||||
|
|
||||||
|
- Updated internal facade from `SocketIoFacade` to `ISocketConnection` (#1037)
|
||||||
|
- Fixed `HasShadow` is not `true` by default (#1049) @AeonSake
|
||||||
|
- Fixed missing `ReadAllLines` in MSBuild execution (#1035)
|
||||||
|
- Fixed serialization of release notes for the updater (#1041)
|
||||||
|
- Added automatic port selection and secured IPC communication (#1038)
|
||||||
|
|
||||||
|
# 0.4.1
|
||||||
|
|
||||||
|
## ElectronNET.Core
|
||||||
|
|
||||||
|
- Updated documentation for preload scripts (#1031) @AeonSake
|
||||||
|
- Updated timeout for electron-builder (#1013) @softworkz
|
||||||
|
- Updated disposal avoiding exceptions on teardown (#1026) @softworkz
|
||||||
|
- Updated migration guide (#1015) @hilin
|
||||||
|
- Fixed handling of `Center` property for windows (#1001)
|
||||||
|
- Fixed false alarm for `ELECTRON001`, `ELECTRON008`, and `ELECTRON009` (#1012) @softworkz
|
||||||
|
- Added missing methods on `Cookies` (#1000)
|
||||||
|
- Added overload for `GetAllDisplaysAsync` with timeout (#1033) @softworkz
|
||||||
|
- Added `OnBoundsChanged` event (#1014) @softworkz
|
||||||
|
- Added new events for `ipcMain` (#1019) @DYH1319
|
||||||
|
|
||||||
|
# 0.4.0
|
||||||
|
|
||||||
|
## ElectronNET.Core
|
||||||
|
|
||||||
|
- Fixed ElectronSingleInstance handling (#996) @softworkz
|
||||||
|
- Fixed `PackageId` handling (#993) @softworkz
|
||||||
|
- Added cross-platform npm restore and check mismatch on publish (#988) @softworkz
|
||||||
|
|
||||||
|
# 0.3.1
|
||||||
|
|
||||||
|
## ElectronNET.Core
|
||||||
|
|
||||||
|
- Fixed issue transforming the project ID (#989, #990) @softworkz
|
||||||
|
|
||||||
|
# 0.3.0
|
||||||
|
|
||||||
|
## ElectronNET.Core
|
||||||
|
|
||||||
|
- Updated infrastructure (#937, #939) @softworkz
|
||||||
|
- Updated all model classes to Electron API 39.2 (#949) @softworkz
|
||||||
|
- Fixed output path for `electron-builder` (#942) @softworkz
|
||||||
|
- Fixed floating point display resolution (#944) @softworkz
|
||||||
|
- Fixed error in case of missing electron-host-hook (#978)
|
||||||
|
- Fixed previous API break using exposed `JsonElement` objects (#938) @softworkz
|
||||||
|
- Fixed and improved several test cases (#962) @softworkz
|
||||||
|
- Fixed startup of Electron.NET from VS Code Debug Adapter (#952)
|
||||||
|
- Fixed the `BrowserWindowOptions` (#945) @softworkz
|
||||||
|
- Fixed example for `AutoMenuHide` to reflect platform capabilities (#982) @markatosi
|
||||||
|
- Added several migration checks for publishing (#966) @softworkz
|
||||||
|
- Added more test runners for E2E tests (#950, #951) @agracio
|
||||||
|
- Added dynamic updates for tray menu (#973) @davidroth
|
||||||
|
- Added matrix tests with 6 runners and 2 electron version (#948) @softworkz
|
||||||
|
- Added additional APIs for WebContents (#958) @agracio
|
||||||
|
- Added documentation for MacOS package publish (#983) @markatosi
|
||||||
|
- Added sample application for `ElectronHostHook` (#967) @adityashirsatrao007
|
||||||
|
|
||||||
|
# 0.2.0
|
||||||
|
|
||||||
|
## ElectronNET.Core
|
||||||
|
|
||||||
|
- Updated dependencies (#930) @softworkz
|
||||||
|
- Updated integration tests (#931) @softworkz
|
||||||
|
- Updated `ElectronNET.Host` (#935) @softworkz
|
||||||
|
- Removed transition period specific build configuration (#928) @softworkz
|
||||||
|
- Added `IsRunningBlazor` option to `BrowserWindowOptions` (#926)
|
||||||
|
- Added platform support attributes (#929) @softworkz
|
||||||
|
|
||||||
# 0.1.0
|
# 0.1.0
|
||||||
|
|
||||||
## ElectronNET.Core
|
## ElectronNET.Core
|
||||||
|
|||||||
15
Directory.Build.props
Normal file
15
Directory.Build.props
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
|
||||||
|
<!-- This file prevents unintended imports of unrelated MSBuild files -->
|
||||||
|
<!-- Uncomment to include parent Directory.Build.props file -->
|
||||||
|
<!--<Import Project="$([MSBuild]::GetPathOfFileAbove('Directory.Build.props', '$(MSBuildThisFileDirectory)../'))" />-->
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<ElectronNetBuildProps>$([MSBuild]::GetPathOfFileAbove('ElectronNet.Build.props', '$(MSBuildThisFileDirectory)../'))</ElectronNetBuildProps>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<!-- Only import specific project related MSBuild file -->
|
||||||
|
<Import Project="$(ElectronNetBuildProps)" Condition=" '$(ElectronNetBuildProps)' != '' " />
|
||||||
|
|
||||||
|
</Project>
|
||||||
@@ -2,7 +2,7 @@
|
|||||||
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
|
||||||
<!-- This file prevents unintended imports of unrelated MSBuild files -->
|
<!-- This file prevents unintended imports of unrelated MSBuild files -->
|
||||||
<!-- Uncomment to include parent Directory.Build.props file -->
|
<!-- Uncomment to include parent Directory.Packages.props file -->
|
||||||
<!--<Import Project="$([MSBuild]::GetPathOfFileAbove('Directory.Build.props', '$(MSBuildThisFileDirectory)../'))" />-->
|
<!--<Import Project="$([MSBuild]::GetPathOfFileAbove('Directory.Packages.props', '$(MSBuildThisFileDirectory)../'))" />-->
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
92
README.md
92
README.md
@@ -14,22 +14,23 @@ Build cross platform desktop applications with .NET 6/8/10 - from console apps t
|
|||||||
|
|
||||||
## Wait - how does that work exactly?
|
## Wait - how does that work exactly?
|
||||||
|
|
||||||
Well... there are lots of different approaches how to get a X-plat desktop app running. Electron.NET provides a range of ways to build .NET based solutions using Electron at the side of presentation.
|
Well... there are lots of different approaches how to get a X-plat desktop app running. Electron.NET provides a range of ways to build .NET-based solutions using Electron at the side of presentation.
|
||||||
|
|
||||||
While the classic Electron.NET setup, using an ASP.NET host ran by the Electron side is still the primary way, there's more flexibility now: both, dotnet and Electron are now able to launch the other for better lifetime management, and when you don't need a local web server - like when running content from files or remote servers, you can drop the ASP.NET stack altogether and got with a lightweight console app instead.
|
While the classic Electron.NET setup (using an ASP.NET host run by the Electron side) is still the primary way, there's more flexibility now. Both .NET and Electron are now able to launch the other for better lifetime management, and when you don't need a local web server (like when running content from files or remote servers), you can drop the ASP.NET stack altogether and go with a lightweight console app instead.
|
||||||
|
|
||||||
## 📦 NuGet
|
## 📦 NuGet
|
||||||
|
|
||||||
* ElectronNET.Core: [](https://www.nuget.org/packages/ElectronNET.Core.API/)
|
* ElectronNET.Core: [](https://www.nuget.org/packages/ElectronNET.Core.API/)
|
||||||
* ElectronNET.Core.API: [](https://www.nuget.org/packages/ElectronNET.Core.API/)
|
* ElectronNET.Core.API: [](https://www.nuget.org/packages/ElectronNET.Core.API/)
|
||||||
* ElectronNET.Core.AspNet: [](https://www.nuget.org/packages/ElectronNET.Core.AspNet/)
|
* ElectronNET.Core.AspNet: [](https://www.nuget.org/packages/ElectronNET.Core.AspNet/)
|
||||||
|
* ElectronNET.Core.Templates: [](https://www.nuget.org/packages/ElectronNET.Core.Templates/)
|
||||||
|
|
||||||
## 🛠 Requirements to Run
|
## 🛠 Requirements to Run
|
||||||
|
|
||||||
You should have installed:
|
You should have installed:
|
||||||
|
|
||||||
* .NET 6/8 or later.
|
* .NET 8/10 or later.
|
||||||
* The minimum base OS is the same as [.NET 6](https://github.com/dotnet/core/blob/main/release-notes/6.0/supported-os.md) / [.NET 8](https://github.com/dotnet/core/blob/main/release-notes/8.0/supported-os.md).
|
* The minimum base OS is the same as [.NET 8](https://github.com/dotnet/core/blob/main/release-notes/8.0/supported-os.md) / [.NET 10](https://github.com/dotnet/core/blob/main/release-notes/10.0/supported-os.md).
|
||||||
* Node.JS using at least [Version 22.x](https://nodejs.org).
|
* Node.JS using at least [Version 22.x](https://nodejs.org).
|
||||||
|
|
||||||
## 👩🏫 Usage with ASP.NET
|
## 👩🏫 Usage with ASP.NET
|
||||||
@@ -58,22 +59,22 @@ To do so, use the `UseElectron` extension method on a `WebApplicationBuilder`, a
|
|||||||
using ElectronNET.API;
|
using ElectronNET.API;
|
||||||
using ElectronNET.API.Entities;
|
using ElectronNET.API.Entities;
|
||||||
|
|
||||||
public static void Main(string[] args)
|
public static void Main(string[] args)
|
||||||
{
|
{
|
||||||
WebHost.CreateDefaultBuilder(args)
|
WebHost.CreateDefaultBuilder(args)
|
||||||
.UseElectron(args, ElectronAppReady)
|
.UseElectron(args, ElectronAppReady)
|
||||||
.UseStartup<Startup>()
|
.UseStartup<Startup>()
|
||||||
.Build()
|
.Build()
|
||||||
.Run();
|
.Run();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static async Task ElectronAppReady()
|
public static async Task ElectronAppReady()
|
||||||
{
|
{
|
||||||
var browserWindow = await Electron.WindowManager.CreateWindowAsync(
|
var browserWindow = await Electron.WindowManager.CreateWindowAsync(
|
||||||
new BrowserWindowOptions { Show = false });
|
new BrowserWindowOptions { Show = false });
|
||||||
|
|
||||||
browserWindow.OnReadyToShow += () => browserWindow.Show();
|
browserWindow.OnReadyToShow += () => browserWindow.Show();
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
### Minimal API Example
|
### Minimal API Example
|
||||||
@@ -113,13 +114,64 @@ app.MapRazorPages();
|
|||||||
app.Run();
|
app.Run();
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### Blazor
|
||||||
|
|
||||||
|
For a project with Blazor you can use:
|
||||||
|
|
||||||
|
```cs
|
||||||
|
using ElectronNET.API;
|
||||||
|
using ElectronNET.API.Entities;
|
||||||
|
|
||||||
|
var builder = WebApplication.CreateBuilder(args);
|
||||||
|
|
||||||
|
builder.Services
|
||||||
|
.AddRazorComponents()
|
||||||
|
.AddInteractiveWebAssemblyComponents();
|
||||||
|
|
||||||
|
builder.Services.AddElectron(); // <-- might be useful to set up DI
|
||||||
|
|
||||||
|
builder.UseElectron(args, async () =>
|
||||||
|
{
|
||||||
|
var options = new BrowserWindowOptions {
|
||||||
|
Show = false,
|
||||||
|
IsRunningBlazor = true, // <-- crucial
|
||||||
|
};
|
||||||
|
if (OperatingSystem.IsWindows() || OperatingSystem.IsLinux())
|
||||||
|
options.AutoHideMenuBar = true;
|
||||||
|
var browserWindow = await Electron.WindowManager.CreateWindowAsync(options);
|
||||||
|
browserWindow.OnReadyToShow += () => browserWindow.Show();
|
||||||
|
});
|
||||||
|
|
||||||
|
var app = builder.Build();
|
||||||
|
|
||||||
|
// Configure the HTTP request pipeline.
|
||||||
|
if (app.Environment.IsDevelopment())
|
||||||
|
{
|
||||||
|
app.UseWebAssemblyDebugging();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
app.UseExceptionHandler("/Error", createScopeForErrors: true);
|
||||||
|
}
|
||||||
|
|
||||||
|
app.UseStaticFiles();
|
||||||
|
app.UseAntiforgery();
|
||||||
|
|
||||||
|
app.MapRazorComponents<BlazorApp.Components.App>()
|
||||||
|
.AddInteractiveWebAssemblyRenderMode();
|
||||||
|
|
||||||
|
app.Run();
|
||||||
|
```
|
||||||
|
|
||||||
|
The `IsRunningBlazor` option makes sure to set up the renderer in a way that Blazor can just run without any interference. This includes things such as HMR for development.
|
||||||
|
|
||||||
## 🚀 Starting and Debugging the Application
|
## 🚀 Starting and Debugging the Application
|
||||||
|
|
||||||
Just press `F5` in Visual Studio or use dotnet for debugging.
|
Just press `F5` in Visual Studio or use dotnet for debugging.
|
||||||
|
|
||||||
## 📔 Usage of the Electron API
|
## 📔 Usage of the Electron API
|
||||||
|
|
||||||
A complete documentation is available on the Wiki.
|
Complete documentation is available on the Wiki.
|
||||||
|
|
||||||
In this YouTube video, we show you how you can create a new project, use the Electron.NET API, debug a application and build an executable desktop app for Windows: [Electron.NET - Getting Started](https://www.youtube.com/watch?v=nuM6AojRFHk)
|
In this YouTube video, we show you how you can create a new project, use the Electron.NET API, debug a application and build an executable desktop app for Windows: [Electron.NET - Getting Started](https://www.youtube.com/watch?v=nuM6AojRFHk)
|
||||||
|
|
||||||
@@ -151,6 +203,8 @@ Alternatively, consider using a GitHub sponsorship for the core maintainers:
|
|||||||
- [Gregor Biswanger](https://github.com/sponsors/GregorBiswanger)
|
- [Gregor Biswanger](https://github.com/sponsors/GregorBiswanger)
|
||||||
- [Florian Rappl](https://github.com/sponsors/FlorianRappl)
|
- [Florian Rappl](https://github.com/sponsors/FlorianRappl)
|
||||||
|
|
||||||
|
Or just [buy Florian a coffee](https://buymeacoffee.com/florianrappl) :coffee:.
|
||||||
|
|
||||||
Any support appreciated! 🍻
|
Any support appreciated! 🍻
|
||||||
|
|
||||||
## 🎉 License
|
## 🎉 License
|
||||||
|
|||||||
@@ -58,6 +58,23 @@ Works for both BrowserWindows and BrowserViews.
|
|||||||
- `isBrowserWindow` - Whether the webContents belong to a BrowserWindow or not (the other option is a BrowserView)
|
- `isBrowserWindow` - Whether the webContents belong to a BrowserWindow or not (the other option is a BrowserView)
|
||||||
- `path` - Absolute path to the CSS file location
|
- `path` - Absolute path to the CSS file location
|
||||||
|
|
||||||
|
#### 🧊 `Task<string> InsertCSSAsync(string css, string cssOrigin = null)`
|
||||||
|
Injects CSS into the current web page and returns a unique key for the inserted style sheet.
|
||||||
|
|
||||||
|
**Parameters:**
|
||||||
|
- `css` - The style sheet to inject
|
||||||
|
- `cssOrigin` - Can be either `user` or `author`, defaults to `author`
|
||||||
|
|
||||||
|
**Returns:**
|
||||||
|
|
||||||
|
The key of the inserted style sheet, to be used with `RemoveInsertedCSSAsync`.
|
||||||
|
|
||||||
|
#### 🧊 `Task RemoveInsertedCSSAsync(string key)`
|
||||||
|
Removes a previously inserted style sheet from the current web page.
|
||||||
|
|
||||||
|
**Parameters:**
|
||||||
|
- `key` - The key returned by `InsertCSSAsync`
|
||||||
|
|
||||||
#### 🧊 `Task LoadURLAsync(string url)`
|
#### 🧊 `Task LoadURLAsync(string url)`
|
||||||
Loads the url in the window. The url must contain the protocol prefix.
|
Loads the url in the window. The url must contain the protocol prefix.
|
||||||
|
|
||||||
@@ -113,6 +130,106 @@ Prints window's web page as PDF with Chromium's preview printing custom settings
|
|||||||
|
|
||||||
Whether the PDF generation succeeded.
|
Whether the PDF generation succeeded.
|
||||||
|
|
||||||
|
#### 🧊 `Task<double> GetZoomFactorAsync()`
|
||||||
|
Returns the current zoom factor. A factor of `1.0` means 100%.
|
||||||
|
|
||||||
|
#### 🧊 `void SetZoomFactor(double factor)`
|
||||||
|
Changes the zoom factor to the specified factor. The zoom factor is the zoom percent divided by 100, so 300% = `3.0`. The factor must be greater than `0.0`.
|
||||||
|
|
||||||
|
**Parameters:**
|
||||||
|
- `factor` - The zoom factor
|
||||||
|
|
||||||
|
#### 🧊 `Task<double> GetZoomLevelAsync()`
|
||||||
|
Returns the current zoom level.
|
||||||
|
|
||||||
|
#### 🧊 `void SetZoomLevel(double level)`
|
||||||
|
Changes the zoom level to the specified level. The original size is `0` and each increment above or below represents zooming 20% larger or smaller to default limits of 300% and 50% of the original size, respectively.
|
||||||
|
|
||||||
|
**Parameters:**
|
||||||
|
- `level` - The zoom level
|
||||||
|
|
||||||
|
#### 🧊 `Task SetVisualZoomLevelLimitsAsync(double minimumLevel, double maximumLevel)`
|
||||||
|
Sets the maximum and minimum pinch-to-zoom level.
|
||||||
|
|
||||||
|
**Parameters:**
|
||||||
|
- `minimumLevel` - The minimum pinch-to-zoom level
|
||||||
|
- `maximumLevel` - The maximum pinch-to-zoom level
|
||||||
|
|
||||||
|
#### 🧊 `Task LoadFileAsync(string filePath, LoadFileOptions options = null)`
|
||||||
|
Loads the given HTML file, relative to the root of the application.
|
||||||
|
|
||||||
|
**Parameters:**
|
||||||
|
- `filePath` - Path to the HTML file
|
||||||
|
- `options` - Optional `Query`, `Search` and `Hash` parts of the resulting URL
|
||||||
|
|
||||||
|
#### 🧊 `void SetAudioMuted(bool muted)`
|
||||||
|
Mutes or unmutes the audio on the current web page.
|
||||||
|
|
||||||
|
#### 🧊 `Task<bool> IsAudioMutedAsync()`
|
||||||
|
Whether this page has been muted.
|
||||||
|
|
||||||
|
#### 🧊 `Task<bool> IsCurrentlyAudibleAsync()`
|
||||||
|
Whether audio is currently playing.
|
||||||
|
|
||||||
|
#### 🧊 `Task<string> GetUserAgentAsync()` / `void SetUserAgent(string userAgent)`
|
||||||
|
Gets or overrides the user agent for this web page.
|
||||||
|
|
||||||
|
#### 🧊 `Task<bool> IsLoadingAsync()`
|
||||||
|
Whether the web page is still loading resources.
|
||||||
|
|
||||||
|
#### 🧊 `Task<bool> IsLoadingMainFrameAsync()`
|
||||||
|
Whether the main frame (and not just iframes or frames within it) is still loading.
|
||||||
|
|
||||||
|
#### 🧊 `Task<bool> IsWaitingForResponseAsync()`
|
||||||
|
Whether the web page is waiting for a first response from the main resource of the page.
|
||||||
|
|
||||||
|
#### 🧊 `void Reload()`
|
||||||
|
Reloads the current web page.
|
||||||
|
|
||||||
|
#### 🧊 `void ReloadIgnoringCache()`
|
||||||
|
Reloads the current web page and ignores the cache.
|
||||||
|
|
||||||
|
#### 🧊 `void Stop()`
|
||||||
|
Stops any pending navigation.
|
||||||
|
|
||||||
|
#### 🧊 `void Undo()` / `void Redo()`
|
||||||
|
Executes the `undo` / `redo` editing command in the web page.
|
||||||
|
|
||||||
|
#### 🧊 `void Cut()` / `void Copy()` / `void Paste()` / `void PasteAndMatchStyle()` / `void Delete()`
|
||||||
|
Executes the corresponding editing command in the web page.
|
||||||
|
|
||||||
|
#### 🧊 `void CopyImageAt(int x, int y)`
|
||||||
|
Copies the image at the given position to the clipboard.
|
||||||
|
|
||||||
|
#### 🧊 `void SelectAll()` / `void Unselect()` / `void CenterSelection()`
|
||||||
|
Selects all content, clears the selection, or scrolls to the current selection.
|
||||||
|
|
||||||
|
#### 🧊 `void ScrollToTop()` / `void ScrollToBottom()`
|
||||||
|
Scrolls to the top or the bottom of the current web page.
|
||||||
|
|
||||||
|
#### 🧊 `void AdjustSelection(AdjustSelectionOptions options)`
|
||||||
|
Adjusts the start and end points of the current text selection by the given amounts. Negative amounts move towards the beginning of the document.
|
||||||
|
|
||||||
|
#### 🧊 `Task InsertTextAsync(string text)`
|
||||||
|
Inserts text into the focused element.
|
||||||
|
|
||||||
|
#### 🧊 `void Replace(string text)` / `void ReplaceMisspelling(string text)`
|
||||||
|
Replaces the current selection, or the currently misspelled word, with the given text.
|
||||||
|
|
||||||
|
#### 🧊 `Task<int> FindInPageAsync(string text, FindInPageOptions options = null)`
|
||||||
|
Starts a request to find all matches for the text in the web page. Results are reported via the `OnFoundInPage` event.
|
||||||
|
|
||||||
|
**Parameters:**
|
||||||
|
- `text` - Content to be searched, must not be empty
|
||||||
|
- `options` - Optional `Forward`, `FindNext` and `MatchCase` flags
|
||||||
|
|
||||||
|
**Returns:**
|
||||||
|
|
||||||
|
The request id of the find request.
|
||||||
|
|
||||||
|
#### 🧊 `void StopFindInPage(StopFindInPageAction action)`
|
||||||
|
Stops any `FindInPageAsync` request with the given action (`ClearSelection`, `KeepSelection` or `ActivateSelection`).
|
||||||
|
|
||||||
## Events
|
## Events
|
||||||
|
|
||||||
#### ⚡ `InputEvent`
|
#### ⚡ `InputEvent`
|
||||||
@@ -142,6 +259,21 @@ Emitted when the document in the top-level frame is loaded.
|
|||||||
#### ⚡ `OnWillRedirect`
|
#### ⚡ `OnWillRedirect`
|
||||||
Emitted when a server side redirect occurs during navigation.
|
Emitted when a server side redirect occurs during navigation.
|
||||||
|
|
||||||
|
#### ⚡ `OnZoomChanged`
|
||||||
|
Emitted when the user changes the zoom level using the mouse wheel or the keyboard. The handler receives the `ZoomDirection` (`In` or `Out`).
|
||||||
|
|
||||||
|
#### ⚡ `OnFoundInPage`
|
||||||
|
Emitted when a result is available for a `FindInPageAsync` request. The handler receives a `FoundInPageResult`.
|
||||||
|
|
||||||
|
#### ⚡ `OnAudioStateChanged`
|
||||||
|
Emitted when media becomes audible or inaudible. The handler receives `true` if one or more frames or child web contents are emitting audio.
|
||||||
|
|
||||||
|
#### ⚡ `OnMediaStartedPlaying`
|
||||||
|
Emitted when media starts playing.
|
||||||
|
|
||||||
|
#### ⚡ `OnMediaPaused`
|
||||||
|
Emitted when media is paused or done playing.
|
||||||
|
|
||||||
## Usage Examples
|
## Usage Examples
|
||||||
|
|
||||||
### Page Loading
|
### Page Loading
|
||||||
@@ -279,6 +411,82 @@ webContents.OnCrashed += (killed) =>
|
|||||||
};
|
};
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### Zoom Control
|
||||||
|
|
||||||
|
```csharp
|
||||||
|
// Set the zoom to 150%
|
||||||
|
webContents.SetZoomFactor(1.5);
|
||||||
|
|
||||||
|
var factor = await webContents.GetZoomFactorAsync();
|
||||||
|
Console.WriteLine($"Current zoom: {factor * 100}%");
|
||||||
|
|
||||||
|
// Zoom levels are relative: each step is 20% larger/smaller, 0 is the original size
|
||||||
|
webContents.SetZoomLevel(2);
|
||||||
|
|
||||||
|
// Restrict pinch-to-zoom
|
||||||
|
await webContents.SetVisualZoomLevelLimitsAsync(1, 3);
|
||||||
|
|
||||||
|
// React to zoom changes triggered by the user
|
||||||
|
webContents.OnZoomChanged += (direction) =>
|
||||||
|
{
|
||||||
|
Console.WriteLine($"User zoomed {direction}");
|
||||||
|
};
|
||||||
|
```
|
||||||
|
|
||||||
|
> **Note:** The zoom factor is shared by all windows using the same session partition. Assign a unique `WebPreferences.Partition` per window if each window should keep its own zoom.
|
||||||
|
|
||||||
|
### Dynamic CSS
|
||||||
|
|
||||||
|
```csharp
|
||||||
|
var key = await webContents.InsertCSSAsync("body { background-color: #202020; }");
|
||||||
|
|
||||||
|
// ... later
|
||||||
|
await webContents.RemoveInsertedCSSAsync(key);
|
||||||
|
```
|
||||||
|
|
||||||
|
### Editing and Selection
|
||||||
|
|
||||||
|
```csharp
|
||||||
|
await webContents.InsertTextAsync("Hello from .NET");
|
||||||
|
|
||||||
|
webContents.SelectAll();
|
||||||
|
webContents.Copy();
|
||||||
|
webContents.Unselect();
|
||||||
|
```
|
||||||
|
|
||||||
|
### Find in Page
|
||||||
|
|
||||||
|
```csharp
|
||||||
|
webContents.OnFoundInPage += (result) =>
|
||||||
|
{
|
||||||
|
Console.WriteLine($"{result.ActiveMatchOrdinal}/{result.Matches} matches");
|
||||||
|
|
||||||
|
if (result.FinalUpdate)
|
||||||
|
{
|
||||||
|
webContents.StopFindInPage(StopFindInPageAction.ClearSelection);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
var requestId = await webContents.FindInPageAsync("electron", new FindInPageOptions { MatchCase = false });
|
||||||
|
```
|
||||||
|
|
||||||
|
### Audio
|
||||||
|
|
||||||
|
```csharp
|
||||||
|
webContents.SetAudioMuted(true);
|
||||||
|
|
||||||
|
var muted = await webContents.IsAudioMutedAsync();
|
||||||
|
var audible = await webContents.IsCurrentlyAudibleAsync();
|
||||||
|
|
||||||
|
webContents.OnAudioStateChanged += (isAudible) =>
|
||||||
|
{
|
||||||
|
Console.WriteLine(isAudible ? "Page started emitting audio" : "Page went silent");
|
||||||
|
};
|
||||||
|
|
||||||
|
webContents.OnMediaStartedPlaying += () => Console.WriteLine("Media playing");
|
||||||
|
webContents.OnMediaPaused += () => Console.WriteLine("Media paused");
|
||||||
|
```
|
||||||
|
|
||||||
## Related APIs
|
## Related APIs
|
||||||
|
|
||||||
- [Electron.WindowManager](WindowManager.md) - Windows containing web contents
|
- [Electron.WindowManager](WindowManager.md) - Windows containing web contents
|
||||||
|
|||||||
309
docs/Core/Migration-Checks.md
Normal file
309
docs/Core/Migration-Checks.md
Normal file
@@ -0,0 +1,309 @@
|
|||||||
|
# Migration Checks
|
||||||
|
|
||||||
|
Electron.NET includes automatic build-time validation checks that help users migrating from previous versions avoid common configuration issues. These checks run automatically during the build process and provide helpful guidance when problems are detected.
|
||||||
|
|
||||||
|
## Overview
|
||||||
|
|
||||||
|
When you build an Electron.NET project, the following validation checks are performed:
|
||||||
|
|
||||||
|
| Code | Check | Description |
|
||||||
|
|------|-------|-------------|
|
||||||
|
| [ELECTRON001](#1-packagejson-rules) | package.json location rules | Ensures `package.json`/`package-lock.json` aren’t present in unsupported locations (root `package.json` handled separately) |
|
||||||
|
| [ELECTRON008](#1-packagejson-rules) | root package.json contains electron | Warns when root `package.json` contains the word `electron` (case-insensitive) |
|
||||||
|
| [ELECTRON009](#1-packagejson-rules) | root package.json copied to output | Warns when root `package.json` is configured to be copied to output/publish |
|
||||||
|
| [ELECTRON002](#2-electron-manifestjson-not-allowed) | electron-manifest.json not allowed | Detects deprecated manifest files |
|
||||||
|
| [ELECTRON003](#3-electron-builderjson-location) | electron-builder.json location | Verifies electron-builder.json exists in Properties folder |
|
||||||
|
| [ELECTRON004](#3-electron-builderjson-location) | electron-builder.json wrong location | Warns if electron-builder.json is found in incorrect locations |
|
||||||
|
| [ELECTRON005](#4-parent-paths-not-allowed-in-electron-builderjson) | Parent paths not allowed | Checks for `..` references in config |
|
||||||
|
| [ELECTRON006](#5-publish-profile-validation) | ASP.NET publish profile mismatch | Warns when ASP.NET projects have console-style profiles |
|
||||||
|
| [ELECTRON007](#5-publish-profile-validation) | Console publish profile mismatch | Warns when console projects have ASP.NET-style profiles |
|
||||||
|
| [ELECTRON010](#6-electronhosthook-folder-validation) | ElectronHostHook without package.json | Warns when hook TypeScript files exist without a `package.json` |
|
||||||
|
| [ELECTRON011](#6-electronhosthook-folder-validation) | ElectronHostHook without tsconfig.json | Warns when hook TypeScript files exist without a `tsconfig.json` |
|
||||||
|
|
||||||
|
All checks skip the build output folders (`bin`, `obj`, `publish`, `.electron`, `node_modules`) as well as any custom output paths configured via `BaseOutputPath` / `BaseIntermediateOutputPath` (for example the .NET `artifacts` output layout).
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 1. package.json rules
|
||||||
|
|
||||||
|
**Warning Codes:** `ELECTRON001`, `ELECTRON008`, `ELECTRON009`
|
||||||
|
|
||||||
|
### What is checked
|
||||||
|
|
||||||
|
The build system scans for `package.json` and `package-lock.json` files in your project directory.
|
||||||
|
|
||||||
|
Rules:
|
||||||
|
|
||||||
|
- **ELECTRON001**: `package.json` / `package-lock.json` must not exist in the project directory or subdirectories
|
||||||
|
- Exception: `ElectronHostHook` folder is allowed
|
||||||
|
- Note: a **root** `package.json` (and its `package-lock.json`) is **excluded** from `ELECTRON001` and validated by `ELECTRON008` / `ELECTRON009`
|
||||||
|
|
||||||
|
- **ELECTRON008**: If a root `package.json` exists, it must **not** contain electron-related dependencies or configuration.
|
||||||
|
|
||||||
|
- **ELECTRON009**: If a root `package.json` exists, it must **not** be configured to be copied to output/publish (for example via `CopyToOutputDirectory` / `CopyToPublishDirectory` metadata)
|
||||||
|
|
||||||
|
### Why this matters
|
||||||
|
|
||||||
|
Electron.NET generates its Electron-related `package.json` during publishing based on MSBuild properties. A user-maintained Electron-related `package.json` can conflict with that process.
|
||||||
|
|
||||||
|
Also, ensuring the root `package.json` is not copied prevents accidentally shipping it with the published app.
|
||||||
|
|
||||||
|
### Exception
|
||||||
|
|
||||||
|
A `package.json` / `package-lock.json` file **is allowed** in the `ElectronHostHook` folder if you're using custom host hooks.
|
||||||
|
|
||||||
|
### How to fix
|
||||||
|
|
||||||
|
If you have an Electron-related `package.json` from older Electron.NET versions:
|
||||||
|
|
||||||
|
1. **Open your project's `.csproj` file**
|
||||||
|
2. **Add the required properties** to a PropertyGroup with the label `ElectronNetCommon`:
|
||||||
|
|
||||||
|
```xml
|
||||||
|
<PropertyGroup Label="ElectronNetCommon">
|
||||||
|
<ElectronPackageId>my-electron-app</ElectronPackageId>
|
||||||
|
<Title>My Electron App</Title>
|
||||||
|
<Version>1.0.0</Version>
|
||||||
|
<Description>My awesome Electron.NET application</Description>
|
||||||
|
<Company>My Company</Company>
|
||||||
|
<Copyright>Copyright © 2025</Copyright>
|
||||||
|
<ElectronVersion>30.0.9</ElectronVersion>
|
||||||
|
</PropertyGroup>
|
||||||
|
```
|
||||||
|
|
||||||
|
3. **Delete** Electron-related `package.json` / `package-lock.json` files (except those under `ElectronHostHook` if applicable)
|
||||||
|
|
||||||
|
If you keep a root `package.json` for non-Electron reasons:
|
||||||
|
|
||||||
|
- Ensure it does **not** contain electron dependencies or configuration (fixes `ELECTRON008`)
|
||||||
|
- Ensure it is **not** copied to output/publish (fixes `ELECTRON009`)
|
||||||
|
|
||||||
|
> **See also:** [Migration Guide](Migration-Guide.md) for complete migration instructions.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 2. electron-manifest.json not allowed
|
||||||
|
|
||||||
|
**Warning Code:** `ELECTRON002`
|
||||||
|
|
||||||
|
### What is checked
|
||||||
|
|
||||||
|
The build system checks for the presence of `electron.manifest.json` or `electron-manifest.json` files in your project.
|
||||||
|
|
||||||
|
### Why this matters
|
||||||
|
|
||||||
|
The `electron.manifest.json` file format is deprecated. All configuration should now be specified using:
|
||||||
|
- MSBuild properties in your `.csproj` file (for application metadata)
|
||||||
|
- The `electron-builder.json` file in the `Properties` folder (for build configuration)
|
||||||
|
|
||||||
|
### How to fix
|
||||||
|
|
||||||
|
1. **Migrate application properties** to your `.csproj` file (see [Migration Guide](Migration-Guide.md))
|
||||||
|
2. **Move the `build` section** from `electron.manifest.json` to `Properties/electron-builder.json`
|
||||||
|
3. **Delete the old `electron.manifest.json`** file
|
||||||
|
|
||||||
|
**Example electron-builder.json:**
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"compression": "maximum",
|
||||||
|
"win": {
|
||||||
|
"icon": "Assets/app.ico",
|
||||||
|
"target": ["nsis", "portable"]
|
||||||
|
},
|
||||||
|
"linux": {
|
||||||
|
"icon": "Assets/app.png",
|
||||||
|
"target": ["AppImage", "deb"]
|
||||||
|
},
|
||||||
|
"mac": {
|
||||||
|
"icon": "Assets/app.icns",
|
||||||
|
"target": ["dmg", "zip"]
|
||||||
|
},
|
||||||
|
"nsis": {
|
||||||
|
"oneClick": true,
|
||||||
|
"perMachine": false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 3. electron-builder.json Location
|
||||||
|
|
||||||
|
**Warning Codes:** `ELECTRON003`, `ELECTRON004`
|
||||||
|
|
||||||
|
### What is checked
|
||||||
|
|
||||||
|
- `ELECTRON003`: Verifies that an `electron-builder.json` file exists in the `Properties` folder
|
||||||
|
- `ELECTRON004`: Warns if `electron-builder.json` is found in incorrect locations
|
||||||
|
|
||||||
|
### Why this matters
|
||||||
|
|
||||||
|
The `electron-builder.json` file must be located in the `Properties` folder so it can be properly copied to the output directory during publishing.
|
||||||
|
|
||||||
|
### How to fix
|
||||||
|
|
||||||
|
1. **Create the Properties folder** if it doesn't exist
|
||||||
|
2. **Move or create** `electron-builder.json` in `Properties/electron-builder.json`
|
||||||
|
3. **Remove** any `electron-builder.json` files from other locations
|
||||||
|
|
||||||
|
**Expected structure:**
|
||||||
|
```
|
||||||
|
MyProject/
|
||||||
|
├── Properties/
|
||||||
|
│ ├── electron-builder.json ✅ Correct location
|
||||||
|
│ ├── launchSettings.json
|
||||||
|
│ └── PublishProfiles/
|
||||||
|
├── MyProject.csproj
|
||||||
|
└── Program.cs
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 4. Parent paths not allowed in electron-builder.json
|
||||||
|
|
||||||
|
**Warning Code:** `ELECTRON005`
|
||||||
|
|
||||||
|
### What is checked
|
||||||
|
|
||||||
|
The build system scans the `electron-builder.json` file for parent-path references (`..`).
|
||||||
|
|
||||||
|
### Why this matters
|
||||||
|
|
||||||
|
During the publish process, the `electron-builder.json` file is copied to the build output directory. Any relative paths in this file are resolved from that location, not from your project directory. Parent-path references (`../`) will not work correctly because they would point outside the published application.
|
||||||
|
|
||||||
|
### How to fix
|
||||||
|
|
||||||
|
1. **Move resource files** (icons, installers, etc.) inside your project folder structure
|
||||||
|
2. **Configure the files** to be copied to the output directory in your `.csproj`:
|
||||||
|
|
||||||
|
```xml
|
||||||
|
<ItemGroup>
|
||||||
|
<Content Include="Assets\**\*">
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</Content>
|
||||||
|
</ItemGroup>
|
||||||
|
```
|
||||||
|
|
||||||
|
3. **Update paths** in `electron-builder.json` to use relative paths without `..`:
|
||||||
|
|
||||||
|
**Before (incorrect):**
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"win": {
|
||||||
|
"icon": "../SharedAssets/app.ico"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
**After (correct):**
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"win": {
|
||||||
|
"icon": "Assets/app.ico"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 5. Publish Profile Validation
|
||||||
|
|
||||||
|
**Warning Codes:** `ELECTRON006`, `ELECTRON007`
|
||||||
|
|
||||||
|
### What is checked
|
||||||
|
|
||||||
|
The build system examines `.pubxml` files in the `Properties/PublishProfiles` folder and validates that they match the project type:
|
||||||
|
|
||||||
|
- **ELECTRON006**: For **ASP.NET projects** (using `Microsoft.NET.Sdk.Web`), checks that publish profiles include `WebPublishMethod`. This property is required for proper ASP.NET publishing.
|
||||||
|
|
||||||
|
- **ELECTRON007**: For **console/other projects** (not using the Web SDK), checks that publish profiles do NOT include the `WebPublishMethod` or `ProjectGuid` property. These ASP.NET-specific properties are incorrect for non-web applications.
|
||||||
|
|
||||||
|
### Why this matters
|
||||||
|
|
||||||
|
Electron.NET supports both ASP.NET and console application project types, each requiring different publish profile configurations:
|
||||||
|
|
||||||
|
| Project Type | SDK | Expected Properties |
|
||||||
|
|--------------|-----|---------------------|
|
||||||
|
| ASP.NET (Razor Pages, MVC, Blazor) | `Microsoft.NET.Sdk.Web` | `WebPublishMethod`, no `PublishProtocol` |
|
||||||
|
| Console Application | `Microsoft.NET.Sdk` | `PublishProtocol`, no `WebPublishMethod` |
|
||||||
|
|
||||||
|
Using the wrong publish profile type can lead to incomplete or broken builds.
|
||||||
|
|
||||||
|
### How to fix
|
||||||
|
|
||||||
|
1. **Delete existing publish profiles** from `Properties/PublishProfiles/`
|
||||||
|
2. **Create new publish profiles** using the Visual Studio Publishing Wizard:
|
||||||
|
- Right-click on the project in Solution Explorer
|
||||||
|
- Select **Publish...**
|
||||||
|
- Follow the wizard to create a **Folder** publish profile
|
||||||
|
|
||||||
|
For correct publish profile examples for both ASP.NET and Console applications, see **[Package Building](../Using/Package-Building.md#step-1-create-publish-profiles)**.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 6. ElectronHostHook Folder Validation
|
||||||
|
|
||||||
|
**Warning Codes:** `ELECTRON010`, `ELECTRON011`
|
||||||
|
|
||||||
|
### What is checked
|
||||||
|
|
||||||
|
If the project contains an `ElectronHostHook` folder with TypeScript files:
|
||||||
|
|
||||||
|
- **ELECTRON010**: The folder must contain a `package.json`
|
||||||
|
- **ELECTRON011**: The folder must contain a `tsconfig.json`
|
||||||
|
|
||||||
|
### Why this matters
|
||||||
|
|
||||||
|
Custom host hook code is only compiled and packaged when the `ElectronHostHook` folder declares its npm dependencies in a `package.json`. If that file is missing, the hook is silently dropped and the corresponding `Electron.HostHook` calls fail at runtime. The `tsconfig.json` is required so the hook sources are compiled with the expected settings.
|
||||||
|
|
||||||
|
### How to fix
|
||||||
|
|
||||||
|
Add the missing files to the `ElectronHostHook` folder:
|
||||||
|
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"name": "electron-host-hook",
|
||||||
|
"version": "1.0.0",
|
||||||
|
"main": "index.js",
|
||||||
|
"dependencies": {
|
||||||
|
"socket.io": "^4.8.1"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"typescript": "^5.9.3"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
> **See also:** [HostHook API](../API/HostHook.md)
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Disabling Migration Checks
|
||||||
|
|
||||||
|
Individual checks can be downgraded to messages by their warning code:
|
||||||
|
|
||||||
|
```xml
|
||||||
|
<PropertyGroup>
|
||||||
|
<MSBuildWarningsAsMessages>$(MSBuildWarningsAsMessages);ELECTRON005</MSBuildWarningsAsMessages>
|
||||||
|
</PropertyGroup>
|
||||||
|
```
|
||||||
|
|
||||||
|
If you need to disable all migration checks (not recommended), you can set the following property in your `.csproj` file:
|
||||||
|
|
||||||
|
```xml
|
||||||
|
<PropertyGroup>
|
||||||
|
<!-- Disable all migration checks -->
|
||||||
|
<ElectronSkipMigrationChecks>true</ElectronSkipMigrationChecks>
|
||||||
|
</PropertyGroup>
|
||||||
|
```
|
||||||
|
|
||||||
|
> ⚠️ **Warning:** Disabling migration checks may result in build or runtime errors. Only disable checks if you fully understand the implications.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## See Also
|
||||||
|
|
||||||
|
- [Migration Guide](Migration-Guide.md) - Complete step-by-step migration instructions
|
||||||
|
- [Advanced Migration Topics](Advanced-Migration-Topics.md) - Complex migration scenarios
|
||||||
|
- [Configuration](../Using/Configuration.md) - Project configuration options
|
||||||
|
- [Package Building](../Using/Package-Building.md) - Building distributable packages
|
||||||
@@ -31,7 +31,7 @@ dotnet add package ElectronNET.Core.AspNet # For ASP.NET projects
|
|||||||
### Step 2: Configure Project Settings
|
### Step 2: Configure Project Settings
|
||||||
|
|
||||||
**Auto-generated Configuration:**
|
**Auto-generated Configuration:**
|
||||||
ElectronNET.Core automatically creates `electron-builder.json` during the first build or NuGet restore. No manual configuration is needed for basic setups.
|
ElectronNET.Core automatically creates `electron-builder.json` in the `Properties` folder of your project during the first build or NuGet restore. No manual configuration is needed for basic setups.
|
||||||
|
|
||||||
**Migrate Existing Configuration:**
|
**Migrate Existing Configuration:**
|
||||||
If you have an existing `electron.manifest.json` file:
|
If you have an existing `electron.manifest.json` file:
|
||||||
@@ -48,21 +48,26 @@ You can also manually edit `electron-builder.json`:
|
|||||||
```json
|
```json
|
||||||
{
|
{
|
||||||
"linux": {
|
"linux": {
|
||||||
"target": [
|
"target": ["tar.xz"]
|
||||||
"tar.xz"
|
|
||||||
]
|
|
||||||
},
|
},
|
||||||
"win": {
|
"win": {
|
||||||
"target": [
|
"target": [
|
||||||
{
|
{
|
||||||
"target": "portable",
|
"target": "nsis",
|
||||||
"arch": "x64"
|
"arch": "x64"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
},
|
||||||
|
"nsis": {
|
||||||
|
"oneClick": true,
|
||||||
|
"perMachine": false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
**Modify Launch Settings:**
|
||||||
|
ElectronNET.Core no longer needs a separate CLI tool (electronize.exe) for launching. You should update your launch settings to use either the ASP.NET-first or Electron-first approach. See [Debugging](../Using/Debugging.md) for details.
|
||||||
|
|
||||||
## 🎯 Testing Migration
|
## 🎯 Testing Migration
|
||||||
|
|
||||||
After completing the migration steps:
|
After completing the migration steps:
|
||||||
|
|||||||
@@ -10,6 +10,11 @@ See [System Requirements](../GettingStarted/System-Requirements.md).
|
|||||||
|
|
||||||
## 🚀 Quick Start
|
## 🚀 Quick Start
|
||||||
|
|
||||||
|
> [!Tip]
|
||||||
|
> To skip the manual setup below, scaffold a ready-to-run app with the
|
||||||
|
> [project templates](Templates.md): `dotnet new install ElectronNET.Core.Templates` followed by
|
||||||
|
> `dotnet new electron-blazor -n MyDesktopApp`.
|
||||||
|
|
||||||
### 1. Create ASP.NET Core Project
|
### 1. Create ASP.NET Core Project
|
||||||
|
|
||||||
#### Visual Studio
|
#### Visual Studio
|
||||||
|
|||||||
@@ -54,7 +54,7 @@ Add the Electron.NET configuration to your `.csproj` file:
|
|||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="ElectronNET.Core" Version="0.1.0" />
|
<PackageReference Include="ElectronNET.Core" Version="0.6.0" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|||||||
88
docs/GettingStarted/Templates.md
Normal file
88
docs/GettingStarted/Templates.md
Normal file
@@ -0,0 +1,88 @@
|
|||||||
|
|
||||||
|
# Project Templates
|
||||||
|
|
||||||
|
Electron.NET ships a `dotnet new` template package so you can scaffold a ready-to-run desktop app instead of wiring up an ASP.NET project by hand.
|
||||||
|
|
||||||
|
## 🛠 System Requirements
|
||||||
|
|
||||||
|
See [System Requirements](../GettingStarted/System-Requirements.md).
|
||||||
|
|
||||||
|
## 📦 Install the Templates
|
||||||
|
|
||||||
|
```bash
|
||||||
|
dotnet new install ElectronNET.Core.Templates
|
||||||
|
```
|
||||||
|
|
||||||
|
To update to the latest version, run the same command again. To remove them:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
dotnet new uninstall ElectronNET.Core.Templates
|
||||||
|
```
|
||||||
|
|
||||||
|
## 🚀 Available Templates
|
||||||
|
|
||||||
|
| Template | Short name | Description |
|
||||||
|
|----------|------------|-------------|
|
||||||
|
| Electron.NET Blazor App | `electron-blazor` | A Blazor Server app hosted in an Electron shell |
|
||||||
|
|
||||||
|
## 🧱 Create a Blazor App
|
||||||
|
|
||||||
|
```bash
|
||||||
|
dotnet new electron-blazor -n MyDesktopApp
|
||||||
|
cd MyDesktopApp
|
||||||
|
```
|
||||||
|
|
||||||
|
Then start it in the Electron shell:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
dotnet build
|
||||||
|
dotnet run
|
||||||
|
```
|
||||||
|
|
||||||
|
### Options
|
||||||
|
|
||||||
|
| Option | Values | Default | Description |
|
||||||
|
|--------|--------|---------|-------------|
|
||||||
|
| `-f`, `--framework` | `net8.0`, `net10.0` | `net10.0` | The target framework of the generated project |
|
||||||
|
| `-e`, `--electron-version` | any Electron version | `38.2.2` | The Electron version the app is built against |
|
||||||
|
| `-p`, `--port` | port number | `8001` | The port the ASP.NET server uses during development |
|
||||||
|
| `--no-restore` | — | — | Skip the automatic `dotnet restore` |
|
||||||
|
|
||||||
|
Example:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
dotnet new electron-blazor -n MyDesktopApp -f net10.0 -e 30.4.0 -p 8123
|
||||||
|
```
|
||||||
|
|
||||||
|
## 📁 What You Get
|
||||||
|
|
||||||
|
```
|
||||||
|
MyDesktopApp/
|
||||||
|
├── Components/
|
||||||
|
│ ├── Layout/ MainLayout.razor, NavMenu.razor
|
||||||
|
│ ├── Pages/ Home.razor, Counter.razor
|
||||||
|
│ ├── App.razor
|
||||||
|
│ ├── Routes.razor
|
||||||
|
│ └── _Imports.razor
|
||||||
|
├── Properties/
|
||||||
|
│ ├── PublishProfiles/ win-x64, linux-x64 and osx-arm64 folder profiles
|
||||||
|
│ ├── electron-builder.json
|
||||||
|
│ └── launchSettings.json
|
||||||
|
├── wwwroot/app.css
|
||||||
|
├── appsettings.json
|
||||||
|
├── Program.cs
|
||||||
|
└── MyDesktopApp.csproj
|
||||||
|
```
|
||||||
|
|
||||||
|
The project already references `ElectronNET.Core` and `ElectronNET.Core.AspNet`, calls `builder.UseElectron(...)` in `Program.cs`, and passes all [Migration Checks](../Core/Migration-Checks.md) out of the box.
|
||||||
|
|
||||||
|
> [!Note]
|
||||||
|
> `ElectronNET.API` also defines a type named `App`, which collides with the Blazor root
|
||||||
|
> component. That is why the template calls `app.MapRazorComponents<MyDesktopApp.Components.App>()`
|
||||||
|
> with a fully qualified type name.
|
||||||
|
|
||||||
|
## 🚀 Next Steps
|
||||||
|
|
||||||
|
- **[Configuration](../Using/Configuration.md)** - Adjust app metadata and Electron settings
|
||||||
|
- **[Debugging](../Using/Debugging.md)** - Debug the .NET and Electron sides
|
||||||
|
- **[Package Building](../Using/Package-Building.md)** - Create distributable packages
|
||||||
@@ -25,12 +25,80 @@ These are the current default values when you don't make any changes:
|
|||||||
<ElectronSingleInstance>true</ElectronSingleInstance>
|
<ElectronSingleInstance>true</ElectronSingleInstance>
|
||||||
<ElectronSplashScreen></ElectronSplashScreen>
|
<ElectronSplashScreen></ElectronSplashScreen>
|
||||||
<ElectronIcon></ElectronIcon>
|
<ElectronIcon></ElectronIcon>
|
||||||
<PackageId>$(MSBuildProjectName.Replace(".", "-").ToLower())</PackageId>
|
<ElectronPackageId>$(MSBuildProjectName.Replace(".", "-").ToLower())</ElectronPackageId>
|
||||||
<ElectronBuilderJson>electron-builder.json</ElectronBuilderJson>
|
<ElectronBuilderJson>electron-builder.json</ElectronBuilderJson>
|
||||||
<Title>$(MSBuildProjectName)</Title>
|
<Title>$(MSBuildProjectName)</Title>
|
||||||
|
<ElectronExecutableName></ElectronExecutableName>
|
||||||
|
<ElectronRootDir>../..</ElectronRootDir>
|
||||||
|
<ElectronSkipExecCommands>false</ElectronSkipExecCommands>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### Product Name and Executable Name
|
||||||
|
|
||||||
|
`Title` is the product name of the application. It is used for the window title, the installer, the macOS app bundle and the Linux desktop entry, and it may contain spaces and other characters that are awkward in a file name.
|
||||||
|
|
||||||
|
`ElectronExecutableName` controls the name of the executable inside the package (electron-builder's `executableName`). When it is not set, it defaults to the following behavior:
|
||||||
|
|
||||||
|
| Target | Default |
|
||||||
|
| --- | --- |
|
||||||
|
| Windows | `$(Title)` |
|
||||||
|
| Linux / macOS | `$(ElectronPackageId)` |
|
||||||
|
|
||||||
|
So to ship a product called `My Great App` with a `mygreatapp` binary on every platform:
|
||||||
|
|
||||||
|
```xml
|
||||||
|
<PropertyGroup>
|
||||||
|
<Title>My Great App</Title>
|
||||||
|
<ElectronExecutableName>mygreatapp</ElectronExecutableName>
|
||||||
|
</PropertyGroup>
|
||||||
|
```
|
||||||
|
|
||||||
|
> [!NOTE]
|
||||||
|
> `ElectronExecutable` is a separate, advanced setting: it is the binary Electron.NET launches when the .NET app starts first. It defaults to `ElectronExecutableName` and only needs to be changed when the package contains a launcher stub (for example added by an electron-builder hook) that should be started instead of the Electron binary.
|
||||||
|
|
||||||
|
### Custom Packaging Layout
|
||||||
|
|
||||||
|
`ElectronRootDir` tells the .NET app where to find the Electron binary when it is started first (DotNet-First startup of a packaged app). The path is resolved relative to the directory of the .NET executable; absolute paths are used as-is.
|
||||||
|
|
||||||
|
The default `../..` matches the standard Electron-First packaging layout produced by `dotnet publish`, where the .NET app is placed in `resources/bin` of the Electron package:
|
||||||
|
|
||||||
|
```
|
||||||
|
<install-root>/
|
||||||
|
MyApp # Electron executable
|
||||||
|
resources/
|
||||||
|
bin/
|
||||||
|
MyApp # .NET executable
|
||||||
|
```
|
||||||
|
|
||||||
|
If your own packaging pipeline places the .NET executable at the package root and Electron in a subdirectory, set `ElectronRootDir` accordingly:
|
||||||
|
|
||||||
|
```xml
|
||||||
|
<ElectronRootDir>electron</ElectronRootDir>
|
||||||
|
```
|
||||||
|
|
||||||
|
```
|
||||||
|
<install-root>/
|
||||||
|
MyApp # .NET executable
|
||||||
|
electron/
|
||||||
|
MyApp # Electron executable
|
||||||
|
resources/
|
||||||
|
locales/
|
||||||
|
```
|
||||||
|
|
||||||
|
The property is also used to detect whether the app runs packaged or unpackaged, so it must point to the directory that actually contains the Electron binary.
|
||||||
|
|
||||||
|
### Build Extensibility
|
||||||
|
|
||||||
|
These properties are useful when Electron.NET is embedded into a custom build or CI pipeline:
|
||||||
|
|
||||||
|
| Property | Default | Description |
|
||||||
|
| --- | --- | --- |
|
||||||
|
| `ElectronSkipExecCommands` | `false` | Skips all `npm`/`npx` invocations of the Electron build and publish targets. Use it when the dependencies and the Electron distribution are provided by the pipeline itself (for example from a cache or an offline mirror). |
|
||||||
|
| `ElectronIntermediatePublishDir` | `$(IntermediateOutputPath)PubTmp\` | Overrides the intermediate directory the .NET app is published to before it is assembled into the Electron package. |
|
||||||
|
|
||||||
|
`ElectronPackageId` and `Title` only fall back to the project name when they are not already set, so both can be defined by a `Directory.Build.props` or passed on the command line.
|
||||||
|
|
||||||
### Relation to package.json
|
### Relation to package.json
|
||||||
|
|
||||||
ElectronNET.Core does not work with an `electron-manifest.json` file anymore.
|
ElectronNET.Core does not work with an `electron-manifest.json` file anymore.
|
||||||
@@ -38,15 +106,21 @@ Since electron builder still expects a `package.json` file to exist, ElectronNET
|
|||||||
|
|
||||||
```json
|
```json
|
||||||
{
|
{
|
||||||
"name": "$(PackageId)",
|
"name": "$(ElectronPackageId)",
|
||||||
"productName": "$(ElectronTitle)",
|
"productName": "$(ElectronTitle)",
|
||||||
"build": {
|
"build": {
|
||||||
"appId": "$(PackageId)",
|
"appId": "$(ElectronPackageId)",
|
||||||
|
"win": {
|
||||||
|
"executableName": "$(ElectronExecutableName)"
|
||||||
|
},
|
||||||
|
"mac": {
|
||||||
|
"executableName": "$(ElectronExecutableName)"
|
||||||
|
},
|
||||||
"linux": {
|
"linux": {
|
||||||
"desktop": {
|
"desktop": {
|
||||||
"entry": { "Name": "$(Title)" }
|
"entry": { "Name": "$(Title)" }
|
||||||
},
|
},
|
||||||
"executableName": "$(PackageId)"
|
"executableName": "$(ElectronExecutableName)"
|
||||||
},
|
},
|
||||||
"deb": {
|
"deb": {
|
||||||
"desktop": {
|
"desktop": {
|
||||||
@@ -70,6 +144,12 @@ Since electron builder still expects a `package.json` file to exist, ElectronNET
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### App Icon Path
|
||||||
|
|
||||||
|
The `ElectronIcon` property supports classic icon files (such as `.ico` and `.icns`) and modern macOS `.icon` app icon packages.
|
||||||
|
|
||||||
|
For `.icon`, provide the folder path (for example `Assets/MyApp.icon`). During build/publish, Electron.NET copies the full directory into the Electron output so `electron-builder.json` can reference it (for example `"mac": { "icon": "MyApp.icon" }`).
|
||||||
|
|
||||||
### Node.js Integration
|
### Node.js Integration
|
||||||
|
|
||||||
Electron.NET requires Node.js integration to be enabled for IPC to function. If you are not using the IPC functionality you can disable Node.js integration like so:
|
Electron.NET requires Node.js integration to be enabled for IPC to function. If you are not using the IPC functionality you can disable Node.js integration like so:
|
||||||
@@ -85,6 +165,26 @@ BrowserWindowOptions browserWindowOptions = new BrowserWindowOptions
|
|||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
|
### Preload Script
|
||||||
|
|
||||||
|
If you require the use of a [preload script](https://www.electronjs.org/docs/latest/tutorial/tutorial-preload), you can specify the file path of the script when creating a new window like so:
|
||||||
|
|
||||||
|
```csharp
|
||||||
|
WebPreferences wp = new WebPreferences();
|
||||||
|
wp.Preload = "path/to/preload.js";
|
||||||
|
BrowserWindowOptions browserWindowOptions = new BrowserWindowOptions
|
||||||
|
{
|
||||||
|
WebPreferences = wp
|
||||||
|
};
|
||||||
|
```
|
||||||
|
|
||||||
|
> [!IMPORTANT]
|
||||||
|
> When using a preload script _AND_ running a Blazor app, `IsRunningBlazor` must be set to `false` (or removed) and the following lines must be added to the preload script:
|
||||||
|
> ```js
|
||||||
|
> global.process = undefined;
|
||||||
|
> global.module = undefined;
|
||||||
|
> ```
|
||||||
|
|
||||||
|
|
||||||
## 🚀 Next Steps
|
## 🚀 Next Steps
|
||||||
|
|
||||||
|
|||||||
94
docs/Using/Custom_main.md
Normal file
94
docs/Using/Custom_main.md
Normal file
@@ -0,0 +1,94 @@
|
|||||||
|
# Using custom_main.js
|
||||||
|
|
||||||
|
This guide explains how to include and use a `custom_main.js` file in your Electron.NET application for advanced Electron/Node.js customization.
|
||||||
|
|
||||||
|
## Why use custom_main.js?
|
||||||
|
|
||||||
|
- Register custom protocol handlers (e.g., `myapp://`) — protocols must be registered before the app is fully initialized
|
||||||
|
- Integrate Node.js modules (e.g., telemetry, OS APIs)
|
||||||
|
- Control startup logic (abort, environment checks)
|
||||||
|
- Modify Chromium / Electron.NET command line switches before they are evaluated
|
||||||
|
- Set up IPC messaging or preload scripts
|
||||||
|
|
||||||
|
## Step-by-Step Process
|
||||||
|
|
||||||
|
### 1. Create the custom_main.js file
|
||||||
|
|
||||||
|
Place your custom logic in `electron/custom_main.js`:
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
module.exports.onStartup = function(host) {
|
||||||
|
// Example: Register a global shortcut for opening dev tools
|
||||||
|
const { app, globalShortcut, BrowserWindow } = require('electron');
|
||||||
|
app.on('ready', () => {
|
||||||
|
const ret = globalShortcut.register('Control+Shift+I', () => {
|
||||||
|
BrowserWindow.getAllWindows().forEach(win => win.webContents.openDevTools());
|
||||||
|
console.log('Ctrl+Shift+I is pressed: DevTools opened!');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
app.on('will-quit', () => {
|
||||||
|
globalShortcut.unregisterAll();
|
||||||
|
});
|
||||||
|
return true;
|
||||||
|
};
|
||||||
|
```
|
||||||
|
|
||||||
|
### 2. Configure your .csproj to copy custom_main.js to output
|
||||||
|
|
||||||
|
Add this to your `.csproj` file:
|
||||||
|
|
||||||
|
```xml
|
||||||
|
<ItemGroup>
|
||||||
|
<None Update="electron\custom_main.js">
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
<TargetPath>.electron\custom_main.js</TargetPath>
|
||||||
|
</None>
|
||||||
|
</ItemGroup>
|
||||||
|
```
|
||||||
|
|
||||||
|
### 3. Build and run your app
|
||||||
|
|
||||||
|
Use the standard build/run commands:
|
||||||
|
|
||||||
|
```powershell
|
||||||
|
dotnet build
|
||||||
|
dotnet run
|
||||||
|
```
|
||||||
|
|
||||||
|
Electron.NET will automatically load and execute your `custom_main.js` before initializing the .NET backend.
|
||||||
|
|
||||||
|
## Advanced Usage
|
||||||
|
|
||||||
|
Use environment variables to control features:
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
const env = process.env.ASPNETCORE_ENVIRONMENT || 'Production';
|
||||||
|
if (env === 'Development') { /* enable dev features */ }
|
||||||
|
```
|
||||||
|
|
||||||
|
### Modifying Command Line Switches
|
||||||
|
|
||||||
|
`onStartup` is invoked before Electron.NET reads any of its own switches (`manifest`, `unpackedelectron`, `unpackeddotnet`, `dotnetpacked`, `electronforcedport`, `electronurl`), so the hook can append or override them:
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
module.exports.onStartup = function (host) {
|
||||||
|
const { app } = require('electron');
|
||||||
|
|
||||||
|
// Force a fixed socket bridge port
|
||||||
|
app.commandLine.appendSwitch('electronforcedport', '8000');
|
||||||
|
|
||||||
|
// Chromium switches, e.g. to disable the GPU sandbox
|
||||||
|
app.commandLine.appendSwitch('disable-gpu-sandbox');
|
||||||
|
|
||||||
|
return true;
|
||||||
|
};
|
||||||
|
```
|
||||||
|
|
||||||
|
## Notes
|
||||||
|
|
||||||
|
- `custom_main.js` must use CommonJS syntax (`module.exports.onStartup = ...`).
|
||||||
|
- Place the file in your source directory and copy it to `.electron` using `.csproj`.
|
||||||
|
- Electron.NET will abort startup if `onStartup` returns `false`.
|
||||||
|
- `onStartup` runs before the Electron.NET command line switches are evaluated, so switches set there are picked up by the host.
|
||||||
|
|
||||||
|
### Complete example is available here [ElectronNetSampleApp](https://github.com/niteshsinghal85/ElectronNetSampleApp)
|
||||||
@@ -26,12 +26,15 @@ Add publish profiles to `Properties/PublishProfiles/`:
|
|||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<Configuration>Release</Configuration>
|
<Configuration>Release</Configuration>
|
||||||
<Platform>Any CPU</Platform>
|
<Platform>Any CPU</Platform>
|
||||||
<PublishDir>publish\$(Configuration)\$(TargetFramework)\$(RuntimeIdentifier)\</PublishDir>
|
<DeleteExistingFiles>true</DeleteExistingFiles>
|
||||||
<PublishProtocol>FileSystem</PublishProtocol>
|
<PublishProvider>FileSystem</PublishProvider>
|
||||||
|
<PublishUrl>publish\$(Configuration)\$(TargetFramework)\$(RuntimeIdentifier)\</PublishUrl>
|
||||||
|
<WebPublishMethod>FileSystem</WebPublishMethod>
|
||||||
|
<_TargetId>Folder</_TargetId>
|
||||||
<TargetFramework>net10.0</TargetFramework>
|
<TargetFramework>net10.0</TargetFramework>
|
||||||
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
|
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
|
||||||
|
<ProjectGuid>48eff821-2f4d-60cc-aa44-be0f1d6e5f35</ProjectGuid>
|
||||||
<SelfContained>true</SelfContained>
|
<SelfContained>true</SelfContained>
|
||||||
<PublishSingleFile>false</PublishSingleFile>
|
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
</Project>
|
</Project>
|
||||||
```
|
```
|
||||||
@@ -46,12 +49,61 @@ Add publish profiles to `Properties/PublishProfiles/`:
|
|||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<Configuration>Release</Configuration>
|
<Configuration>Release</Configuration>
|
||||||
<Platform>Any CPU</Platform>
|
<Platform>Any CPU</Platform>
|
||||||
<PublishDir>publish\$(Configuration)\$(TargetFramework)\$(RuntimeIdentifier)\</PublishDir>
|
<DeleteExistingFiles>true</DeleteExistingFiles>
|
||||||
<PublishProtocol>FileSystem</PublishProtocol>
|
<PublishProvider>FileSystem</PublishProvider>
|
||||||
|
<PublishUrl>publish\$(Configuration)\$(TargetFramework)\$(RuntimeIdentifier)\</PublishUrl>
|
||||||
|
<WebPublishMethod>FileSystem</WebPublishMethod>
|
||||||
|
<_TargetId>Folder</_TargetId>
|
||||||
<TargetFramework>net10.0</TargetFramework>
|
<TargetFramework>net10.0</TargetFramework>
|
||||||
<RuntimeIdentifier>linux-x64</RuntimeIdentifier>
|
<RuntimeIdentifier>linux-x64</RuntimeIdentifier>
|
||||||
|
<ProjectGuid>48eff821-2f4d-60cc-aa44-be0f1d6e5f35</ProjectGuid>
|
||||||
|
<SelfContained>true</SelfContained>
|
||||||
|
</PropertyGroup>
|
||||||
|
</Project>
|
||||||
|
```
|
||||||
|
|
||||||
|
#### ASP.NET Application Profile (macOS Apple Silicon ARM64)
|
||||||
|
|
||||||
|
**osx-arm64.pubxml:**
|
||||||
|
|
||||||
|
```xml
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Project>
|
||||||
|
<PropertyGroup>
|
||||||
|
<Configuration>Release</Configuration>
|
||||||
|
<Platform>Any CPU</Platform>
|
||||||
|
<DeleteExistingFiles>true</DeleteExistingFiles>
|
||||||
|
<PublishProvider>FileSystem</PublishProvider>
|
||||||
|
<PublishUrl>publish\$(Configuration)\$(TargetFramework)\$(RuntimeIdentifier)\</PublishUrl>
|
||||||
|
<WebPublishMethod>FileSystem</WebPublishMethod>
|
||||||
|
<_TargetId>Folder</_TargetId>
|
||||||
|
<TargetFramework>net10.0</TargetFramework>
|
||||||
|
<RuntimeIdentifier>osx-arm64</RuntimeIdentifier>
|
||||||
|
<ProjectGuid>48eff821-2f4d-60cc-aa44-be0f1d6e5f35</ProjectGuid>
|
||||||
|
<SelfContained>true</SelfContained>
|
||||||
|
</PropertyGroup>
|
||||||
|
</Project>
|
||||||
|
```
|
||||||
|
|
||||||
|
#### ASP.NET Application Profile (macOS Intel x64)
|
||||||
|
|
||||||
|
**osx-x64.pubxml:**
|
||||||
|
|
||||||
|
```xml
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Project>
|
||||||
|
<PropertyGroup>
|
||||||
|
<Configuration>Release</Configuration>
|
||||||
|
<Platform>Any CPU</Platform>
|
||||||
|
<DeleteExistingFiles>true</DeleteExistingFiles>
|
||||||
|
<PublishProvider>FileSystem</PublishProvider>
|
||||||
|
<PublishUrl>publish\$(Configuration)\$(TargetFramework)\$(RuntimeIdentifier)\</PublishUrl>
|
||||||
|
<WebPublishMethod>FileSystem</WebPublishMethod>
|
||||||
|
<_TargetId>Folder</_TargetId>
|
||||||
|
<TargetFramework>net10.0</TargetFramework>
|
||||||
|
<RuntimeIdentifier>osx-x64</RuntimeIdentifier>
|
||||||
|
<ProjectGuid>48eff821-2f4d-60cc-aa44-be0f1d6e5f35</ProjectGuid>
|
||||||
<SelfContained>true</SelfContained>
|
<SelfContained>true</SelfContained>
|
||||||
<PublishSingleFile>false</PublishSingleFile>
|
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
</Project>
|
</Project>
|
||||||
```
|
```
|
||||||
@@ -97,6 +149,46 @@ Add publish profiles to `Properties/PublishProfiles/`:
|
|||||||
</Project>
|
</Project>
|
||||||
```
|
```
|
||||||
|
|
||||||
|
#### Console Application Profile (macOS Apple Silicon ARM64)
|
||||||
|
|
||||||
|
**osx-arm64.pubxml:**
|
||||||
|
|
||||||
|
```xml
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Project>
|
||||||
|
<PropertyGroup>
|
||||||
|
<Configuration>Release</Configuration>
|
||||||
|
<Platform>Any CPU</Platform>
|
||||||
|
<PublishDir>publish\$(Configuration)\$(TargetFramework)\$(RuntimeIdentifier)\</PublishDir>
|
||||||
|
<PublishProtocol>FileSystem</PublishProtocol>
|
||||||
|
<TargetFramework>net10.0</TargetFramework>
|
||||||
|
<RuntimeIdentifier>osx-arm64</RuntimeIdentifier>
|
||||||
|
<SelfContained>false</SelfContained>
|
||||||
|
<PublishSingleFile>false</PublishSingleFile>
|
||||||
|
</PropertyGroup>
|
||||||
|
</Project>
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Console Application Profile (macOS Intel x64)
|
||||||
|
|
||||||
|
**osx-x64.pubxml:**
|
||||||
|
|
||||||
|
```xml
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Project>
|
||||||
|
<PropertyGroup>
|
||||||
|
<Configuration>Release</Configuration>
|
||||||
|
<Platform>Any CPU</Platform>
|
||||||
|
<PublishDir>publish\$(Configuration)\$(TargetFramework)\$(RuntimeIdentifier)\</PublishDir>
|
||||||
|
<PublishProtocol>FileSystem</PublishProtocol>
|
||||||
|
<TargetFramework>net10.0</TargetFramework>
|
||||||
|
<RuntimeIdentifier>osx-x64</RuntimeIdentifier>
|
||||||
|
<SelfContained>false</SelfContained>
|
||||||
|
<PublishSingleFile>false</PublishSingleFile>
|
||||||
|
</PropertyGroup>
|
||||||
|
</Project>
|
||||||
|
```
|
||||||
|
|
||||||
### Step 2: Configure Electron Builder
|
### Step 2: Configure Electron Builder
|
||||||
|
|
||||||
ElectronNET.Core automatically adds a default `electron-builder.json` file under `Properties\electron-builder.json`.
|
ElectronNET.Core automatically adds a default `electron-builder.json` file under `Properties\electron-builder.json`.
|
||||||
@@ -130,6 +222,15 @@ The publish process will:
|
|||||||
> macOS builds can't be created on Windows machines because they require symlinks that aren't supported on Windows (per [this Electron issue](https://github.com/electron-userland/electron-packager/issues/71)). macOS builds can be produced on either Linux or macOS machines.
|
> macOS builds can't be created on Windows machines because they require symlinks that aren't supported on Windows (per [this Electron issue](https://github.com/electron-userland/electron-packager/issues/71)). macOS builds can be produced on either Linux or macOS machines.
|
||||||
|
|
||||||
|
|
||||||
|
## Custom Packaging Pipelines
|
||||||
|
|
||||||
|
The default layout is Electron-First: electron-builder produces the Electron package and the .NET app is placed in `resources/bin`. If you assemble the package yourself and put the .NET executable at the package root with Electron in a subdirectory, set `ElectronRootDir` so the .NET app can locate the Electron binary at runtime.
|
||||||
|
|
||||||
|
For pipelines that provide the npm dependencies themselves, `ElectronSkipExecCommands` suppresses all `npm`/`npx` invocations, and `ElectronIntermediatePublishDir` redirects the intermediate publish output.
|
||||||
|
|
||||||
|
See [Configuration](Configuration.md#custom-packaging-layout) for details.
|
||||||
|
|
||||||
|
|
||||||
## 🚀 Next Steps
|
## 🚀 Next Steps
|
||||||
|
|
||||||
- **[Startup Methods](Startup-Methods.md)** - Understanding different launch modes for packaged apps
|
- **[Startup Methods](Startup-Methods.md)** - Understanding different launch modes for packaged apps
|
||||||
|
|||||||
32
docs/Using/Secure-Communication.md
Normal file
32
docs/Using/Secure-Communication.md
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
# Secure Communication
|
||||||
|
|
||||||
|
By default, the IPC communication between .NET and Node.js is secured on startup. Consequently, multiple instances running on different user accounts (but shared on the same machine) can safely co-exist. However, this protection is not enough to secure the web application behind - or make any security statement w.r.t. a malicious root user.
|
||||||
|
|
||||||
|
## Securing the Web Application
|
||||||
|
|
||||||
|
You can opt-in to also guard your ASP.NET Core application using the same mechanism that is already used to protected the IPC broker that deals with the .NET to Node.js communication.
|
||||||
|
|
||||||
|
The key to opt-in is to provide another service *before* calling `AddElectron` on the service collection.
|
||||||
|
|
||||||
|
The following two namespaces are used in the next instructions:
|
||||||
|
|
||||||
|
```cs
|
||||||
|
using ElectronNET.AspNet.Middleware;
|
||||||
|
using ElectronNET.AspNet.Services;
|
||||||
|
```
|
||||||
|
|
||||||
|
You'll need the following line:
|
||||||
|
|
||||||
|
```cs
|
||||||
|
builder.Services.AddSingleton<IElectronAuthenticationService, ElectronAuthenticationService>();
|
||||||
|
```
|
||||||
|
|
||||||
|
This way, Electron.NET is notified that you want to store and re-use the authentication token that has been negotiated between the .NET and Node.js processes at startup.
|
||||||
|
|
||||||
|
With this being set up you can register a middleware to actually deny requests that have originated outside of your Electron.NET application:
|
||||||
|
|
||||||
|
```cs
|
||||||
|
app.UseMiddleware<ElectronAuthenticationMiddleware>();
|
||||||
|
```
|
||||||
|
|
||||||
|
This must be placed above any routing (e.g., before calling `UseRouting` on the web application) in order to properly take effect.
|
||||||
@@ -9,11 +9,13 @@
|
|||||||
|
|
||||||
- [What's new?](Core/What's-New.md)
|
- [What's new?](Core/What's-New.md)
|
||||||
- [Migration Guide](Core/Migration-Guide.md)
|
- [Migration Guide](Core/Migration-Guide.md)
|
||||||
|
- [Migration Checks](Core/Migration-Checks.md)
|
||||||
- [Advanced Migration](Core/Advanced-Migration-Topics.md)
|
- [Advanced Migration](Core/Advanced-Migration-Topics.md)
|
||||||
|
|
||||||
# Getting Started
|
# Getting Started
|
||||||
|
|
||||||
- [System Requirements](GettingStarted/System-Requirements.md)
|
- [System Requirements](GettingStarted/System-Requirements.md)
|
||||||
|
- [Project Templates](GettingStarted/Templates.md)
|
||||||
- [With ASP.Net](GettingStarted/ASP.Net.md)
|
- [With ASP.Net](GettingStarted/ASP.Net.md)
|
||||||
- [With a Console App](GettingStarted/Console-App.md)
|
- [With a Console App](GettingStarted/Console-App.md)
|
||||||
|
|
||||||
@@ -23,6 +25,8 @@
|
|||||||
- [Startup-Methods](Using/Startup-Methods.md)
|
- [Startup-Methods](Using/Startup-Methods.md)
|
||||||
- [Debugging](Using/Debugging.md)
|
- [Debugging](Using/Debugging.md)
|
||||||
- [Package Building](Using/Package-Building.md)
|
- [Package Building](Using/Package-Building.md)
|
||||||
|
- [Secure Communication](Using/Secure-Communication.md)
|
||||||
|
- [Adding a `custom_main.js`](Using/Custom_main.md)
|
||||||
|
|
||||||
# API Reference
|
# API Reference
|
||||||
|
|
||||||
|
|||||||
@@ -85,7 +85,7 @@ public sealed class ReleaseNotesParser
|
|||||||
|
|
||||||
// Parse content.
|
// Parse content.
|
||||||
var notes = new List<string>();
|
var notes = new List<string>();
|
||||||
|
|
||||||
while (true)
|
while (true)
|
||||||
{
|
{
|
||||||
// Sanity checks.
|
// Sanity checks.
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<OutputType>Exe</OutputType>
|
<OutputType>Exe</OutputType>
|
||||||
<TargetFramework>net8.0</TargetFramework>
|
<TargetFramework>net10.0</TargetFramework>
|
||||||
<RootNamespace></RootNamespace>
|
<RootNamespace></RootNamespace>
|
||||||
<NoWarn>CS0649;CS0169</NoWarn>
|
<NoWarn>CS0649;CS0169</NoWarn>
|
||||||
<NukeRootDirectory>..</NukeRootDirectory>
|
<NukeRootDirectory>..</NukeRootDirectory>
|
||||||
@@ -11,7 +11,9 @@
|
|||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Nuke.Common" Version="9.0.4" />
|
<PackageReference Include="Microsoft.Build" Version="18.0.2" />
|
||||||
|
<PackageReference Include="Microsoft.Build.Tasks.Core" Version="18.0.2" />
|
||||||
|
<PackageReference Include="Nuke.Common" Version="10.1.0" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|||||||
4
src/.editorconfig
Normal file
4
src/.editorconfig
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
[*.cs]
|
||||||
|
|
||||||
|
# CA1416: Validate platform compatibility
|
||||||
|
dotnet_diagnostic.CA1416.severity = error
|
||||||
@@ -1,4 +1,5 @@
|
|||||||
// ReSharper disable InconsistentNaming
|
// ReSharper disable InconsistentNaming
|
||||||
|
|
||||||
namespace ElectronNET.API
|
namespace ElectronNET.API
|
||||||
{
|
{
|
||||||
using Common;
|
using Common;
|
||||||
@@ -17,6 +18,7 @@ namespace ElectronNET.API
|
|||||||
DashesLowerFirst,
|
DashesLowerFirst,
|
||||||
NoDashUpperFirst
|
NoDashUpperFirst
|
||||||
}
|
}
|
||||||
|
|
||||||
protected enum SocketTaskMessageNameTypes
|
protected enum SocketTaskMessageNameTypes
|
||||||
{
|
{
|
||||||
DashesLowerFirst,
|
DashesLowerFirst,
|
||||||
@@ -29,15 +31,15 @@ namespace ElectronNET.API
|
|||||||
CamelCase,
|
CamelCase,
|
||||||
}
|
}
|
||||||
|
|
||||||
private const int PropertyTimeout = 1000;
|
private static readonly TimeSpan InvocationTimeout = 1000.ms();
|
||||||
|
|
||||||
private readonly string objectName;
|
private readonly string objectName;
|
||||||
private readonly ConcurrentDictionary<string, PropertyGetter> propertyGetters;
|
private readonly ConcurrentDictionary<string, Invocator> invocators;
|
||||||
private readonly ConcurrentDictionary<string, string> propertyEventNames = new();
|
private readonly ConcurrentDictionary<string, string> invocationEventNames = new();
|
||||||
private readonly ConcurrentDictionary<string, string> propertyMessageNames = new();
|
private readonly ConcurrentDictionary<string, string> invocationMessageNames = new();
|
||||||
private readonly ConcurrentDictionary<string, string> methodMessageNames = new();
|
private readonly ConcurrentDictionary<string, string> methodMessageNames = new();
|
||||||
private static readonly ConcurrentDictionary<string, EventContainer> eventContainers = new();
|
private static readonly ConcurrentDictionary<string, EventContainer> eventContainers = new();
|
||||||
private static readonly ConcurrentDictionary<string, ConcurrentDictionary<string, PropertyGetter>> AllPropertyGetters = new();
|
private static readonly ConcurrentDictionary<string, ConcurrentDictionary<string, Invocator>> AllInvocators = new();
|
||||||
|
|
||||||
private readonly object objLock = new object();
|
private readonly object objLock = new object();
|
||||||
|
|
||||||
@@ -58,7 +60,7 @@ namespace ElectronNET.API
|
|||||||
protected ApiBase()
|
protected ApiBase()
|
||||||
{
|
{
|
||||||
this.objectName = this.GetType().Name.LowerFirst();
|
this.objectName = this.GetType().Name.LowerFirst();
|
||||||
propertyGetters = AllPropertyGetters.GetOrAdd(objectName, _ => new ConcurrentDictionary<string, PropertyGetter>());
|
this.invocators = AllInvocators.GetOrAdd(this.objectName, _ => new ConcurrentDictionary<string, Invocator>());
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void CallMethod0([CallerMemberName] string callerName = null)
|
protected void CallMethod0([CallerMemberName] string callerName = null)
|
||||||
@@ -113,21 +115,26 @@ namespace ElectronNET.API
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected Task<T> GetPropertyAsync<T>(object arg = null, [CallerMemberName] string callerName = null)
|
protected Task<T> InvokeAsync<T>(object arg = null, [CallerMemberName] string callerName = null)
|
||||||
|
{
|
||||||
|
return this.InvokeAsyncWithTimeout<T>(InvocationTimeout, arg, callerName);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected Task<T> InvokeAsyncWithTimeout<T>(TimeSpan invocationTimeout, object arg = null, [CallerMemberName] string callerName = null)
|
||||||
{
|
{
|
||||||
Debug.Assert(callerName != null, nameof(callerName) + " != null");
|
Debug.Assert(callerName != null, nameof(callerName) + " != null");
|
||||||
|
|
||||||
lock (this.objLock)
|
lock (this.objLock)
|
||||||
{
|
{
|
||||||
return this.propertyGetters.GetOrAdd(callerName, _ =>
|
return this.invocators.GetOrAdd(callerName, _ =>
|
||||||
{
|
{
|
||||||
var getter = new PropertyGetter<T>(this, callerName, PropertyTimeout, arg);
|
var getter = new Invocator<T>(this, callerName, invocationTimeout, arg);
|
||||||
|
|
||||||
getter.Task<T>().ContinueWith(_ =>
|
getter.Task<T>().ContinueWith(_ =>
|
||||||
{
|
{
|
||||||
lock (this.objLock)
|
lock (this.objLock)
|
||||||
{
|
{
|
||||||
return this.propertyGetters.TryRemove(callerName, out var _);
|
return this.invocators.TryRemove(callerName, out var _);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -135,15 +142,15 @@ namespace ElectronNET.API
|
|||||||
}).Task<T>();
|
}).Task<T>();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void AddEvent(Action value, int? id = null, [CallerMemberName] string callerName = null)
|
protected void AddEvent(Action value, int? id = null, [CallerMemberName] string callerName = null)
|
||||||
{
|
{
|
||||||
Debug.Assert(callerName != null, nameof(callerName) + " != null");
|
Debug.Assert(callerName != null, nameof(callerName) + " != null");
|
||||||
var eventName = EventName(callerName);
|
var eventName = this.EventName(callerName);
|
||||||
|
|
||||||
var eventKey = EventKey(eventName, id);
|
|
||||||
|
|
||||||
lock (objLock)
|
var eventKey = this.EventKey(eventName, id);
|
||||||
|
|
||||||
|
lock (this.objLock)
|
||||||
{
|
{
|
||||||
var container = eventContainers.GetOrAdd(eventKey, _ =>
|
var container = eventContainers.GetOrAdd(eventKey, _ =>
|
||||||
{
|
{
|
||||||
@@ -156,14 +163,14 @@ namespace ElectronNET.API
|
|||||||
container.Register(value);
|
container.Register(value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void RemoveEvent(Action value, int? id = null, [CallerMemberName] string callerName = null)
|
protected void RemoveEvent(Action value, int? id = null, [CallerMemberName] string callerName = null)
|
||||||
{
|
{
|
||||||
Debug.Assert(callerName != null, nameof(callerName) + " != null");
|
Debug.Assert(callerName != null, nameof(callerName) + " != null");
|
||||||
var eventName = EventName(callerName);
|
var eventName = this.EventName(callerName);
|
||||||
var eventKey = EventKey(eventName, id);
|
var eventKey = this.EventKey(eventName, id);
|
||||||
|
|
||||||
lock (objLock)
|
lock (this.objLock)
|
||||||
{
|
{
|
||||||
if (eventContainers.TryGetValue(eventKey, out var container) && !container.Unregister(value))
|
if (eventContainers.TryGetValue(eventKey, out var container) && !container.Unregister(value))
|
||||||
{
|
{
|
||||||
@@ -172,15 +179,15 @@ namespace ElectronNET.API
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void AddEvent<T>(Action<T> value, int? id = null, [CallerMemberName] string callerName = null)
|
protected void AddEvent<T>(Action<T> value, int? id = null, [CallerMemberName] string callerName = null)
|
||||||
{
|
{
|
||||||
Debug.Assert(callerName != null, nameof(callerName) + " != null");
|
Debug.Assert(callerName != null, nameof(callerName) + " != null");
|
||||||
|
|
||||||
var eventName = EventName(callerName);
|
|
||||||
var eventKey = EventKey(eventName, id);
|
|
||||||
|
|
||||||
lock (objLock)
|
var eventName = this.EventName(callerName);
|
||||||
|
var eventKey = this.EventKey(eventName, id);
|
||||||
|
|
||||||
|
lock (this.objLock)
|
||||||
{
|
{
|
||||||
var container = eventContainers.GetOrAdd(eventKey, _ =>
|
var container = eventContainers.GetOrAdd(eventKey, _ =>
|
||||||
{
|
{
|
||||||
@@ -197,10 +204,10 @@ namespace ElectronNET.API
|
|||||||
protected void RemoveEvent<T>(Action<T> value, int? id = null, [CallerMemberName] string callerName = null)
|
protected void RemoveEvent<T>(Action<T> value, int? id = null, [CallerMemberName] string callerName = null)
|
||||||
{
|
{
|
||||||
Debug.Assert(callerName != null, nameof(callerName) + " != null");
|
Debug.Assert(callerName != null, nameof(callerName) + " != null");
|
||||||
var eventName = EventName(callerName);
|
var eventName = this.EventName(callerName);
|
||||||
var eventKey = EventKey(eventName, id);
|
var eventKey = this.EventKey(eventName, id);
|
||||||
|
|
||||||
lock (objLock)
|
lock (this.objLock)
|
||||||
{
|
{
|
||||||
if (eventContainers.TryGetValue(eventKey, out var container) && !container.Unregister(value))
|
if (eventContainers.TryGetValue(eventKey, out var container) && !container.Unregister(value))
|
||||||
{
|
{
|
||||||
@@ -212,33 +219,33 @@ namespace ElectronNET.API
|
|||||||
|
|
||||||
private string EventName(string callerName)
|
private string EventName(string callerName)
|
||||||
{
|
{
|
||||||
switch (SocketEventNameType)
|
switch (this.SocketEventNameType)
|
||||||
{
|
{
|
||||||
case SocketEventNameTypes.DashedLower:
|
case SocketEventNameTypes.DashedLower:
|
||||||
return $"{objectName}-{callerName.ToDashedEventName()}";
|
return $"{this.objectName}-{callerName.ToDashedEventName()}";
|
||||||
case SocketEventNameTypes.CamelCase:
|
case SocketEventNameTypes.CamelCase:
|
||||||
return $"{objectName}-{callerName.ToCamelCaseEventName()}";
|
return $"{this.objectName}-{callerName.ToCamelCaseEventName()}";
|
||||||
default:
|
default:
|
||||||
throw new ArgumentOutOfRangeException();
|
throw new ArgumentOutOfRangeException();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private string EventKey(string eventName, int? id)
|
private string EventKey(string eventName, int? id)
|
||||||
{
|
{
|
||||||
return string.Format(CultureInfo.InvariantCulture, "{0}{1:D}", eventName, id);
|
return string.Format(CultureInfo.InvariantCulture, "{0}{1:D}", eventName, id);
|
||||||
}
|
}
|
||||||
|
|
||||||
internal abstract class PropertyGetter
|
internal abstract class Invocator
|
||||||
{
|
{
|
||||||
public abstract Task<T> Task<T>();
|
public abstract Task<T> Task<T>();
|
||||||
}
|
}
|
||||||
|
|
||||||
internal class PropertyGetter<T> : PropertyGetter
|
internal class Invocator<T> : Invocator
|
||||||
{
|
{
|
||||||
private readonly Task<T> tcsTask;
|
private readonly Task<T> tcsTask;
|
||||||
private TaskCompletionSource<T> tcs;
|
private TaskCompletionSource<T> tcs;
|
||||||
|
|
||||||
public PropertyGetter(ApiBase apiBase, string callerName, int timeoutMs, object arg = null)
|
public Invocator(ApiBase apiBase, string callerName, TimeSpan timeout, object arg = null)
|
||||||
{
|
{
|
||||||
this.tcs = new TaskCompletionSource<T>(TaskCreationOptions.RunContinuationsAsynchronously);
|
this.tcs = new TaskCompletionSource<T>(TaskCreationOptions.RunContinuationsAsynchronously);
|
||||||
this.tcsTask = this.tcs.Task;
|
this.tcsTask = this.tcs.Task;
|
||||||
@@ -249,22 +256,22 @@ namespace ElectronNET.API
|
|||||||
switch (apiBase.SocketTaskEventNameType)
|
switch (apiBase.SocketTaskEventNameType)
|
||||||
{
|
{
|
||||||
case SocketTaskEventNameTypes.DashesLowerFirst:
|
case SocketTaskEventNameTypes.DashesLowerFirst:
|
||||||
eventName = apiBase.propertyEventNames.GetOrAdd(callerName, s => $"{apiBase.objectName}-{s.StripAsync().LowerFirst()}-completed");
|
eventName = apiBase.invocationEventNames.GetOrAdd(callerName, s => $"{apiBase.objectName}-{s.StripAsync().LowerFirst()}-completed");
|
||||||
break;
|
break;
|
||||||
case SocketTaskEventNameTypes.NoDashUpperFirst:
|
case SocketTaskEventNameTypes.NoDashUpperFirst:
|
||||||
eventName = apiBase.propertyEventNames.GetOrAdd(callerName, s => $"{apiBase.objectName}{s.StripAsync()}Completed");
|
eventName = apiBase.invocationEventNames.GetOrAdd(callerName, s => $"{apiBase.objectName}{s.StripAsync()}Completed");
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
throw new ArgumentOutOfRangeException();
|
throw new ArgumentOutOfRangeException();
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (apiBase.SocketTaskMessageNameType)
|
switch (apiBase.SocketTaskMessageNameType)
|
||||||
{
|
{
|
||||||
case SocketTaskMessageNameTypes.DashesLowerFirst:
|
case SocketTaskMessageNameTypes.DashesLowerFirst:
|
||||||
messageName = apiBase.propertyMessageNames.GetOrAdd(callerName, s => $"{apiBase.objectName}-{s.StripAsync().LowerFirst()}");
|
messageName = apiBase.invocationMessageNames.GetOrAdd(callerName, s => $"{apiBase.objectName}-{s.StripAsync().LowerFirst()}");
|
||||||
break;
|
break;
|
||||||
case SocketTaskMessageNameTypes.NoDashUpperFirst:
|
case SocketTaskMessageNameTypes.NoDashUpperFirst:
|
||||||
messageName = apiBase.propertyMessageNames.GetOrAdd(callerName, s => apiBase.objectName + s.StripAsync());
|
messageName = apiBase.invocationMessageNames.GetOrAdd(callerName, s => apiBase.objectName + s.StripAsync());
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
throw new ArgumentOutOfRangeException();
|
throw new ArgumentOutOfRangeException();
|
||||||
@@ -289,17 +296,17 @@ namespace ElectronNET.API
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
if (arg != null)
|
if (arg != null)
|
||||||
{
|
{
|
||||||
_ = apiBase.Id >= 0 ? BridgeConnector.Socket.Emit(messageName, apiBase.Id, arg) : BridgeConnector.Socket.Emit(messageName, arg);
|
_ = apiBase.Id >= 0 ? BridgeConnector.Socket.Emit(messageName, apiBase.Id, arg) : BridgeConnector.Socket.Emit(messageName, arg);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
_ = apiBase.Id >= 0 ? BridgeConnector.Socket.Emit(messageName, apiBase.Id) : BridgeConnector.Socket.Emit(messageName);
|
_ = apiBase.Id >= 0 ? BridgeConnector.Socket.Emit(messageName, apiBase.Id) : BridgeConnector.Socket.Emit(messageName);
|
||||||
}
|
}
|
||||||
|
|
||||||
System.Threading.Tasks.Task.Delay(PropertyTimeout).ContinueWith(_ =>
|
System.Threading.Tasks.Task.Delay(timeout).ContinueWith(_ =>
|
||||||
{
|
{
|
||||||
if (this.tcs != null)
|
if (this.tcs != null)
|
||||||
{
|
{
|
||||||
@@ -307,7 +314,9 @@ namespace ElectronNET.API
|
|||||||
{
|
{
|
||||||
if (this.tcs != null)
|
if (this.tcs != null)
|
||||||
{
|
{
|
||||||
var ex = new TimeoutException($"No response after {timeoutMs:D}ms trying to retrieve value {apiBase.objectName}.{callerName}()");
|
var ex = new TimeoutException(
|
||||||
|
$"No response after {(long)timeout.TotalMilliseconds}ms trying to retrieve value {apiBase.objectName}.{callerName}()"
|
||||||
|
);
|
||||||
this.tcs.TrySetException(ex);
|
this.tcs.TrySetException(ex);
|
||||||
this.tcs = null;
|
this.tcs = null;
|
||||||
}
|
}
|
||||||
@@ -321,7 +330,7 @@ namespace ElectronNET.API
|
|||||||
return this.tcsTask as Task<T1>;
|
return this.tcsTask as Task<T1>;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[SuppressMessage("ReSharper", "InconsistentlySynchronizedField")]
|
[SuppressMessage("ReSharper", "InconsistentlySynchronizedField")]
|
||||||
private class EventContainer
|
private class EventContainer
|
||||||
{
|
{
|
||||||
@@ -330,44 +339,44 @@ namespace ElectronNET.API
|
|||||||
|
|
||||||
private Action<T> GetEventActionT<T>()
|
private Action<T> GetEventActionT<T>()
|
||||||
{
|
{
|
||||||
return (Action<T>)eventActionT;
|
return (Action<T>)this.eventActionT;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void SetEventActionT<T>(Action<T> actionT)
|
private void SetEventActionT<T>(Action<T> actionT)
|
||||||
{
|
{
|
||||||
eventActionT = actionT;
|
this.eventActionT = actionT;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void OnEventAction() => eventAction?.Invoke();
|
public void OnEventAction() => this.eventAction?.Invoke();
|
||||||
|
|
||||||
public void OnEventActionT<T>(T p) => GetEventActionT<T>()?.Invoke(p);
|
public void OnEventActionT<T>(T p) => this.GetEventActionT<T>()?.Invoke(p);
|
||||||
|
|
||||||
public void Register(Action receiver)
|
public void Register(Action receiver)
|
||||||
{
|
{
|
||||||
eventAction += receiver;
|
this.eventAction += receiver;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Register<T>(Action<T> receiver)
|
public void Register<T>(Action<T> receiver)
|
||||||
{
|
{
|
||||||
var actionT = GetEventActionT<T>();
|
var actionT = this.GetEventActionT<T>();
|
||||||
actionT += receiver;
|
actionT += receiver;
|
||||||
SetEventActionT(actionT);
|
this.SetEventActionT(actionT);
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool Unregister(Action receiver)
|
public bool Unregister(Action receiver)
|
||||||
{
|
{
|
||||||
eventAction -= receiver;
|
this.eventAction -= receiver;
|
||||||
return this.eventAction != null;
|
return this.eventAction != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool Unregister<T>(Action<T> receiver)
|
public bool Unregister<T>(Action<T> receiver)
|
||||||
{
|
{
|
||||||
var actionT = GetEventActionT<T>();
|
var actionT = this.GetEventActionT<T>();
|
||||||
actionT -= receiver;
|
actionT -= receiver;
|
||||||
SetEventActionT(actionT);
|
this.SetEventActionT(actionT);
|
||||||
|
|
||||||
return actionT != null;
|
return actionT != null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2,6 +2,7 @@ using ElectronNET.API.Entities;
|
|||||||
using ElectronNET.API.Extensions;
|
using ElectronNET.API.Extensions;
|
||||||
using System;
|
using System;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
|
using System.Runtime.Versioning;
|
||||||
using System.Text.Json;
|
using System.Text.Json;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
@@ -58,7 +59,7 @@ namespace ElectronNET.API
|
|||||||
private event Action _windowAllClosed;
|
private event Action _windowAllClosed;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Emitted before the application starts closing its windows.
|
/// Emitted before the application starts closing its windows.
|
||||||
/// <para/>
|
/// <para/>
|
||||||
/// Note: If application quit was initiated by <see cref="AutoUpdater.QuitAndInstall"/> then <see cref="BeforeQuit"/>
|
/// Note: If application quit was initiated by <see cref="AutoUpdater.QuitAndInstall"/> then <see cref="BeforeQuit"/>
|
||||||
/// is emitted after emitting close event on all windows and closing them.
|
/// is emitted after emitting close event on all windows and closing them.
|
||||||
@@ -259,6 +260,8 @@ namespace ElectronNET.API
|
|||||||
/// screen readers, are enabled or disabled. See https://www.chromium.org/developers/design-documents/accessibility for more details.
|
/// screen readers, are enabled or disabled. See https://www.chromium.org/developers/design-documents/accessibility for more details.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns><see langword="true"/> when Chrome's accessibility support is enabled, <see langword="false"/> otherwise.</returns>
|
/// <returns><see langword="true"/> when Chrome's accessibility support is enabled, <see langword="false"/> otherwise.</returns>
|
||||||
|
[SupportedOSPlatform("macOS")]
|
||||||
|
[SupportedOSPlatform("Windows")]
|
||||||
public event Action<bool> AccessibilitySupportChanged
|
public event Action<bool> AccessibilitySupportChanged
|
||||||
{
|
{
|
||||||
add => AddEvent(value, GetHashCode());
|
add => AddEvent(value, GetHashCode());
|
||||||
@@ -316,6 +319,7 @@ namespace ElectronNET.API
|
|||||||
/// <para/>
|
/// <para/>
|
||||||
/// On Windows, you have to parse the arguments using App.CommandLine to get the filepath.
|
/// On Windows, you have to parse the arguments using App.CommandLine to get the filepath.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[SupportedOSPlatform("macOS")]
|
||||||
public event Action<string> OpenFile
|
public event Action<string> OpenFile
|
||||||
{
|
{
|
||||||
add => AddEvent(value, GetHashCode());
|
add => AddEvent(value, GetHashCode());
|
||||||
@@ -327,6 +331,7 @@ namespace ElectronNET.API
|
|||||||
/// Emitted when a MacOS user wants to open a URL with the application. Your application's Info.plist file must
|
/// Emitted when a MacOS user wants to open a URL with the application. Your application's Info.plist file must
|
||||||
/// define the URL scheme within the CFBundleURLTypes key, and set NSPrincipalClass to AtomApplication.
|
/// define the URL scheme within the CFBundleURLTypes key, and set NSPrincipalClass to AtomApplication.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[SupportedOSPlatform("macOS")]
|
||||||
public event Action<string> OpenUrl
|
public event Action<string> OpenUrl
|
||||||
{
|
{
|
||||||
add => AddEvent(value, GetHashCode());
|
add => AddEvent(value, GetHashCode());
|
||||||
@@ -366,7 +371,7 @@ namespace ElectronNET.API
|
|||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return this.GetPropertyAsync<string>();
|
return this.InvokeAsync<string>();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -399,7 +404,6 @@ namespace ElectronNET.API
|
|||||||
private static object _syncRoot = new object();
|
private static object _syncRoot = new object();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Try to close all windows. The <see cref="BeforeQuit"/> event will be emitted first. If all windows are successfully
|
/// Try to close all windows. The <see cref="BeforeQuit"/> event will be emitted first. If all windows are successfully
|
||||||
/// closed, the <see cref="WillQuit"/> event will be emitted and by default the application will terminate. This method
|
/// closed, the <see cref="WillQuit"/> event will be emitted and by default the application will terminate. This method
|
||||||
@@ -423,7 +427,7 @@ namespace ElectronNET.API
|
|||||||
|
|
||||||
public void DisposeSocket()
|
public void DisposeSocket()
|
||||||
{
|
{
|
||||||
BridgeConnector.Socket.DisposeSocket();
|
BridgeConnector.Socket.Dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -482,6 +486,7 @@ namespace ElectronNET.API
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Hides all application windows without minimizing them.
|
/// Hides all application windows without minimizing them.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[SupportedOSPlatform("macOS")]
|
||||||
public void Hide()
|
public void Hide()
|
||||||
{
|
{
|
||||||
this.CallMethod0();
|
this.CallMethod0();
|
||||||
@@ -490,6 +495,7 @@ namespace ElectronNET.API
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Shows application windows after they were hidden. Does not automatically focus them.
|
/// Shows application windows after they were hidden. Does not automatically focus them.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[SupportedOSPlatform("macOS")]
|
||||||
public void Show()
|
public void Show()
|
||||||
{
|
{
|
||||||
this.CallMethod0();
|
this.CallMethod0();
|
||||||
@@ -501,7 +507,7 @@ namespace ElectronNET.API
|
|||||||
public async Task<string> GetAppPathAsync(CancellationToken cancellationToken = default)
|
public async Task<string> GetAppPathAsync(CancellationToken cancellationToken = default)
|
||||||
{
|
{
|
||||||
cancellationToken.ThrowIfCancellationRequested();
|
cancellationToken.ThrowIfCancellationRequested();
|
||||||
return await this.GetPropertyAsync<string>().ConfigureAwait(false);
|
return await this.InvokeAsync<string>().ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -533,7 +539,7 @@ namespace ElectronNET.API
|
|||||||
using (cancellationToken.Register(() => taskCompletionSource.TrySetCanceled()))
|
using (cancellationToken.Register(() => taskCompletionSource.TrySetCanceled()))
|
||||||
{
|
{
|
||||||
BridgeConnector.Socket.Once<string>("appGetPathCompleted", taskCompletionSource.SetResult);
|
BridgeConnector.Socket.Once<string>("appGetPathCompleted", taskCompletionSource.SetResult);
|
||||||
BridgeConnector.Socket.Emit("appGetPath", pathName.GetDescription());
|
BridgeConnector.Socket.Emit("appGetPath", pathName);
|
||||||
|
|
||||||
return await taskCompletionSource.Task
|
return await taskCompletionSource.Task
|
||||||
.ConfigureAwait(false);
|
.ConfigureAwait(false);
|
||||||
@@ -554,18 +560,18 @@ namespace ElectronNET.API
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public void SetPath(PathName name, string path)
|
public void SetPath(PathName name, string path)
|
||||||
{
|
{
|
||||||
this.CallMethod2(name.GetDescription(), path);
|
this.CallMethod2(name, path);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The version of the loaded application. If no version is found in the application’s package.json file,
|
/// The version of the loaded application. If no version is found in the application’s package.json file,
|
||||||
/// the version of the current bundle or executable is returned.
|
/// the version of the current bundle or executable is returned.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns>The version of the loaded application.</returns>
|
/// <returns>The version of the loaded application.</returns>
|
||||||
public async Task<string> GetVersionAsync(CancellationToken cancellationToken = default)
|
public async Task<string> GetVersionAsync(CancellationToken cancellationToken = default)
|
||||||
{
|
{
|
||||||
cancellationToken.ThrowIfCancellationRequested();
|
cancellationToken.ThrowIfCancellationRequested();
|
||||||
return await this.GetPropertyAsync<string>().ConfigureAwait(false);
|
return await this.InvokeAsync<string>().ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -579,7 +585,7 @@ namespace ElectronNET.API
|
|||||||
public async Task<string> GetLocaleAsync(CancellationToken cancellationToken = default)
|
public async Task<string> GetLocaleAsync(CancellationToken cancellationToken = default)
|
||||||
{
|
{
|
||||||
cancellationToken.ThrowIfCancellationRequested();
|
cancellationToken.ThrowIfCancellationRequested();
|
||||||
return await this.GetPropertyAsync<string>().ConfigureAwait(false);
|
return await this.InvokeAsync<string>().ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -587,6 +593,8 @@ namespace ElectronNET.API
|
|||||||
/// list from the task bar, and on macOS you can visit it from dock menu.
|
/// list from the task bar, and on macOS you can visit it from dock menu.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="path">Path to add.</param>
|
/// <param name="path">Path to add.</param>
|
||||||
|
[SupportedOSPlatform("macOS")]
|
||||||
|
[SupportedOSPlatform("Windows")]
|
||||||
public void AddRecentDocument(string path)
|
public void AddRecentDocument(string path)
|
||||||
{
|
{
|
||||||
this.CallMethod1(path);
|
this.CallMethod1(path);
|
||||||
@@ -595,6 +603,8 @@ namespace ElectronNET.API
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Clears the recent documents list.
|
/// Clears the recent documents list.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[SupportedOSPlatform("macOS")]
|
||||||
|
[SupportedOSPlatform("Windows")]
|
||||||
public void ClearRecentDocuments()
|
public void ClearRecentDocuments()
|
||||||
{
|
{
|
||||||
this.CallMethod0();
|
this.CallMethod0();
|
||||||
@@ -710,6 +720,8 @@ namespace ElectronNET.API
|
|||||||
/// <param name="protocol">The name of your protocol, without ://.</param>
|
/// <param name="protocol">The name of your protocol, without ://.</param>
|
||||||
/// <param name="cancellationToken">The cancellation token.</param>
|
/// <param name="cancellationToken">The cancellation token.</param>
|
||||||
/// <returns>Whether the call succeeded.</returns>
|
/// <returns>Whether the call succeeded.</returns>
|
||||||
|
[SupportedOSPlatform("macOS")]
|
||||||
|
[SupportedOSPlatform("Windows")]
|
||||||
public async Task<bool> RemoveAsDefaultProtocolClientAsync(string protocol, CancellationToken cancellationToken = default)
|
public async Task<bool> RemoveAsDefaultProtocolClientAsync(string protocol, CancellationToken cancellationToken = default)
|
||||||
{
|
{
|
||||||
return await this.RemoveAsDefaultProtocolClientAsync(protocol, null, null, cancellationToken).ConfigureAwait(false);
|
return await this.RemoveAsDefaultProtocolClientAsync(protocol, null, null, cancellationToken).ConfigureAwait(false);
|
||||||
@@ -723,6 +735,8 @@ namespace ElectronNET.API
|
|||||||
/// <param name="path">Defaults to process.execPath.</param>
|
/// <param name="path">Defaults to process.execPath.</param>
|
||||||
/// <param name="cancellationToken">The cancellation token.</param>
|
/// <param name="cancellationToken">The cancellation token.</param>
|
||||||
/// <returns>Whether the call succeeded.</returns>
|
/// <returns>Whether the call succeeded.</returns>
|
||||||
|
[SupportedOSPlatform("macOS")]
|
||||||
|
[SupportedOSPlatform("Windows")]
|
||||||
public async Task<bool> RemoveAsDefaultProtocolClientAsync(string protocol, string path, CancellationToken cancellationToken = default)
|
public async Task<bool> RemoveAsDefaultProtocolClientAsync(string protocol, string path, CancellationToken cancellationToken = default)
|
||||||
{
|
{
|
||||||
return await this.RemoveAsDefaultProtocolClientAsync(protocol, path, null, cancellationToken).ConfigureAwait(false);
|
return await this.RemoveAsDefaultProtocolClientAsync(protocol, path, null, cancellationToken).ConfigureAwait(false);
|
||||||
@@ -737,6 +751,8 @@ namespace ElectronNET.API
|
|||||||
/// <param name="args">Defaults to an empty array.</param>
|
/// <param name="args">Defaults to an empty array.</param>
|
||||||
/// <param name="cancellationToken">The cancellation token.</param>
|
/// <param name="cancellationToken">The cancellation token.</param>
|
||||||
/// <returns>Whether the call succeeded.</returns>
|
/// <returns>Whether the call succeeded.</returns>
|
||||||
|
[SupportedOSPlatform("macOS")]
|
||||||
|
[SupportedOSPlatform("Windows")]
|
||||||
public async Task<bool> RemoveAsDefaultProtocolClientAsync(string protocol, string path, string[] args, CancellationToken cancellationToken = default)
|
public async Task<bool> RemoveAsDefaultProtocolClientAsync(string protocol, string path, string[] args, CancellationToken cancellationToken = default)
|
||||||
{
|
{
|
||||||
cancellationToken.ThrowIfCancellationRequested();
|
cancellationToken.ThrowIfCancellationRequested();
|
||||||
@@ -827,6 +843,7 @@ namespace ElectronNET.API
|
|||||||
/// <param name="userTasks">Array of <see cref="UserTask"/> objects.</param>
|
/// <param name="userTasks">Array of <see cref="UserTask"/> objects.</param>
|
||||||
/// <param name="cancellationToken">The cancellation token.</param>
|
/// <param name="cancellationToken">The cancellation token.</param>
|
||||||
/// <returns>Whether the call succeeded.</returns>
|
/// <returns>Whether the call succeeded.</returns>
|
||||||
|
[SupportedOSPlatform("Windows")]
|
||||||
public async Task<bool> SetUserTasksAsync(UserTask[] userTasks, CancellationToken cancellationToken = default)
|
public async Task<bool> SetUserTasksAsync(UserTask[] userTasks, CancellationToken cancellationToken = default)
|
||||||
{
|
{
|
||||||
cancellationToken.ThrowIfCancellationRequested();
|
cancellationToken.ThrowIfCancellationRequested();
|
||||||
@@ -847,10 +864,11 @@ namespace ElectronNET.API
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="cancellationToken">The cancellation token.</param>
|
/// <param name="cancellationToken">The cancellation token.</param>
|
||||||
/// <returns>Jump List settings.</returns>
|
/// <returns>Jump List settings.</returns>
|
||||||
|
[SupportedOSPlatform("Windows")]
|
||||||
public async Task<JumpListSettings> GetJumpListSettingsAsync(CancellationToken cancellationToken = default)
|
public async Task<JumpListSettings> GetJumpListSettingsAsync(CancellationToken cancellationToken = default)
|
||||||
{
|
{
|
||||||
cancellationToken.ThrowIfCancellationRequested();
|
cancellationToken.ThrowIfCancellationRequested();
|
||||||
return await this.GetPropertyAsync<JumpListSettings>().ConfigureAwait(false);
|
return await this.InvokeAsync<JumpListSettings>().ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -869,6 +887,7 @@ namespace ElectronNET.API
|
|||||||
/// omitted from the Jump List. The list of removed items can be obtained using <see cref="GetJumpListSettingsAsync"/>.
|
/// omitted from the Jump List. The list of removed items can be obtained using <see cref="GetJumpListSettingsAsync"/>.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="categories">Array of <see cref="JumpListCategory"/> objects.</param>
|
/// <param name="categories">Array of <see cref="JumpListCategory"/> objects.</param>
|
||||||
|
[SupportedOSPlatform("Windows")]
|
||||||
public void SetJumpList(JumpListCategory[] categories)
|
public void SetJumpList(JumpListCategory[] categories)
|
||||||
{
|
{
|
||||||
this.CallMethod1(categories);
|
this.CallMethod1(categories);
|
||||||
@@ -941,7 +960,7 @@ namespace ElectronNET.API
|
|||||||
public async Task<bool> HasSingleInstanceLockAsync(CancellationToken cancellationToken = default)
|
public async Task<bool> HasSingleInstanceLockAsync(CancellationToken cancellationToken = default)
|
||||||
{
|
{
|
||||||
cancellationToken.ThrowIfCancellationRequested();
|
cancellationToken.ThrowIfCancellationRequested();
|
||||||
return await this.GetPropertyAsync<bool>().ConfigureAwait(false);
|
return await this.InvokeAsync<bool>().ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -951,6 +970,7 @@ namespace ElectronNET.API
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="type">Uniquely identifies the activity. Maps to <see href="https://developer.apple.com/library/ios/documentation/Foundation/Reference/NSUserActivity_Class/index.html#//apple_ref/occ/instp/NSUserActivity/activityType">NSUserActivity.activityType</see>.</param>
|
/// <param name="type">Uniquely identifies the activity. Maps to <see href="https://developer.apple.com/library/ios/documentation/Foundation/Reference/NSUserActivity_Class/index.html#//apple_ref/occ/instp/NSUserActivity/activityType">NSUserActivity.activityType</see>.</param>
|
||||||
/// <param name="userInfo">App-specific state to store for use by another device.</param>
|
/// <param name="userInfo">App-specific state to store for use by another device.</param>
|
||||||
|
[SupportedOSPlatform("macOS")]
|
||||||
public void SetUserActivity(string type, object userInfo)
|
public void SetUserActivity(string type, object userInfo)
|
||||||
{
|
{
|
||||||
SetUserActivity(type, userInfo, null);
|
SetUserActivity(type, userInfo, null);
|
||||||
@@ -968,6 +988,7 @@ namespace ElectronNET.API
|
|||||||
/// <param name="webpageUrl">
|
/// <param name="webpageUrl">
|
||||||
/// The webpage to load in a browser if no suitable app is installed on the resuming device. The scheme must be http or https.
|
/// The webpage to load in a browser if no suitable app is installed on the resuming device. The scheme must be http or https.
|
||||||
/// </param>
|
/// </param>
|
||||||
|
[SupportedOSPlatform("macOS")]
|
||||||
public void SetUserActivity(string type, object userInfo, string webpageUrl)
|
public void SetUserActivity(string type, object userInfo, string webpageUrl)
|
||||||
{
|
{
|
||||||
this.CallMethod3(type, userInfo, webpageUrl);
|
this.CallMethod3(type, userInfo, webpageUrl);
|
||||||
@@ -977,15 +998,17 @@ namespace ElectronNET.API
|
|||||||
/// The type of the currently running activity.
|
/// The type of the currently running activity.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="cancellationToken">The cancellation token.</param>
|
/// <param name="cancellationToken">The cancellation token.</param>
|
||||||
|
[SupportedOSPlatform("macOS")]
|
||||||
public async Task<string> GetCurrentActivityTypeAsync(CancellationToken cancellationToken = default)
|
public async Task<string> GetCurrentActivityTypeAsync(CancellationToken cancellationToken = default)
|
||||||
{
|
{
|
||||||
cancellationToken.ThrowIfCancellationRequested();
|
cancellationToken.ThrowIfCancellationRequested();
|
||||||
return await this.GetPropertyAsync<string>().ConfigureAwait(false);
|
return await this.InvokeAsync<string>().ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Invalidates the current <see href="https://developer.apple.com/library/ios/documentation/UserExperience/Conceptual/Handoff/HandoffFundamentals/HandoffFundamentals.html">Handoff</see> user activity.
|
/// Invalidates the current <see href="https://developer.apple.com/library/ios/documentation/UserExperience/Conceptual/Handoff/HandoffFundamentals/HandoffFundamentals.html">Handoff</see> user activity.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[SupportedOSPlatform("macOS")]
|
||||||
public void InvalidateCurrentActivity()
|
public void InvalidateCurrentActivity()
|
||||||
{
|
{
|
||||||
this.CallMethod0();
|
this.CallMethod0();
|
||||||
@@ -994,6 +1017,7 @@ namespace ElectronNET.API
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Marks the current <see href="https://developer.apple.com/library/ios/documentation/UserExperience/Conceptual/Handoff/HandoffFundamentals/HandoffFundamentals.html">Handoff</see> user activity as inactive without invalidating it.
|
/// Marks the current <see href="https://developer.apple.com/library/ios/documentation/UserExperience/Conceptual/Handoff/HandoffFundamentals/HandoffFundamentals.html">Handoff</see> user activity as inactive without invalidating it.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[SupportedOSPlatform("macOS")]
|
||||||
public void ResignCurrentActivity()
|
public void ResignCurrentActivity()
|
||||||
{
|
{
|
||||||
this.CallMethod0();
|
this.CallMethod0();
|
||||||
@@ -1003,6 +1027,7 @@ namespace ElectronNET.API
|
|||||||
/// Changes the <see href="https://msdn.microsoft.com/en-us/library/windows/desktop/dd378459(v=vs.85).aspx">Application User Model ID</see> to id.
|
/// Changes the <see href="https://msdn.microsoft.com/en-us/library/windows/desktop/dd378459(v=vs.85).aspx">Application User Model ID</see> to id.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="id">Model Id.</param>
|
/// <param name="id">Model Id.</param>
|
||||||
|
[SupportedOSPlatform("Windows")]
|
||||||
public void SetAppUserModelId(string id)
|
public void SetAppUserModelId(string id)
|
||||||
{
|
{
|
||||||
this.CallMethod1(id);
|
this.CallMethod1(id);
|
||||||
@@ -1017,6 +1042,7 @@ namespace ElectronNET.API
|
|||||||
/// <param name="options"></param>
|
/// <param name="options"></param>
|
||||||
/// <param name="cancellationToken">The cancellation token.</param>
|
/// <param name="cancellationToken">The cancellation token.</param>
|
||||||
/// <returns>Result of import. Value of 0 indicates success.</returns>
|
/// <returns>Result of import. Value of 0 indicates success.</returns>
|
||||||
|
[SupportedOSPlatform("Linux")]
|
||||||
public async Task<int> ImportCertificateAsync(ImportCertificateOptions options, CancellationToken cancellationToken = default)
|
public async Task<int> ImportCertificateAsync(ImportCertificateOptions options, CancellationToken cancellationToken = default)
|
||||||
{
|
{
|
||||||
cancellationToken.ThrowIfCancellationRequested();
|
cancellationToken.ThrowIfCancellationRequested();
|
||||||
@@ -1043,7 +1069,7 @@ namespace ElectronNET.API
|
|||||||
public async Task<ProcessMetric[]> GetAppMetricsAsync(CancellationToken cancellationToken = default)
|
public async Task<ProcessMetric[]> GetAppMetricsAsync(CancellationToken cancellationToken = default)
|
||||||
{
|
{
|
||||||
cancellationToken.ThrowIfCancellationRequested();
|
cancellationToken.ThrowIfCancellationRequested();
|
||||||
return await this.GetPropertyAsync<ProcessMetric[]>().ConfigureAwait(false);
|
return await this.InvokeAsync<ProcessMetric[]>().ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -1055,7 +1081,7 @@ namespace ElectronNET.API
|
|||||||
public async Task<GPUFeatureStatus> GetGpuFeatureStatusAsync(CancellationToken cancellationToken = default)
|
public async Task<GPUFeatureStatus> GetGpuFeatureStatusAsync(CancellationToken cancellationToken = default)
|
||||||
{
|
{
|
||||||
cancellationToken.ThrowIfCancellationRequested();
|
cancellationToken.ThrowIfCancellationRequested();
|
||||||
return await this.GetPropertyAsync<GPUFeatureStatus>().ConfigureAwait(false);
|
return await this.InvokeAsync<GPUFeatureStatus>().ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -1068,6 +1094,8 @@ namespace ElectronNET.API
|
|||||||
/// <param name="count">Counter badge.</param>
|
/// <param name="count">Counter badge.</param>
|
||||||
/// <param name="cancellationToken">The cancellation token.</param>
|
/// <param name="cancellationToken">The cancellation token.</param>
|
||||||
/// <returns>Whether the call succeeded.</returns>
|
/// <returns>Whether the call succeeded.</returns>
|
||||||
|
[SupportedOSPlatform("Linux")]
|
||||||
|
[SupportedOSPlatform("macOS")]
|
||||||
public async Task<bool> SetBadgeCountAsync(int count, CancellationToken cancellationToken = default)
|
public async Task<bool> SetBadgeCountAsync(int count, CancellationToken cancellationToken = default)
|
||||||
{
|
{
|
||||||
cancellationToken.ThrowIfCancellationRequested();
|
cancellationToken.ThrowIfCancellationRequested();
|
||||||
@@ -1087,10 +1115,12 @@ namespace ElectronNET.API
|
|||||||
/// The current value displayed in the counter badge.
|
/// The current value displayed in the counter badge.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="cancellationToken">The cancellation token.</param>
|
/// <param name="cancellationToken">The cancellation token.</param>
|
||||||
|
[SupportedOSPlatform("Linux")]
|
||||||
|
[SupportedOSPlatform("macOS")]
|
||||||
public async Task<int> GetBadgeCountAsync(CancellationToken cancellationToken = default)
|
public async Task<int> GetBadgeCountAsync(CancellationToken cancellationToken = default)
|
||||||
{
|
{
|
||||||
cancellationToken.ThrowIfCancellationRequested();
|
cancellationToken.ThrowIfCancellationRequested();
|
||||||
return await this.GetPropertyAsync<int>().ConfigureAwait(false);
|
return await this.InvokeAsync<int>().ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -1102,16 +1132,19 @@ namespace ElectronNET.API
|
|||||||
/// Whether the current desktop environment is Unity launcher.
|
/// Whether the current desktop environment is Unity launcher.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="cancellationToken">The cancellation token.</param>
|
/// <param name="cancellationToken">The cancellation token.</param>
|
||||||
|
[SupportedOSPlatform("Linux")]
|
||||||
public async Task<bool> IsUnityRunningAsync(CancellationToken cancellationToken = default)
|
public async Task<bool> IsUnityRunningAsync(CancellationToken cancellationToken = default)
|
||||||
{
|
{
|
||||||
cancellationToken.ThrowIfCancellationRequested();
|
cancellationToken.ThrowIfCancellationRequested();
|
||||||
return await this.GetPropertyAsync<bool>().ConfigureAwait(false);
|
return await this.InvokeAsync<bool>().ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// If you provided path and args options to <see cref="SetLoginItemSettings"/> then you need to pass the same
|
/// If you provided path and args options to <see cref="SetLoginItemSettings"/> then you need to pass the same
|
||||||
/// arguments here for <see cref="LoginItemSettings.OpenAtLogin"/> to be set correctly.
|
/// arguments here for <see cref="LoginItemSettings.OpenAtLogin"/> to be set correctly.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[SupportedOSPlatform("macOS")]
|
||||||
|
[SupportedOSPlatform("Windows")]
|
||||||
public async Task<LoginItemSettings> GetLoginItemSettingsAsync(CancellationToken cancellationToken = default)
|
public async Task<LoginItemSettings> GetLoginItemSettingsAsync(CancellationToken cancellationToken = default)
|
||||||
{
|
{
|
||||||
return await this.GetLoginItemSettingsAsync(null, cancellationToken).ConfigureAwait(false);
|
return await this.GetLoginItemSettingsAsync(null, cancellationToken).ConfigureAwait(false);
|
||||||
@@ -1123,6 +1156,8 @@ namespace ElectronNET.API
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="options"></param>
|
/// <param name="options"></param>
|
||||||
/// <param name="cancellationToken">The cancellation token.</param>
|
/// <param name="cancellationToken">The cancellation token.</param>
|
||||||
|
[SupportedOSPlatform("macOS")]
|
||||||
|
[SupportedOSPlatform("Windows")]
|
||||||
public async Task<LoginItemSettings> GetLoginItemSettingsAsync(LoginItemSettingsOptions options, CancellationToken cancellationToken = default)
|
public async Task<LoginItemSettings> GetLoginItemSettingsAsync(LoginItemSettingsOptions options, CancellationToken cancellationToken = default)
|
||||||
{
|
{
|
||||||
cancellationToken.ThrowIfCancellationRequested();
|
cancellationToken.ThrowIfCancellationRequested();
|
||||||
@@ -1152,6 +1187,8 @@ namespace ElectronNET.API
|
|||||||
/// you'll want to set the launch path to Update.exe, and pass arguments that specify your application name.
|
/// you'll want to set the launch path to Update.exe, and pass arguments that specify your application name.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="loginSettings"></param>
|
/// <param name="loginSettings"></param>
|
||||||
|
[SupportedOSPlatform("macOS")]
|
||||||
|
[SupportedOSPlatform("Windows")]
|
||||||
public void SetLoginItemSettings(LoginSettings loginSettings)
|
public void SetLoginItemSettings(LoginSettings loginSettings)
|
||||||
{
|
{
|
||||||
this.CallMethod1(loginSettings);
|
this.CallMethod1(loginSettings);
|
||||||
@@ -1163,10 +1200,12 @@ namespace ElectronNET.API
|
|||||||
/// See <see href="chromium.org/developers/design-documents/accessibility">Chromium's accessibility docs</see> for more details.
|
/// See <see href="chromium.org/developers/design-documents/accessibility">Chromium's accessibility docs</see> for more details.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns><see langword="true"/> if Chrome’s accessibility support is enabled, <see langword="false"/> otherwise.</returns>
|
/// <returns><see langword="true"/> if Chrome’s accessibility support is enabled, <see langword="false"/> otherwise.</returns>
|
||||||
|
[SupportedOSPlatform("macOS")]
|
||||||
|
[SupportedOSPlatform("Windows")]
|
||||||
public async Task<bool> IsAccessibilitySupportEnabledAsync(CancellationToken cancellationToken = default)
|
public async Task<bool> IsAccessibilitySupportEnabledAsync(CancellationToken cancellationToken = default)
|
||||||
{
|
{
|
||||||
cancellationToken.ThrowIfCancellationRequested();
|
cancellationToken.ThrowIfCancellationRequested();
|
||||||
return await this.GetPropertyAsync<bool>().ConfigureAwait(false);
|
return await this.InvokeAsync<bool>().ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -1179,6 +1218,8 @@ namespace ElectronNET.API
|
|||||||
/// Note: Rendering accessibility tree can significantly affect the performance of your app. It should not be enabled by default.
|
/// Note: Rendering accessibility tree can significantly affect the performance of your app. It should not be enabled by default.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="enabled">Enable or disable <see href="https://developers.google.com/web/fundamentals/accessibility/semantics-builtin/the-accessibility-tree">accessibility tree</see> rendering.</param>
|
/// <param name="enabled">Enable or disable <see href="https://developers.google.com/web/fundamentals/accessibility/semantics-builtin/the-accessibility-tree">accessibility tree</see> rendering.</param>
|
||||||
|
[SupportedOSPlatform("macOS")]
|
||||||
|
[SupportedOSPlatform("Windows")]
|
||||||
public void SetAccessibilitySupportEnabled(bool enabled)
|
public void SetAccessibilitySupportEnabled(bool enabled)
|
||||||
{
|
{
|
||||||
this.CallMethod1(enabled);
|
this.CallMethod1(enabled);
|
||||||
@@ -1245,7 +1286,7 @@ namespace ElectronNET.API
|
|||||||
return Task.Run(() =>
|
return Task.Run(() =>
|
||||||
{
|
{
|
||||||
var taskCompletionSource = new TaskCompletionSource<string>();
|
var taskCompletionSource = new TaskCompletionSource<string>();
|
||||||
|
|
||||||
BridgeConnector.Socket.Once<string>("appGetUserAgentFallbackCompleted", taskCompletionSource.SetResult);
|
BridgeConnector.Socket.Once<string>("appGetUserAgentFallbackCompleted", taskCompletionSource.SetResult);
|
||||||
BridgeConnector.Socket.Emit("appGetUserAgentFallback");
|
BridgeConnector.Socket.Emit("appGetUserAgentFallback");
|
||||||
|
|
||||||
@@ -1295,4 +1336,4 @@ namespace ElectronNET.API
|
|||||||
public async Task Once(string eventName, Action<object> action)
|
public async Task Once(string eventName, Action<object> action)
|
||||||
=> await Events.Instance.Once(ModuleName, eventName, action).ConfigureAwait(false);
|
=> await Events.Instance.Once(ModuleName, eventName, action).ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -10,7 +10,7 @@ namespace ElectronNET.API
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Enable apps to automatically update themselves. Based on electron-updater.
|
/// Enable apps to automatically update themselves. Based on electron-updater.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public sealed class AutoUpdater: ApiBase
|
public sealed class AutoUpdater : ApiBase
|
||||||
{
|
{
|
||||||
protected override SocketTaskEventNameTypes SocketTaskEventNameType => SocketTaskEventNameTypes.DashesLowerFirst;
|
protected override SocketTaskEventNameTypes SocketTaskEventNameType => SocketTaskEventNameTypes.DashesLowerFirst;
|
||||||
protected override SocketTaskMessageNameTypes SocketTaskMessageNameType => SocketTaskMessageNameTypes.DashesLowerFirst;
|
protected override SocketTaskMessageNameTypes SocketTaskMessageNameType => SocketTaskMessageNameTypes.DashesLowerFirst;
|
||||||
@@ -23,7 +23,7 @@ namespace ElectronNET.API
|
|||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return Task.Run(() => GetPropertyAsync<bool>()).Result;
|
return Task.Run(() => this.InvokeAsync<bool>()).Result;
|
||||||
}
|
}
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
@@ -40,7 +40,7 @@ namespace ElectronNET.API
|
|||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return Task.Run(() => GetPropertyAsync<bool>()).Result;
|
return Task.Run(() => this.InvokeAsync<bool>()).Result;
|
||||||
}
|
}
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
@@ -49,7 +49,7 @@ namespace ElectronNET.API
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// *GitHub provider only.* Whether to allow update to pre-release versions.
|
/// *GitHub provider only.* Whether to allow update to pre-release versions.
|
||||||
/// Defaults to "true" if application version contains prerelease components (e.g. "0.12.1-alpha.1", here "alpha" is a prerelease component), otherwise "false".
|
/// Defaults to "true" if application version contains prerelease components (e.g. "0.12.1-alpha.1", here "alpha" is a prerelease component), otherwise "false".
|
||||||
///
|
///
|
||||||
/// If "true", downgrade will be allowed("allowDowngrade" will be set to "true").
|
/// If "true", downgrade will be allowed("allowDowngrade" will be set to "true").
|
||||||
@@ -58,7 +58,7 @@ namespace ElectronNET.API
|
|||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return Task.Run(() => GetPropertyAsync<bool>()).Result;
|
return Task.Run(() => this.InvokeAsync<bool>()).Result;
|
||||||
}
|
}
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
@@ -67,14 +67,14 @@ namespace ElectronNET.API
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// *GitHub provider only.*
|
/// *GitHub provider only.*
|
||||||
/// Get all release notes (from current version to latest), not just the latest (Default is false).
|
/// Get all release notes (from current version to latest), not just the latest (Default is false).
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool FullChangelog
|
public bool FullChangelog
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return Task.Run(() => GetPropertyAsync<bool>()).Result;
|
return Task.Run(() => this.InvokeAsync<bool>()).Result;
|
||||||
}
|
}
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
@@ -91,7 +91,7 @@ namespace ElectronNET.API
|
|||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return Task.Run(() => GetPropertyAsync<bool>()).Result;
|
return Task.Run(() => this.InvokeAsync<bool>()).Result;
|
||||||
}
|
}
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
@@ -106,7 +106,7 @@ namespace ElectronNET.API
|
|||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return Task.Run(() => GetPropertyAsync<string>()).Result;
|
return Task.Run(() => this.InvokeAsync<string>()).Result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -117,12 +117,12 @@ namespace ElectronNET.API
|
|||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return Task.Run(() => GetPropertyAsync<SemVer>());
|
return Task.Run(() => this.InvokeAsync<SemVer>());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Get the update channel. Not applicable for GitHub.
|
/// Get the update channel. Not applicable for GitHub.
|
||||||
/// Doesn’t return channel from the update configuration, only if was previously set.
|
/// Doesn’t return channel from the update configuration, only if was previously set.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Obsolete("Use the asynchronous version ChannelAsync instead")]
|
[Obsolete("Use the asynchronous version ChannelAsync instead")]
|
||||||
@@ -135,19 +135,19 @@ namespace ElectronNET.API
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Get the update channel. Not applicable for GitHub.
|
/// Get the update channel. Not applicable for GitHub.
|
||||||
/// Doesn’t return channel from the update configuration, only if was previously set.
|
/// Doesn’t return channel from the update configuration, only if was previously set.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public Task<string> ChannelAsync
|
public Task<string> ChannelAsync
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return Task.Run(() => GetPropertyAsync<string>());
|
return Task.Run(() => this.InvokeAsync<string>());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Set the update channel. Not applicable for GitHub.
|
/// Set the update channel. Not applicable for GitHub.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string SetChannel
|
public string SetChannel
|
||||||
{
|
{
|
||||||
@@ -165,7 +165,7 @@ namespace ElectronNET.API
|
|||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return Task.Run(() => GetPropertyAsync<Dictionary<string, string>>());
|
return Task.Run(() => this.InvokeAsync<Dictionary<string, string>>());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -199,7 +199,7 @@ namespace ElectronNET.API
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Emitted when there is an available update.
|
/// Emitted when there is an available update.
|
||||||
/// The update is downloaded automatically if AutoDownload is true.
|
/// The update is downloaded automatically if AutoDownload is true.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public event Action<UpdateInfo> OnUpdateAvailable
|
public event Action<UpdateInfo> OnUpdateAvailable
|
||||||
@@ -332,11 +332,11 @@ namespace ElectronNET.API
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Restarts the app and installs the update after it has been downloaded.
|
/// Restarts the app and installs the update after it has been downloaded.
|
||||||
/// It should only be called after `update-downloaded` has been emitted.
|
/// It should only be called after `update-downloaded` has been emitted.
|
||||||
///
|
///
|
||||||
/// Note: QuitAndInstall() will close all application windows first and only emit `before-quit` event on `app` after that.
|
/// Note: QuitAndInstall() will close all application windows first and only emit `before-quit` event on `app` after that.
|
||||||
/// This is different from the normal quit event sequence.
|
/// This is different from the normal quit event sequence.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="isSilent">*windows-only* Runs the installer in silent mode. Defaults to `false`.</param>
|
/// <param name="isSilent">*windows-only* Runs the installer in silent mode. Defaults to `false`.</param>
|
||||||
/// <param name="isForceRunAfter">Run the app after finish even on silent install. Not applicable for macOS. Ignored if `isSilent` is set to `false`.</param>
|
/// <param name="isForceRunAfter">Run the app after finish even on silent install. Not applicable for macOS. Ignored if `isSilent` is set to `false`.</param>
|
||||||
@@ -374,9 +374,5 @@ namespace ElectronNET.API
|
|||||||
|
|
||||||
return tcs.Task;
|
return tcs.Task;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -8,10 +8,11 @@ namespace ElectronNET.API
|
|||||||
/// It is like a child window, except that it is positioned relative to its owning window.
|
/// It is like a child window, except that it is positioned relative to its owning window.
|
||||||
/// It is meant to be an alternative to the webview tag.
|
/// It is meant to be an alternative to the webview tag.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class BrowserView: ApiBase
|
public class BrowserView : ApiBase
|
||||||
{
|
{
|
||||||
protected override SocketTaskEventNameTypes SocketTaskEventNameType => SocketTaskEventNameTypes.DashesLowerFirst;
|
protected override SocketTaskEventNameTypes SocketTaskEventNameType => SocketTaskEventNameTypes.DashesLowerFirst;
|
||||||
protected override SocketTaskMessageNameTypes SocketTaskMessageNameType => SocketTaskMessageNameTypes.DashesLowerFirst;
|
protected override SocketTaskMessageNameTypes SocketTaskMessageNameType => SocketTaskMessageNameTypes.DashesLowerFirst;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the identifier.
|
/// Gets the identifier.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -30,7 +31,7 @@ namespace ElectronNET.API
|
|||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return Task.Run(() => GetPropertyAsync<Rectangle>()).Result;
|
return Task.Run(() => this.InvokeAsync<Rectangle>()).Result;
|
||||||
}
|
}
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
@@ -69,5 +70,4 @@ namespace ElectronNET.API
|
|||||||
BridgeConnector.Socket.Emit("browserView-setBackgroundColor", Id, color);
|
BridgeConnector.Socket.Emit("browserView-setBackgroundColor", Id, color);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1,10 +1,11 @@
|
|||||||
using ElectronNET.API.Entities;
|
|
||||||
using ElectronNET.API.Extensions;
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
|
using System.Runtime.Versioning;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
using ElectronNET.API.Entities;
|
||||||
|
using ElectronNET.API.Extensions;
|
||||||
|
|
||||||
// ReSharper disable InconsistentNaming
|
// ReSharper disable InconsistentNaming
|
||||||
|
|
||||||
@@ -27,7 +28,7 @@ public class BrowserWindow : ApiBase
|
|||||||
public override int Id { get; protected set; }
|
public override int Id { get; protected set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Emitted when the web page has been rendered (while not being shown) and
|
/// Emitted when the web page has been rendered (while not being shown) and
|
||||||
/// window can be displayed without a visual flash.
|
/// window can be displayed without a visual flash.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public event Action OnReadyToShow
|
public event Action OnReadyToShow
|
||||||
@@ -55,8 +56,8 @@ public class BrowserWindow : ApiBase
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Emitted when the window is closed.
|
/// Emitted when the window is closed.
|
||||||
/// After you have received this event you should remove the
|
/// After you have received this event you should remove the
|
||||||
/// reference to the window and avoid using it any more.
|
/// reference to the window and avoid using it any more.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public event Action OnClosed
|
public event Action OnClosed
|
||||||
@@ -68,6 +69,7 @@ public class BrowserWindow : ApiBase
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Emitted when window session is going to end due to force shutdown or machine restart or session log off.
|
/// Emitted when window session is going to end due to force shutdown or machine restart or session log off.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[SupportedOSPlatform("Windows")]
|
||||||
public event Action OnSessionEnd
|
public event Action OnSessionEnd
|
||||||
{
|
{
|
||||||
add => AddEvent(value, Id);
|
add => AddEvent(value, Id);
|
||||||
@@ -184,9 +186,24 @@ public class BrowserWindow : ApiBase
|
|||||||
remove => RemoveEvent(value, Id);
|
remove => RemoveEvent(value, Id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Emitted when the window is moved or resized.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// While not being an original Electron event, this one includes the bounds values,
|
||||||
|
/// saving the additional roundtrip for calling <see cref="GetBoundsAsync"/>.
|
||||||
|
/// </remarks>
|
||||||
|
public event Action<Rectangle> OnBoundsChanged
|
||||||
|
{
|
||||||
|
add => AddEvent(value, Id);
|
||||||
|
remove => RemoveEvent(value, Id);
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// macOS: Emitted once when the window is moved to a new position.
|
/// macOS: Emitted once when the window is moved to a new position.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[SupportedOSPlatform("macOS")]
|
||||||
|
[SupportedOSPlatform("Windows")]
|
||||||
public event Action OnMoved
|
public event Action OnMoved
|
||||||
{
|
{
|
||||||
add => AddEvent(value, Id);
|
add => AddEvent(value, Id);
|
||||||
@@ -230,14 +247,16 @@ public class BrowserWindow : ApiBase
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Emitted when an App Command is invoked. These are typically related to
|
/// Emitted when an App Command is invoked. These are typically related to
|
||||||
/// keyboard media keys or browser commands, as well as the “Back” button
|
/// keyboard media keys or browser commands, as well as the “Back” button
|
||||||
/// built into some mice on Windows.
|
/// built into some mice on Windows.
|
||||||
///
|
///
|
||||||
/// Commands are lowercased, underscores are replaced with hyphens,
|
/// Commands are lowercased, underscores are replaced with hyphens,
|
||||||
/// and the APPCOMMAND_ prefix is stripped off.e.g.APPCOMMAND_BROWSER_BACKWARD
|
/// and the APPCOMMAND_ prefix is stripped off.e.g.APPCOMMAND_BROWSER_BACKWARD
|
||||||
/// is emitted as browser-backward.
|
/// is emitted as browser-backward.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[SupportedOSPlatform("Windows")]
|
||||||
|
[SupportedOSPlatform("Linux")]
|
||||||
public event Action<string> OnAppCommand
|
public event Action<string> OnAppCommand
|
||||||
{
|
{
|
||||||
add => AddEvent(value, Id);
|
add => AddEvent(value, Id);
|
||||||
@@ -247,6 +266,7 @@ public class BrowserWindow : ApiBase
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Emitted on 3-finger swipe. Possible directions are up, right, down, left.
|
/// Emitted on 3-finger swipe. Possible directions are up, right, down, left.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[SupportedOSPlatform("macOS")]
|
||||||
public event Action<string> OnSwipe
|
public event Action<string> OnSwipe
|
||||||
{
|
{
|
||||||
add => AddEvent(value, Id);
|
add => AddEvent(value, Id);
|
||||||
@@ -256,6 +276,7 @@ public class BrowserWindow : ApiBase
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Emitted when the window opens a sheet.
|
/// Emitted when the window opens a sheet.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[SupportedOSPlatform("macOS")]
|
||||||
public event Action OnSheetBegin
|
public event Action OnSheetBegin
|
||||||
{
|
{
|
||||||
add => AddEvent(value, Id);
|
add => AddEvent(value, Id);
|
||||||
@@ -265,6 +286,7 @@ public class BrowserWindow : ApiBase
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Emitted when the window has closed a sheet.
|
/// Emitted when the window has closed a sheet.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[SupportedOSPlatform("macOS")]
|
||||||
public event Action OnSheetEnd
|
public event Action OnSheetEnd
|
||||||
{
|
{
|
||||||
add => AddEvent(value, Id);
|
add => AddEvent(value, Id);
|
||||||
@@ -274,6 +296,7 @@ public class BrowserWindow : ApiBase
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Emitted when the native new tab button is clicked.
|
/// Emitted when the native new tab button is clicked.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[SupportedOSPlatform("macOS")]
|
||||||
public event Action OnNewWindowForTab
|
public event Action OnNewWindowForTab
|
||||||
{
|
{
|
||||||
add => AddEvent(value, Id);
|
add => AddEvent(value, Id);
|
||||||
@@ -287,15 +310,15 @@ public class BrowserWindow : ApiBase
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Force closing the window, the unload and beforeunload event won’t be
|
/// Force closing the window, the unload and beforeunload event won’t be
|
||||||
/// emitted for the web page, and close event will also not be emitted
|
/// emitted for the web page, and close event will also not be emitted
|
||||||
/// for this window, but it guarantees the closed event will be emitted.
|
/// for this window, but it guarantees the closed event will be emitted.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void Destroy() => this.CallMethod0();
|
public void Destroy() => this.CallMethod0();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Try to close the window. This has the same effect as a user manually
|
/// Try to close the window. This has the same effect as a user manually
|
||||||
/// clicking the close button of the window. The web page may cancel the close though.
|
/// clicking the close button of the window. The web page may cancel the close though.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void Close() => this.CallMethod0();
|
public void Close() => this.CallMethod0();
|
||||||
|
|
||||||
@@ -313,13 +336,13 @@ public class BrowserWindow : ApiBase
|
|||||||
/// Whether the window is focused.
|
/// Whether the window is focused.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public Task<bool> IsFocusedAsync() => this.GetPropertyAsync<bool>();
|
public Task<bool> IsFocusedAsync() => this.InvokeAsync<bool>();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Whether the window is destroyed.
|
/// Whether the window is destroyed.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public Task<bool> IsDestroyedAsync() => this.GetPropertyAsync<bool>();
|
public Task<bool> IsDestroyedAsync() => this.InvokeAsync<bool>();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Shows and gives focus to the window.
|
/// Shows and gives focus to the window.
|
||||||
@@ -340,13 +363,13 @@ public class BrowserWindow : ApiBase
|
|||||||
/// Whether the window is visible to the user.
|
/// Whether the window is visible to the user.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public Task<bool> IsVisibleAsync() => this.GetPropertyAsync<bool>();
|
public Task<bool> IsVisibleAsync() => this.InvokeAsync<bool>();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Whether current window is a modal window.
|
/// Whether current window is a modal window.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public Task<bool> IsModalAsync() => this.GetPropertyAsync<bool>();
|
public Task<bool> IsModalAsync() => this.InvokeAsync<bool>();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Maximizes the window. This will also show (but not focus) the window if it isn’t being displayed already.
|
/// Maximizes the window. This will also show (but not focus) the window if it isn’t being displayed already.
|
||||||
@@ -362,7 +385,7 @@ public class BrowserWindow : ApiBase
|
|||||||
/// Whether the window is maximized.
|
/// Whether the window is maximized.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public Task<bool> IsMaximizedAsync() => this.GetPropertyAsync<bool>();
|
public Task<bool> IsMaximizedAsync() => this.InvokeAsync<bool>();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Minimizes the window. On some platforms the minimized window will be shown in the Dock.
|
/// Minimizes the window. On some platforms the minimized window will be shown in the Dock.
|
||||||
@@ -378,7 +401,7 @@ public class BrowserWindow : ApiBase
|
|||||||
/// Whether the window is minimized.
|
/// Whether the window is minimized.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public Task<bool> IsMinimizedAsync() => this.GetPropertyAsync<bool>();
|
public Task<bool> IsMinimizedAsync() => this.InvokeAsync<bool>();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Sets whether the window should be in fullscreen mode.
|
/// Sets whether the window should be in fullscreen mode.
|
||||||
@@ -390,10 +413,10 @@ public class BrowserWindow : ApiBase
|
|||||||
/// Whether the window is in fullscreen mode.
|
/// Whether the window is in fullscreen mode.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public Task<bool> IsFullScreenAsync() => this.GetPropertyAsync<bool>();
|
public Task<bool> IsFullScreenAsync() => this.InvokeAsync<bool>();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// This will make a window maintain an aspect ratio. The extra size allows a developer to have space,
|
/// This will make a window maintain an aspect ratio. The extra size allows a developer to have space,
|
||||||
/// specified in pixels, not included within the aspect ratio calculations. This API already takes into
|
/// specified in pixels, not included within the aspect ratio calculations. This API already takes into
|
||||||
/// account the difference between a window’s size and its content size.
|
/// account the difference between a window’s size and its content size.
|
||||||
///
|
///
|
||||||
@@ -401,7 +424,7 @@ public class BrowserWindow : ApiBase
|
|||||||
/// of controls on the left edge, 25 pixels of controls on the right edge and 50 pixels of controls below
|
/// of controls on the left edge, 25 pixels of controls on the right edge and 50 pixels of controls below
|
||||||
/// the player. In order to maintain a 16:9 aspect ratio (standard aspect ratio for HD @1920x1080) within
|
/// the player. In order to maintain a 16:9 aspect ratio (standard aspect ratio for HD @1920x1080) within
|
||||||
/// the player itself we would call this function with arguments of 16/9 and[40, 50]. The second argument
|
/// the player itself we would call this function with arguments of 16/9 and[40, 50]. The second argument
|
||||||
/// doesn’t care where the extra width and height are within the content view–only that they exist. Just
|
/// doesn’t care where the extra width and height are within the content view–only that they exist. Just
|
||||||
/// sum any extra width and height areas you have within the overall content view.
|
/// sum any extra width and height areas you have within the overall content view.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="aspectRatio">The aspect ratio to maintain for some portion of the content view.</param>
|
/// <param name="aspectRatio">The aspect ratio to maintain for some portion of the content view.</param>
|
||||||
@@ -410,7 +433,7 @@ public class BrowserWindow : ApiBase
|
|||||||
this.CallMethod2(aspectRatio, extraSize);
|
this.CallMethod2(aspectRatio, extraSize);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// This will make a window maintain an aspect ratio. The extra size allows a developer to have space,
|
/// This will make a window maintain an aspect ratio. The extra size allows a developer to have space,
|
||||||
/// specified in pixels, not included within the aspect ratio calculations. This API already takes into
|
/// specified in pixels, not included within the aspect ratio calculations. This API already takes into
|
||||||
/// account the difference between a window’s size and its content size.
|
/// account the difference between a window’s size and its content size.
|
||||||
///
|
///
|
||||||
@@ -418,7 +441,7 @@ public class BrowserWindow : ApiBase
|
|||||||
/// of controls on the left edge, 25 pixels of controls on the right edge and 50 pixels of controls below
|
/// of controls on the left edge, 25 pixels of controls on the right edge and 50 pixels of controls below
|
||||||
/// the player. In order to maintain a 16:9 aspect ratio (standard aspect ratio for HD @1920x1080) within
|
/// the player. In order to maintain a 16:9 aspect ratio (standard aspect ratio for HD @1920x1080) within
|
||||||
/// the player itself we would call this function with arguments of 16/9 and[40, 50]. The second argument
|
/// the player itself we would call this function with arguments of 16/9 and[40, 50]. The second argument
|
||||||
/// doesn’t care where the extra width and height are within the content view–only that they exist. Just
|
/// doesn’t care where the extra width and height are within the content view–only that they exist. Just
|
||||||
/// sum any extra width and height areas you have within the overall content view.
|
/// sum any extra width and height areas you have within the overall content view.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="aspectRatio">The aspect ratio to maintain for some portion of the content view.</param>
|
/// <param name="aspectRatio">The aspect ratio to maintain for some portion of the content view.</param>
|
||||||
@@ -429,24 +452,27 @@ public class BrowserWindow : ApiBase
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Uses Quick Look to preview a file at a given path.
|
/// Uses Quick Look to preview a file at a given path.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="path">The absolute path to the file to preview with QuickLook. This is important as
|
/// <param name="path">The absolute path to the file to preview with QuickLook. This is important as
|
||||||
/// Quick Look uses the file name and file extension on the path to determine the content type of the
|
/// Quick Look uses the file name and file extension on the path to determine the content type of the
|
||||||
/// file to open.</param>
|
/// file to open.</param>
|
||||||
|
[SupportedOSPlatform("macOS")]
|
||||||
public void PreviewFile(string path) => this.CallMethod1(path);
|
public void PreviewFile(string path) => this.CallMethod1(path);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Uses Quick Look to preview a file at a given path.
|
/// Uses Quick Look to preview a file at a given path.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="path">The absolute path to the file to preview with QuickLook. This is important as
|
/// <param name="path">The absolute path to the file to preview with QuickLook. This is important as
|
||||||
/// Quick Look uses the file name and file extension on the path to determine the content type of the
|
/// Quick Look uses the file name and file extension on the path to determine the content type of the
|
||||||
/// file to open.</param>
|
/// file to open.</param>
|
||||||
/// <param name="displayname">The name of the file to display on the Quick Look modal view. This is
|
/// <param name="displayname">The name of the file to display on the Quick Look modal view. This is
|
||||||
/// purely visual and does not affect the content type of the file. Defaults to path.</param>
|
/// purely visual and does not affect the content type of the file. Defaults to path.</param>
|
||||||
|
[SupportedOSPlatform("macOS")]
|
||||||
public void PreviewFile(string path, string displayname) => this.CallMethod2(path, displayname);
|
public void PreviewFile(string path, string displayname) => this.CallMethod2(path, displayname);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Closes the currently open Quick Look panel.
|
/// Closes the currently open Quick Look panel.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[SupportedOSPlatform("macOS")]
|
||||||
public void CloseFilePreview() => this.CallMethod0();
|
public void CloseFilePreview() => this.CallMethod0();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -466,7 +492,7 @@ public class BrowserWindow : ApiBase
|
|||||||
/// Gets the bounds asynchronous.
|
/// Gets the bounds asynchronous.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public Task<Rectangle> GetBoundsAsync() => this.GetPropertyAsync<Rectangle>();
|
public Task<Rectangle> GetBoundsAsync() => this.InvokeAsync<Rectangle>();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Resizes and moves the window’s client area (e.g. the web page) to the supplied bounds.
|
/// Resizes and moves the window’s client area (e.g. the web page) to the supplied bounds.
|
||||||
@@ -485,7 +511,7 @@ public class BrowserWindow : ApiBase
|
|||||||
/// Gets the content bounds asynchronous.
|
/// Gets the content bounds asynchronous.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public Task<Rectangle> GetContentBoundsAsync() => this.GetPropertyAsync<Rectangle>();
|
public Task<Rectangle> GetContentBoundsAsync() => this.InvokeAsync<Rectangle>();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Resizes the window to width and height.
|
/// Resizes the window to width and height.
|
||||||
@@ -506,7 +532,7 @@ public class BrowserWindow : ApiBase
|
|||||||
/// Contains the window’s width and height.
|
/// Contains the window’s width and height.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public Task<int[]> GetSizeAsync() => this.GetPropertyAsync<int[]>();
|
public Task<int[]> GetSizeAsync() => this.InvokeAsync<int[]>();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Resizes the window’s client area (e.g. the web page) to width and height.
|
/// Resizes the window’s client area (e.g. the web page) to width and height.
|
||||||
@@ -527,7 +553,7 @@ public class BrowserWindow : ApiBase
|
|||||||
/// Contains the window’s client area’s width and height.
|
/// Contains the window’s client area’s width and height.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public Task<int[]> GetContentSizeAsync() => this.GetPropertyAsync<int[]>();
|
public Task<int[]> GetContentSizeAsync() => this.InvokeAsync<int[]>();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Sets the minimum size of window to width and height.
|
/// Sets the minimum size of window to width and height.
|
||||||
@@ -540,7 +566,7 @@ public class BrowserWindow : ApiBase
|
|||||||
/// Contains the window’s minimum width and height.
|
/// Contains the window’s minimum width and height.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public Task<int[]> GetMinimumSizeAsync() => this.GetPropertyAsync<int[]>();
|
public Task<int[]> GetMinimumSizeAsync() => this.InvokeAsync<int[]>();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Sets the maximum size of window to width and height.
|
/// Sets the maximum size of window to width and height.
|
||||||
@@ -553,7 +579,7 @@ public class BrowserWindow : ApiBase
|
|||||||
/// Contains the window’s maximum width and height.
|
/// Contains the window’s maximum width and height.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public Task<int[]> GetMaximumSizeAsync() => this.GetPropertyAsync<int[]>();
|
public Task<int[]> GetMaximumSizeAsync() => this.InvokeAsync<int[]>();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Sets whether the window can be manually resized by user.
|
/// Sets whether the window can be manually resized by user.
|
||||||
@@ -565,12 +591,14 @@ public class BrowserWindow : ApiBase
|
|||||||
/// Whether the window can be manually resized by user.
|
/// Whether the window can be manually resized by user.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public Task<bool> IsResizableAsync() => this.GetPropertyAsync<bool>();
|
public Task<bool> IsResizableAsync() => this.InvokeAsync<bool>();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Sets whether the window can be moved by user. On Linux does nothing.
|
/// Sets whether the window can be moved by user. On Linux does nothing.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="movable"></param>
|
/// <param name="movable"></param>
|
||||||
|
[SupportedOSPlatform("macOS")]
|
||||||
|
[SupportedOSPlatform("Windows")]
|
||||||
public void SetMovable(bool movable) => this.CallMethod1(movable);
|
public void SetMovable(bool movable) => this.CallMethod1(movable);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -579,12 +607,16 @@ public class BrowserWindow : ApiBase
|
|||||||
/// On Linux always returns true.
|
/// On Linux always returns true.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns>On Linux always returns true.</returns>
|
/// <returns>On Linux always returns true.</returns>
|
||||||
public Task<bool> IsMovableAsync() => this.GetPropertyAsync<bool>();
|
[SupportedOSPlatform("macOS")]
|
||||||
|
[SupportedOSPlatform("Windows")]
|
||||||
|
public Task<bool> IsMovableAsync() => this.InvokeAsync<bool>();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Sets whether the window can be manually minimized by user. On Linux does nothing.
|
/// Sets whether the window can be manually minimized by user. On Linux does nothing.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="minimizable"></param>
|
/// <param name="minimizable"></param>
|
||||||
|
[SupportedOSPlatform("macOS")]
|
||||||
|
[SupportedOSPlatform("Windows")]
|
||||||
public void SetMinimizable(bool minimizable) => this.CallMethod1(minimizable);
|
public void SetMinimizable(bool minimizable) => this.CallMethod1(minimizable);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -593,12 +625,16 @@ public class BrowserWindow : ApiBase
|
|||||||
/// On Linux always returns true.
|
/// On Linux always returns true.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns>On Linux always returns true.</returns>
|
/// <returns>On Linux always returns true.</returns>
|
||||||
public Task<bool> IsMinimizableAsync() => this.GetPropertyAsync<bool>();
|
[SupportedOSPlatform("macOS")]
|
||||||
|
[SupportedOSPlatform("Windows")]
|
||||||
|
public Task<bool> IsMinimizableAsync() => this.InvokeAsync<bool>();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Sets whether the window can be manually maximized by user. On Linux does nothing.
|
/// Sets whether the window can be manually maximized by user. On Linux does nothing.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="maximizable"></param>
|
/// <param name="maximizable"></param>
|
||||||
|
[SupportedOSPlatform("macOS")]
|
||||||
|
[SupportedOSPlatform("Windows")]
|
||||||
public void SetMaximizable(bool maximizable) => this.CallMethod1(maximizable);
|
public void SetMaximizable(bool maximizable) => this.CallMethod1(maximizable);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -607,7 +643,9 @@ public class BrowserWindow : ApiBase
|
|||||||
/// On Linux always returns true.
|
/// On Linux always returns true.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns>On Linux always returns true.</returns>
|
/// <returns>On Linux always returns true.</returns>
|
||||||
public Task<bool> IsMaximizableAsync() => this.GetPropertyAsync<bool>();
|
[SupportedOSPlatform("macOS")]
|
||||||
|
[SupportedOSPlatform("Windows")]
|
||||||
|
public Task<bool> IsMaximizableAsync() => this.InvokeAsync<bool>();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Sets whether the maximize/zoom window button toggles fullscreen mode or maximizes the window.
|
/// Sets whether the maximize/zoom window button toggles fullscreen mode or maximizes the window.
|
||||||
@@ -619,12 +657,14 @@ public class BrowserWindow : ApiBase
|
|||||||
/// Whether the maximize/zoom window button toggles fullscreen mode or maximizes the window.
|
/// Whether the maximize/zoom window button toggles fullscreen mode or maximizes the window.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public Task<bool> IsFullScreenableAsync() => this.GetPropertyAsync<bool>();
|
public Task<bool> IsFullScreenableAsync() => this.InvokeAsync<bool>();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Sets whether the window can be manually closed by user. On Linux does nothing.
|
/// Sets whether the window can be manually closed by user. On Linux does nothing.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="closable"></param>
|
/// <param name="closable"></param>
|
||||||
|
[SupportedOSPlatform("macOS")]
|
||||||
|
[SupportedOSPlatform("Windows")]
|
||||||
public void SetClosable(bool closable) => this.CallMethod1(closable);
|
public void SetClosable(bool closable) => this.CallMethod1(closable);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -633,45 +673,47 @@ public class BrowserWindow : ApiBase
|
|||||||
/// On Linux always returns true.
|
/// On Linux always returns true.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns>On Linux always returns true.</returns>
|
/// <returns>On Linux always returns true.</returns>
|
||||||
public Task<bool> IsClosableAsync() => this.GetPropertyAsync<bool>();
|
[SupportedOSPlatform("macOS")]
|
||||||
|
[SupportedOSPlatform("Windows")]
|
||||||
|
public Task<bool> IsClosableAsync() => this.InvokeAsync<bool>();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Sets whether the window should show always on top of other windows.
|
/// Sets whether the window should show always on top of other windows.
|
||||||
/// After setting this, the window is still a normal window, not a toolbox
|
/// After setting this, the window is still a normal window, not a toolbox
|
||||||
/// window which can not be focused on.
|
/// window which can not be focused on.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="flag"></param>
|
/// <param name="flag"></param>
|
||||||
public void SetAlwaysOnTop(bool flag) => this.CallMethod1(flag);
|
public void SetAlwaysOnTop(bool flag) => this.CallMethod1(flag);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Sets whether the window should show always on top of other windows.
|
/// Sets whether the window should show always on top of other windows.
|
||||||
/// After setting this, the window is still a normal window, not a toolbox
|
/// After setting this, the window is still a normal window, not a toolbox
|
||||||
/// window which can not be focused on.
|
/// window which can not be focused on.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="flag"></param>
|
/// <param name="flag"></param>
|
||||||
/// <param name="level">Values include normal, floating, torn-off-menu, modal-panel, main-menu,
|
/// <param name="level">Values include normal, floating, torn-off-menu, modal-panel, main-menu,
|
||||||
/// status, pop-up-menu and screen-saver. The default is floating.
|
/// status, pop-up-menu and screen-saver. The default is floating.
|
||||||
/// See the macOS docs</param>
|
/// See the macOS docs</param>
|
||||||
public void SetAlwaysOnTop(bool flag, OnTopLevel level) => this.CallMethod2(flag, level.GetDescription());
|
public void SetAlwaysOnTop(bool flag, OnTopLevel level) => this.CallMethod2(flag, level);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Sets whether the window should show always on top of other windows.
|
/// Sets whether the window should show always on top of other windows.
|
||||||
/// After setting this, the window is still a normal window, not a toolbox
|
/// After setting this, the window is still a normal window, not a toolbox
|
||||||
/// window which can not be focused on.
|
/// window which can not be focused on.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="flag"></param>
|
/// <param name="flag"></param>
|
||||||
/// <param name="level">Values include normal, floating, torn-off-menu, modal-panel, main-menu,
|
/// <param name="level">Values include normal, floating, torn-off-menu, modal-panel, main-menu,
|
||||||
/// status, pop-up-menu and screen-saver. The default is floating.
|
/// status, pop-up-menu and screen-saver. The default is floating.
|
||||||
/// See the macOS docs</param>
|
/// See the macOS docs</param>
|
||||||
/// <param name="relativeLevel">The number of layers higher to set this window relative to the given level.
|
/// <param name="relativeLevel">The number of layers higher to set this window relative to the given level.
|
||||||
/// The default is 0. Note that Apple discourages setting levels higher than 1 above screen-saver.</param>
|
/// The default is 0. Note that Apple discourages setting levels higher than 1 above screen-saver.</param>
|
||||||
public void SetAlwaysOnTop(bool flag, OnTopLevel level, int relativeLevel) => this.CallMethod3(flag, level.GetDescription(), relativeLevel);
|
public void SetAlwaysOnTop(bool flag, OnTopLevel level, int relativeLevel) => this.CallMethod3(flag, level, relativeLevel);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Whether the window is always on top of other windows.
|
/// Whether the window is always on top of other windows.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public Task<bool> IsAlwaysOnTopAsync() => this.GetPropertyAsync<bool>();
|
public Task<bool> IsAlwaysOnTopAsync() => this.InvokeAsync<bool>();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Moves window to the center of the screen.
|
/// Moves window to the center of the screen.
|
||||||
@@ -721,7 +763,7 @@ public class BrowserWindow : ApiBase
|
|||||||
/// Contains the window’s current position.
|
/// Contains the window’s current position.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public Task<int[]> GetPositionAsync() => this.GetPropertyAsync<int[]>();
|
public Task<int[]> GetPositionAsync() => this.InvokeAsync<int[]>();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Changes the title of native window to title.
|
/// Changes the title of native window to title.
|
||||||
@@ -735,23 +777,25 @@ public class BrowserWindow : ApiBase
|
|||||||
/// Note: The title of web page can be different from the title of the native window.
|
/// Note: The title of web page can be different from the title of the native window.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public Task<string> GetTitleAsync() => this.GetPropertyAsync<string>();
|
public Task<string> GetTitleAsync() => this.InvokeAsync<string>();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Changes the attachment point for sheets on macOS.
|
/// Changes the attachment point for sheets on macOS.
|
||||||
/// By default, sheets are attached just below the window frame,
|
/// By default, sheets are attached just below the window frame,
|
||||||
/// but you may want to display them beneath a HTML-rendered toolbar.
|
/// but you may want to display them beneath a HTML-rendered toolbar.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="offsetY"></param>
|
/// <param name="offsetY"></param>
|
||||||
|
[SupportedOSPlatform("macOS")]
|
||||||
public void SetSheetOffset(float offsetY) => this.CallMethod1(offsetY);
|
public void SetSheetOffset(float offsetY) => this.CallMethod1(offsetY);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Changes the attachment point for sheets on macOS.
|
/// Changes the attachment point for sheets on macOS.
|
||||||
/// By default, sheets are attached just below the window frame,
|
/// By default, sheets are attached just below the window frame,
|
||||||
/// but you may want to display them beneath a HTML-rendered toolbar.
|
/// but you may want to display them beneath a HTML-rendered toolbar.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="offsetY"></param>
|
/// <param name="offsetY"></param>
|
||||||
/// <param name="offsetX"></param>
|
/// <param name="offsetX"></param>
|
||||||
|
[SupportedOSPlatform("macOS")]
|
||||||
public void SetSheetOffset(float offsetY, float offsetX) => this.CallMethod2(offsetY, offsetX);
|
public void SetSheetOffset(float offsetY, float offsetX) => this.CallMethod2(offsetY, offsetX);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -764,6 +808,8 @@ public class BrowserWindow : ApiBase
|
|||||||
/// Makes the window not show in the taskbar.
|
/// Makes the window not show in the taskbar.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="skip"></param>
|
/// <param name="skip"></param>
|
||||||
|
[SupportedOSPlatform("macOS")]
|
||||||
|
[SupportedOSPlatform("Windows")]
|
||||||
public void SetSkipTaskbar(bool skip) => this.CallMethod1(skip);
|
public void SetSkipTaskbar(bool skip) => this.CallMethod1(skip);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -776,39 +822,43 @@ public class BrowserWindow : ApiBase
|
|||||||
/// Whether the window is in kiosk mode.
|
/// Whether the window is in kiosk mode.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public Task<bool> IsKioskAsync() => this.GetPropertyAsync<bool>();
|
public Task<bool> IsKioskAsync() => this.InvokeAsync<bool>();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Returns the native type of the handle is HWND on Windows, NSView* on macOS, and Window (unsigned long) on Linux.
|
/// Returns the native type of the handle is HWND on Windows, NSView* on macOS, and Window (unsigned long) on Linux.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns>string of the native handle obtained, HWND on Windows, NSView* on macOS, and Window (unsigned long) on Linux.</returns>
|
/// <returns>string of the native handle obtained, HWND on Windows, NSView* on macOS, and Window (unsigned long) on Linux.</returns>
|
||||||
public Task<string> GetNativeWindowHandle() => this.GetPropertyAsync<string>();
|
public Task<string> GetNativeWindowHandle() => this.InvokeAsync<string>();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Sets the pathname of the file the window represents,
|
/// Sets the pathname of the file the window represents,
|
||||||
/// and the icon of the file will show in window’s title bar.
|
/// and the icon of the file will show in window’s title bar.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="filename"></param>
|
/// <param name="filename"></param>
|
||||||
|
[SupportedOSPlatform("macOS")]
|
||||||
public void SetRepresentedFilename(string filename) => this.CallMethod1(filename);
|
public void SetRepresentedFilename(string filename) => this.CallMethod1(filename);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The pathname of the file the window represents.
|
/// The pathname of the file the window represents.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public Task<string> GetRepresentedFilenameAsync() => this.GetPropertyAsync<string>();
|
[SupportedOSPlatform("macOS")]
|
||||||
|
public Task<string> GetRepresentedFilenameAsync() => this.InvokeAsync<string>();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Specifies whether the window’s document has been edited,
|
/// Specifies whether the window’s document has been edited,
|
||||||
/// and the icon in title bar will become gray when set to true.
|
/// and the icon in title bar will become gray when set to true.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="edited"></param>
|
/// <param name="edited"></param>
|
||||||
|
[SupportedOSPlatform("macOS")]
|
||||||
public void SetDocumentEdited(bool edited) => this.CallMethod1(edited);
|
public void SetDocumentEdited(bool edited) => this.CallMethod1(edited);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Whether the window’s document has been edited.
|
/// Whether the window’s document has been edited.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public Task<bool> IsDocumentEditedAsync() => this.GetPropertyAsync<bool>();
|
[SupportedOSPlatform("macOS")]
|
||||||
|
public Task<bool> IsDocumentEditedAsync() => this.InvokeAsync<bool>();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Focuses the on web view.
|
/// Focuses the on web view.
|
||||||
@@ -821,14 +871,14 @@ public class BrowserWindow : ApiBase
|
|||||||
public void BlurWebView() => this.CallMethod0();
|
public void BlurWebView() => this.CallMethod0();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The url can be a remote address (e.g. http://) or
|
/// The url can be a remote address (e.g. http://) or
|
||||||
/// a path to a local HTML file using the file:// protocol.
|
/// a path to a local HTML file using the file:// protocol.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="url"></param>
|
/// <param name="url"></param>
|
||||||
public void LoadURL(string url) => this.CallMethod1(url);
|
public void LoadURL(string url) => this.CallMethod1(url);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The url can be a remote address (e.g. http://) or
|
/// The url can be a remote address (e.g. http://) or
|
||||||
/// a path to a local HTML file using the file:// protocol.
|
/// a path to a local HTML file using the file:// protocol.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="url"></param>
|
/// <param name="url"></param>
|
||||||
@@ -857,10 +907,12 @@ public class BrowserWindow : ApiBase
|
|||||||
private List<MenuItem> _items = new List<MenuItem>();
|
private List<MenuItem> _items = new List<MenuItem>();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Sets the menu as the window’s menu bar,
|
/// Sets the menu as the window’s menu bar,
|
||||||
/// setting it to null will remove the menu bar.
|
/// setting it to null will remove the menu bar.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="menuItems"></param>
|
/// <param name="menuItems"></param>
|
||||||
|
[SupportedOSPlatform("Linux")]
|
||||||
|
[SupportedOSPlatform("Windows")]
|
||||||
public void SetMenu(MenuItem[] menuItems)
|
public void SetMenu(MenuItem[] menuItems)
|
||||||
{
|
{
|
||||||
menuItems.AddMenuItemsId();
|
menuItems.AddMenuItemsId();
|
||||||
@@ -878,6 +930,8 @@ public class BrowserWindow : ApiBase
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Remove the window's menu bar.
|
/// Remove the window's menu bar.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[SupportedOSPlatform("Linux")]
|
||||||
|
[SupportedOSPlatform("Windows")]
|
||||||
public void RemoveMenu() => this.CallMethod0();
|
public void RemoveMenu() => this.CallMethod0();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -920,7 +974,7 @@ public class BrowserWindow : ApiBase
|
|||||||
/// On Windows and Linux always returns true.
|
/// On Windows and Linux always returns true.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public Task<bool> HasShadowAsync() => this.GetPropertyAsync<bool>();
|
public Task<bool> HasShadowAsync() => this.InvokeAsync<bool>();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the thumbar buttons.
|
/// Gets the thumbar buttons.
|
||||||
@@ -939,17 +993,18 @@ public class BrowserWindow : ApiBase
|
|||||||
private List<ThumbarButton> _thumbarButtons = new List<ThumbarButton>();
|
private List<ThumbarButton> _thumbarButtons = new List<ThumbarButton>();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Add a thumbnail toolbar with a specified set of buttons to the thumbnail
|
/// Add a thumbnail toolbar with a specified set of buttons to the thumbnail
|
||||||
/// image of a window in a taskbar button layout. Returns a Boolean object
|
/// image of a window in a taskbar button layout. Returns a Boolean object
|
||||||
/// indicates whether the thumbnail has been added successfully.
|
/// indicates whether the thumbnail has been added successfully.
|
||||||
///
|
///
|
||||||
/// The number of buttons in thumbnail toolbar should be no greater than 7 due
|
/// The number of buttons in thumbnail toolbar should be no greater than 7 due
|
||||||
/// to the limited room.Once you setup the thumbnail toolbar, the toolbar cannot
|
/// to the limited room.Once you setup the thumbnail toolbar, the toolbar cannot
|
||||||
/// be removed due to the platform’s limitation.But you can call the API with an
|
/// be removed due to the platform’s limitation.But you can call the API with an
|
||||||
/// empty array to clean the buttons.
|
/// empty array to clean the buttons.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="thumbarButtons"></param>
|
/// <param name="thumbarButtons"></param>
|
||||||
/// <returns>Whether the buttons were added successfully.</returns>
|
/// <returns>Whether the buttons were added successfully.</returns>
|
||||||
|
[SupportedOSPlatform("Windows")]
|
||||||
public Task<bool> SetThumbarButtonsAsync(ThumbarButton[] thumbarButtons)
|
public Task<bool> SetThumbarButtonsAsync(ThumbarButton[] thumbarButtons)
|
||||||
{
|
{
|
||||||
var tcs = new TaskCompletionSource<bool>();
|
var tcs = new TaskCompletionSource<bool>();
|
||||||
@@ -977,55 +1032,67 @@ public class BrowserWindow : ApiBase
|
|||||||
/// an empty region: {x: 0, y: 0, width: 0, height: 0}.
|
/// an empty region: {x: 0, y: 0, width: 0, height: 0}.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="rectangle"></param>
|
/// <param name="rectangle"></param>
|
||||||
|
[SupportedOSPlatform("Windows")]
|
||||||
public void SetThumbnailClip(Rectangle rectangle) => this.CallMethod1(rectangle);
|
public void SetThumbnailClip(Rectangle rectangle) => this.CallMethod1(rectangle);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Sets the toolTip that is displayed when hovering over the window thumbnail in the taskbar.
|
/// Sets the toolTip that is displayed when hovering over the window thumbnail in the taskbar.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="tooltip"></param>
|
/// <param name="tooltip"></param>
|
||||||
|
[SupportedOSPlatform("Windows")]
|
||||||
public void SetThumbnailToolTip(string tooltip) => this.CallMethod1(tooltip);
|
public void SetThumbnailToolTip(string tooltip) => this.CallMethod1(tooltip);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Sets the properties for the window’s taskbar button.
|
/// Sets the properties for the window’s taskbar button.
|
||||||
///
|
///
|
||||||
/// Note: relaunchCommand and relaunchDisplayName must always be set together.
|
/// Note: relaunchCommand and relaunchDisplayName must always be set together.
|
||||||
/// If one of those properties is not set, then neither will be used.
|
/// If one of those properties is not set, then neither will be used.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="options"></param>
|
/// <param name="options"></param>
|
||||||
|
[SupportedOSPlatform("Windows")]
|
||||||
public void SetAppDetails(AppDetailsOptions options) => this.CallMethod1(options);
|
public void SetAppDetails(AppDetailsOptions options) => this.CallMethod1(options);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Same as webContents.showDefinitionForSelection().
|
/// Same as webContents.showDefinitionForSelection().
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[SupportedOSPlatform("macOS")]
|
||||||
public void ShowDefinitionForSelection() => this.CallMethod0();
|
public void ShowDefinitionForSelection() => this.CallMethod0();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Sets whether the window menu bar should hide itself automatically.
|
/// Sets whether the window menu bar should hide itself automatically.
|
||||||
/// Once set the menu bar will only show when users press the single Alt key.
|
/// Once set the menu bar will only show when users press the single Alt key.
|
||||||
///
|
///
|
||||||
/// If the menu bar is already visible, calling setAutoHideMenuBar(true) won’t hide it immediately.
|
/// If the menu bar is already visible, calling setAutoHideMenuBar(true) won’t hide it immediately.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="hide"></param>
|
/// <param name="hide"></param>
|
||||||
|
[SupportedOSPlatform("Linux")]
|
||||||
|
[SupportedOSPlatform("Windows")]
|
||||||
public void SetAutoHideMenuBar(bool hide) => this.CallMethod1(hide);
|
public void SetAutoHideMenuBar(bool hide) => this.CallMethod1(hide);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Whether menu bar automatically hides itself.
|
/// Whether menu bar automatically hides itself.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public Task<bool> IsMenuBarAutoHideAsync() => this.GetPropertyAsync<bool>();
|
[SupportedOSPlatform("Linux")]
|
||||||
|
[SupportedOSPlatform("Windows")]
|
||||||
|
public Task<bool> IsMenuBarAutoHideAsync() => this.InvokeAsync<bool>();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Sets whether the menu bar should be visible. If the menu bar is auto-hide,
|
/// Sets whether the menu bar should be visible. If the menu bar is auto-hide,
|
||||||
/// users can still bring up the menu bar by pressing the single Alt key.
|
/// users can still bring up the menu bar by pressing the single Alt key.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="visible"></param>
|
/// <param name="visible"></param>
|
||||||
|
[SupportedOSPlatform("Linux")]
|
||||||
|
[SupportedOSPlatform("Windows")]
|
||||||
public void SetMenuBarVisibility(bool visible) => this.CallMethod1(visible);
|
public void SetMenuBarVisibility(bool visible) => this.CallMethod1(visible);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Whether the menu bar is visible.
|
/// Whether the menu bar is visible.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public Task<bool> IsMenuBarVisibleAsync() => this.GetPropertyAsync<bool>();
|
[SupportedOSPlatform("Linux")]
|
||||||
|
[SupportedOSPlatform("Windows")]
|
||||||
|
public Task<bool> IsMenuBarVisibleAsync() => this.InvokeAsync<bool>();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Sets whether the window should be visible on all workspaces.
|
/// Sets whether the window should be visible on all workspaces.
|
||||||
@@ -1033,6 +1100,8 @@ public class BrowserWindow : ApiBase
|
|||||||
/// Note: This API does nothing on Windows.
|
/// Note: This API does nothing on Windows.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="visible"></param>
|
/// <param name="visible"></param>
|
||||||
|
[SupportedOSPlatform("Linux")]
|
||||||
|
[SupportedOSPlatform("macOS")]
|
||||||
public void SetVisibleOnAllWorkspaces(bool visible) => this.CallMethod1(visible);
|
public void SetVisibleOnAllWorkspaces(bool visible) => this.CallMethod1(visible);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -1041,12 +1110,14 @@ public class BrowserWindow : ApiBase
|
|||||||
/// Note: This API always returns false on Windows.
|
/// Note: This API always returns false on Windows.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public Task<bool> IsVisibleOnAllWorkspacesAsync() => this.GetPropertyAsync<bool>();
|
[SupportedOSPlatform("Linux")]
|
||||||
|
[SupportedOSPlatform("macOS")]
|
||||||
|
public Task<bool> IsVisibleOnAllWorkspacesAsync() => this.InvokeAsync<bool>();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Makes the window ignore all mouse events.
|
/// Makes the window ignore all mouse events.
|
||||||
///
|
///
|
||||||
/// All mouse events happened in this window will be passed to the window
|
/// All mouse events happened in this window will be passed to the window
|
||||||
/// below this window, but if this window has focus, it will still receive keyboard events.
|
/// below this window, but if this window has focus, it will still receive keyboard events.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="ignore"></param>
|
/// <param name="ignore"></param>
|
||||||
@@ -1055,20 +1126,24 @@ public class BrowserWindow : ApiBase
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Prevents the window contents from being captured by other apps.
|
/// Prevents the window contents from being captured by other apps.
|
||||||
///
|
///
|
||||||
/// On macOS it sets the NSWindow’s sharingType to NSWindowSharingNone.
|
/// On macOS it sets the NSWindow’s sharingType to NSWindowSharingNone.
|
||||||
/// On Windows it calls SetWindowDisplayAffinity with WDA_MONITOR.
|
/// On Windows it calls SetWindowDisplayAffinity with WDA_MONITOR.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="enable"></param>
|
/// <param name="enable"></param>
|
||||||
|
[SupportedOSPlatform("macOS")]
|
||||||
|
[SupportedOSPlatform("Windows")]
|
||||||
public void SetContentProtection(bool enable) => this.CallMethod1(enable);
|
public void SetContentProtection(bool enable) => this.CallMethod1(enable);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Changes whether the window can be focused.
|
/// Changes whether the window can be focused.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="focusable"></param>
|
/// <param name="focusable"></param>
|
||||||
|
[SupportedOSPlatform("macOS")]
|
||||||
|
[SupportedOSPlatform("Windows")]
|
||||||
public void SetFocusable(bool focusable) => this.CallMethod1(focusable);
|
public void SetFocusable(bool focusable) => this.CallMethod1(focusable);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Sets parent as current window’s parent window,
|
/// Sets parent as current window’s parent window,
|
||||||
/// passing null will turn current window into a top-level window.
|
/// passing null will turn current window into a top-level window.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="parent"></param>
|
/// <param name="parent"></param>
|
||||||
@@ -1090,7 +1165,7 @@ public class BrowserWindow : ApiBase
|
|||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public async Task<BrowserWindow> GetParentWindowAsync()
|
public async Task<BrowserWindow> GetParentWindowAsync()
|
||||||
{
|
{
|
||||||
var browserWindowId = await this.GetPropertyAsync<int>().ConfigureAwait(false);
|
var browserWindowId = await this.InvokeAsync<int>().ConfigureAwait(false);
|
||||||
var browserWindow = Electron.WindowManager.BrowserWindows.ToList().Single(x => x.Id == browserWindowId);
|
var browserWindow = Electron.WindowManager.BrowserWindows.ToList().Single(x => x.Id == browserWindowId);
|
||||||
return browserWindow;
|
return browserWindow;
|
||||||
}
|
}
|
||||||
@@ -1101,7 +1176,7 @@ public class BrowserWindow : ApiBase
|
|||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public async Task<List<BrowserWindow>> GetChildWindowsAsync()
|
public async Task<List<BrowserWindow>> GetChildWindowsAsync()
|
||||||
{
|
{
|
||||||
var browserWindowIds = await this.GetPropertyAsync<int[]>().ConfigureAwait(false);
|
var browserWindowIds = await this.InvokeAsync<int[]>().ConfigureAwait(false);
|
||||||
var browserWindows = new List<BrowserWindow>();
|
var browserWindows = new List<BrowserWindow>();
|
||||||
|
|
||||||
foreach (var id in browserWindowIds)
|
foreach (var id in browserWindowIds)
|
||||||
@@ -1117,16 +1192,18 @@ public class BrowserWindow : ApiBase
|
|||||||
/// Controls whether to hide cursor when typing.
|
/// Controls whether to hide cursor when typing.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="autoHide"></param>
|
/// <param name="autoHide"></param>
|
||||||
|
[SupportedOSPlatform("macOS")]
|
||||||
public void SetAutoHideCursor(bool autoHide) => this.CallMethod1(autoHide);
|
public void SetAutoHideCursor(bool autoHide) => this.CallMethod1(autoHide);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Adds a vibrancy effect to the browser window.
|
/// Adds a vibrancy effect to the browser window.
|
||||||
/// Passing null or an empty string will remove the vibrancy effect on the window.
|
/// Passing null or an empty string will remove the vibrancy effect on the window.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="type">Can be appearance-based, light, dark, titlebar, selection,
|
/// <param name="type">Can be appearance-based, light, dark, titlebar, selection,
|
||||||
/// menu, popover, sidebar, medium-light or ultra-dark.
|
/// menu, popover, sidebar, medium-light or ultra-dark.
|
||||||
/// See the macOS documentation for more details.</param>
|
/// See the macOS documentation for more details.</param>
|
||||||
public void SetVibrancy(Vibrancy type) => this.CallMethod1(type.GetDescription());
|
[SupportedOSPlatform("macOS")]
|
||||||
|
public void SetVibrancy(Vibrancy type) => this.CallMethod1(type);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Render and control web pages.
|
/// Render and control web pages.
|
||||||
@@ -1134,8 +1211,8 @@ public class BrowserWindow : ApiBase
|
|||||||
public WebContents WebContents { get; internal set; }
|
public WebContents WebContents { get; internal set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// A BrowserView can be used to embed additional web content into a BrowserWindow.
|
/// A BrowserView can be used to embed additional web content into a BrowserWindow.
|
||||||
/// It is like a child window, except that it is positioned relative to its owning window.
|
/// It is like a child window, except that it is positioned relative to its owning window.
|
||||||
/// It is meant to be an alternative to the webview tag.
|
/// It is meant to be an alternative to the webview tag.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="browserView"></param>
|
/// <param name="browserView"></param>
|
||||||
@@ -1144,4 +1221,4 @@ public class BrowserWindow : ApiBase
|
|||||||
// This message name does not match the default ApiBase naming convention.
|
// This message name does not match the default ApiBase naming convention.
|
||||||
BridgeConnector.Socket.Emit("browserWindow-setBrowserView", Id, browserView.Id);
|
BridgeConnector.Socket.Emit("browserWindow-setBrowserView", Id, browserView.Id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,9 @@
|
|||||||
using ElectronNET.API.Entities;
|
using ElectronNET.API.Entities;
|
||||||
using ElectronNET.API.Serialization;
|
using ElectronNET.API.Serialization;
|
||||||
|
using System.Runtime.Versioning;
|
||||||
using System.Text.Json;
|
using System.Text.Json;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
// ReSharper disable InconsistentNaming
|
// ReSharper disable InconsistentNaming
|
||||||
|
|
||||||
namespace ElectronNET.API
|
namespace ElectronNET.API
|
||||||
@@ -9,7 +11,7 @@ namespace ElectronNET.API
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Perform copy and paste operations on the system clipboard.
|
/// Perform copy and paste operations on the system clipboard.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public sealed class Clipboard: ApiBase
|
public sealed class Clipboard : ApiBase
|
||||||
{
|
{
|
||||||
protected override SocketTaskEventNameTypes SocketTaskEventNameType => SocketTaskEventNameTypes.DashesLowerFirst;
|
protected override SocketTaskEventNameTypes SocketTaskEventNameType => SocketTaskEventNameTypes.DashesLowerFirst;
|
||||||
protected override SocketTaskMessageNameTypes SocketTaskMessageNameType => SocketTaskMessageNameTypes.DashesLowerFirst;
|
protected override SocketTaskMessageNameTypes SocketTaskMessageNameType => SocketTaskMessageNameTypes.DashesLowerFirst;
|
||||||
@@ -45,7 +47,7 @@ namespace ElectronNET.API
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="type"></param>
|
/// <param name="type"></param>
|
||||||
/// <returns>The content in the clipboard as plain text.</returns>
|
/// <returns>The content in the clipboard as plain text.</returns>
|
||||||
public Task<string> ReadTextAsync(string type = "") => GetPropertyAsync<string>(type);
|
public Task<string> ReadTextAsync(string type = "") => this.InvokeAsync<string>(type);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Writes the text into the clipboard as plain text.
|
/// Writes the text into the clipboard as plain text.
|
||||||
@@ -62,7 +64,7 @@ namespace ElectronNET.API
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="type"></param>
|
/// <param name="type"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public Task<string> ReadHTMLAsync(string type = "") => GetPropertyAsync<string>(type);
|
public Task<string> ReadHTMLAsync(string type = "") => this.InvokeAsync<string>(type);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Writes markup to the clipboard.
|
/// Writes markup to the clipboard.
|
||||||
@@ -79,7 +81,7 @@ namespace ElectronNET.API
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="type"></param>
|
/// <param name="type"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public Task<string> ReadRTFAsync(string type = "") => GetPropertyAsync<string>(type);
|
public Task<string> ReadRTFAsync(string type = "") => this.InvokeAsync<string>(type);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Writes the text into the clipboard in RTF.
|
/// Writes the text into the clipboard in RTF.
|
||||||
@@ -92,23 +94,27 @@ namespace ElectronNET.API
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Returns an Object containing title and url keys representing
|
/// Returns an Object containing title and url keys representing
|
||||||
/// the bookmark in the clipboard. The title and url values will
|
/// the bookmark in the clipboard. The title and url values will
|
||||||
/// be empty strings when the bookmark is unavailable.
|
/// be empty strings when the bookmark is unavailable.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public Task<ReadBookmark> ReadBookmarkAsync() => GetPropertyAsync<ReadBookmark>();
|
[SupportedOSPlatform("macOS")]
|
||||||
|
[SupportedOSPlatform("Windows")]
|
||||||
|
public Task<ReadBookmark> ReadBookmarkAsync() => this.InvokeAsync<ReadBookmark>();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Writes the title and url into the clipboard as a bookmark.
|
/// Writes the title and url into the clipboard as a bookmark.
|
||||||
///
|
///
|
||||||
/// Note: Most apps on Windows don’t support pasting bookmarks
|
/// Note: Most apps on Windows don’t support pasting bookmarks
|
||||||
/// into them so you can use clipboard.write to write both a
|
/// into them so you can use clipboard.write to write both a
|
||||||
/// bookmark and fallback text to the clipboard.
|
/// bookmark and fallback text to the clipboard.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="title"></param>
|
/// <param name="title"></param>
|
||||||
/// <param name="url"></param>
|
/// <param name="url"></param>
|
||||||
/// <param name="type"></param>
|
/// <param name="type"></param>
|
||||||
|
[SupportedOSPlatform("macOS")]
|
||||||
|
[SupportedOSPlatform("Windows")]
|
||||||
public void WriteBookmark(string title, string url, string type = "")
|
public void WriteBookmark(string title, string url, string type = "")
|
||||||
{
|
{
|
||||||
BridgeConnector.Socket.Emit("clipboard-writeBookmark", title, url, type);
|
BridgeConnector.Socket.Emit("clipboard-writeBookmark", title, url, type);
|
||||||
@@ -120,13 +126,15 @@ namespace ElectronNET.API
|
|||||||
/// find pasteboard whenever the application is activated.
|
/// find pasteboard whenever the application is activated.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public Task<string> ReadFindTextAsync() => GetPropertyAsync<string>();
|
[SupportedOSPlatform("macOS")]
|
||||||
|
public Task<string> ReadFindTextAsync() => this.InvokeAsync<string>();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// macOS: Writes the text into the find pasteboard as plain text. This method uses
|
/// macOS: Writes the text into the find pasteboard as plain text. This method uses
|
||||||
/// synchronous IPC when called from the renderer process.
|
/// synchronous IPC when called from the renderer process.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="text"></param>
|
/// <param name="text"></param>
|
||||||
|
[SupportedOSPlatform("macOS")]
|
||||||
public void WriteFindText(string text)
|
public void WriteFindText(string text)
|
||||||
{
|
{
|
||||||
BridgeConnector.Socket.Emit("clipboard-writeFindText", text);
|
BridgeConnector.Socket.Emit("clipboard-writeFindText", text);
|
||||||
@@ -146,7 +154,7 @@ namespace ElectronNET.API
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="type"></param>
|
/// <param name="type"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public Task<string[]> AvailableFormatsAsync(string type = "") => GetPropertyAsync<string[]>(type);
|
public Task<string[]> AvailableFormatsAsync(string type = "") => this.InvokeAsync<string[]>(type);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Writes data to the clipboard.
|
/// Writes data to the clipboard.
|
||||||
@@ -163,7 +171,7 @@ namespace ElectronNET.API
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="type"></param>
|
/// <param name="type"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public Task<NativeImage> ReadImageAsync(string type = "") => GetPropertyAsync<NativeImage>(type);
|
public Task<NativeImage> ReadImageAsync(string type = "") => this.InvokeAsync<NativeImage>(type);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Writes an image to the clipboard.
|
/// Writes an image to the clipboard.
|
||||||
@@ -175,4 +183,4 @@ namespace ElectronNET.API
|
|||||||
BridgeConnector.Socket.Emit("clipboard-writeImage", JsonSerializer.Serialize(image, ElectronJson.Options), type);
|
BridgeConnector.Socket.Emit("clipboard-writeImage", JsonSerializer.Serialize(image, ElectronJson.Options), type);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2,6 +2,7 @@ using ElectronNET.API.Entities;
|
|||||||
using ElectronNET.API.Serialization;
|
using ElectronNET.API.Serialization;
|
||||||
using System;
|
using System;
|
||||||
using System.Text.Json;
|
using System.Text.Json;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace ElectronNET.API
|
namespace ElectronNET.API
|
||||||
{
|
{
|
||||||
@@ -54,12 +55,79 @@ namespace ElectronNET.API
|
|||||||
_changed -= value;
|
_changed -= value;
|
||||||
|
|
||||||
if (_changed == null)
|
if (_changed == null)
|
||||||
|
{
|
||||||
BridgeConnector.Socket.Off("webContents-session-cookies-changed" + Id);
|
BridgeConnector.Socket.Off("webContents-session-cookies-changed" + Id);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private event Action<Cookie, CookieChangedCause, bool> _changed;
|
private event Action<Cookie, CookieChangedCause, bool> _changed;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Sends a request to get all cookies matching filter, and resolves a callack with the response.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="filter">
|
||||||
|
/// </param>
|
||||||
|
/// <returns>A task which resolves an array of cookie objects.</returns>
|
||||||
|
public Task<Cookie[]> GetAsync(CookieFilter filter)
|
||||||
|
{
|
||||||
|
var tcs = new TaskCompletionSource<Cookie[]>();
|
||||||
|
var guid = Guid.NewGuid().ToString();
|
||||||
|
|
||||||
|
BridgeConnector.Socket.Once<Cookie[]>("webContents-session-cookies-get-completed" + guid, tcs.SetResult);
|
||||||
|
BridgeConnector.Socket.Emit("webContents-session-cookies-get", Id, filter, guid);
|
||||||
|
|
||||||
|
return tcs.Task;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="details"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public Task SetAsync(CookieDetails details)
|
||||||
|
{
|
||||||
|
var tcs = new TaskCompletionSource<object>();
|
||||||
|
var guid = Guid.NewGuid().ToString();
|
||||||
|
|
||||||
|
BridgeConnector.Socket.Once<object>("webContents-session-cookies-set-completed" + guid, tcs.SetResult);
|
||||||
|
BridgeConnector.Socket.Emit("webContents-session-cookies-set", Id, details, guid);
|
||||||
|
|
||||||
|
return tcs.Task;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Removes the cookies matching url and name
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="url">The URL associated with the cookie.</param>
|
||||||
|
/// <param name="name">The name of cookie to remove.</param>
|
||||||
|
/// <returns>A task which resolves when the cookie has been removed</returns>
|
||||||
|
public Task RemoveAsync(string url, string name)
|
||||||
|
{
|
||||||
|
var tcs = new TaskCompletionSource<object>();
|
||||||
|
var guid = Guid.NewGuid().ToString();
|
||||||
|
|
||||||
|
BridgeConnector.Socket.Once<object>("webContents-session-cookies-remove-completed" + guid, tcs.SetResult);
|
||||||
|
BridgeConnector.Socket.Emit("webContents-session-cookies-remove", Id, url, name, guid);
|
||||||
|
|
||||||
|
return tcs.Task;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Writes any unwritten cookies data to disk.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>A task which resolves when the cookie store has been flushed</returns>
|
||||||
|
public Task FlushStoreAsync()
|
||||||
|
{
|
||||||
|
var tcs = new TaskCompletionSource<object>();
|
||||||
|
var guid = Guid.NewGuid().ToString();
|
||||||
|
|
||||||
|
BridgeConnector.Socket.Once<object>("webContents-session-cookies-flushStore-completed" + guid, tcs.SetResult);
|
||||||
|
BridgeConnector.Socket.Emit("webContents-session-cookies-flushStore", Id, guid);
|
||||||
|
|
||||||
|
return tcs.Task;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
using ElectronNET.API.Entities;
|
using ElectronNET.API.Entities;
|
||||||
using System;
|
using System;
|
||||||
|
using System.Runtime.Versioning;
|
||||||
using System.Text.Json;
|
using System.Text.Json;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
@@ -37,8 +38,8 @@ namespace ElectronNET.API
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Note: On Windows and Linux an open dialog can not be both a file selector
|
/// Note: On Windows and Linux an open dialog can not be both a file selector
|
||||||
/// and a directory selector, so if you set properties to ['openFile', 'openDirectory']
|
/// and a directory selector, so if you set properties to ['openFile', 'openDirectory']
|
||||||
/// on these platforms, a directory selector will be shown.
|
/// on these platforms, a directory selector will be shown.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="browserWindow">The browserWindow argument allows the dialog to attach itself to a parent window, making it modal.</param>
|
/// <param name="browserWindow">The browserWindow argument allows the dialog to attach itself to a parent window, making it modal.</param>
|
||||||
@@ -50,9 +51,9 @@ namespace ElectronNET.API
|
|||||||
var guid = Guid.NewGuid().ToString();
|
var guid = Guid.NewGuid().ToString();
|
||||||
|
|
||||||
BridgeConnector.Socket.Once<string[]>("showOpenDialogComplete" + guid, tcs.SetResult);
|
BridgeConnector.Socket.Once<string[]>("showOpenDialogComplete" + guid, tcs.SetResult);
|
||||||
BridgeConnector.Socket.Emit("showOpenDialog",
|
BridgeConnector.Socket.Emit("showOpenDialog",
|
||||||
browserWindow,
|
browserWindow,
|
||||||
options,
|
options,
|
||||||
guid);
|
guid);
|
||||||
|
|
||||||
return tcs.Task;
|
return tcs.Task;
|
||||||
@@ -167,9 +168,9 @@ namespace ElectronNET.API
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Displays a modal dialog that shows an error message.
|
/// Displays a modal dialog that shows an error message.
|
||||||
///
|
///
|
||||||
/// This API can be called safely before the ready event the app module emits,
|
/// This API can be called safely before the ready event the app module emits,
|
||||||
/// it is usually used to report errors in early stage of startup.If called
|
/// it is usually used to report errors in early stage of startup.If called
|
||||||
/// before the app readyevent on Linux, the message will be emitted to stderr,
|
/// before the app readyevent on Linux, the message will be emitted to stderr,
|
||||||
/// and no GUI dialog will appear.
|
/// and no GUI dialog will appear.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="title">The title to display in the error box.</param>
|
/// <param name="title">The title to display in the error box.</param>
|
||||||
@@ -181,11 +182,13 @@ namespace ElectronNET.API
|
|||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// On macOS, this displays a modal dialog that shows a message and certificate information,
|
/// On macOS, this displays a modal dialog that shows a message and certificate information,
|
||||||
/// and gives the user the option of trusting/importing the certificate. If you provide a
|
/// and gives the user the option of trusting/importing the certificate. If you provide a
|
||||||
/// browserWindow argument the dialog will be attached to the parent window, making it modal.
|
/// browserWindow argument the dialog will be attached to the parent window, making it modal.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="options"></param>
|
/// <param name="options"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
|
[SupportedOSPlatform("macOS")]
|
||||||
|
[SupportedOSPlatform("Windows")]
|
||||||
public Task ShowCertificateTrustDialogAsync(CertificateTrustDialogOptions options)
|
public Task ShowCertificateTrustDialogAsync(CertificateTrustDialogOptions options)
|
||||||
{
|
{
|
||||||
return ShowCertificateTrustDialogAsync(null, options);
|
return ShowCertificateTrustDialogAsync(null, options);
|
||||||
@@ -193,18 +196,20 @@ namespace ElectronNET.API
|
|||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// On macOS, this displays a modal dialog that shows a message and certificate information,
|
/// On macOS, this displays a modal dialog that shows a message and certificate information,
|
||||||
/// and gives the user the option of trusting/importing the certificate. If you provide a
|
/// and gives the user the option of trusting/importing the certificate. If you provide a
|
||||||
/// browserWindow argument the dialog will be attached to the parent window, making it modal.
|
/// browserWindow argument the dialog will be attached to the parent window, making it modal.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="browserWindow"></param>
|
/// <param name="browserWindow"></param>
|
||||||
/// <param name="options"></param>
|
/// <param name="options"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
|
[SupportedOSPlatform("macOS")]
|
||||||
|
[SupportedOSPlatform("Windows")]
|
||||||
public Task ShowCertificateTrustDialogAsync(BrowserWindow browserWindow, CertificateTrustDialogOptions options)
|
public Task ShowCertificateTrustDialogAsync(BrowserWindow browserWindow, CertificateTrustDialogOptions options)
|
||||||
{
|
{
|
||||||
var tcs = new TaskCompletionSource<object>();
|
var tcs = new TaskCompletionSource();
|
||||||
string guid = Guid.NewGuid().ToString();
|
string guid = Guid.NewGuid().ToString();
|
||||||
|
|
||||||
BridgeConnector.Socket.Once("showCertificateTrustDialogComplete" + guid, () => tcs.SetResult(null));
|
BridgeConnector.Socket.Once("showCertificateTrustDialogComplete" + guid, () => tcs.SetResult());
|
||||||
BridgeConnector.Socket.Emit("showCertificateTrustDialog",
|
BridgeConnector.Socket.Emit("showCertificateTrustDialog",
|
||||||
browserWindow,
|
browserWindow,
|
||||||
options,
|
options,
|
||||||
@@ -212,7 +217,5 @@ namespace ElectronNET.API
|
|||||||
|
|
||||||
return tcs.Task;
|
return tcs.Task;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,16 +1,16 @@
|
|||||||
using ElectronNET.API.Entities;
|
|
||||||
using ElectronNET.API.Extensions;
|
|
||||||
using ElectronNET.API.Serialization;
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Text.Json;
|
using System.Runtime.Versioning;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
using ElectronNET.API.Entities;
|
||||||
|
using ElectronNET.API.Extensions;
|
||||||
|
|
||||||
namespace ElectronNET.API
|
namespace ElectronNET.API
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Control your app in the macOS dock.
|
/// Control your app in the macOS dock.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[SupportedOSPlatform("macOS")]
|
||||||
public sealed class Dock
|
public sealed class Dock
|
||||||
{
|
{
|
||||||
private static Dock _dock;
|
private static Dock _dock;
|
||||||
@@ -57,7 +57,7 @@ namespace ElectronNET.API
|
|||||||
using (cancellationToken.Register(() => tcs.TrySetCanceled()))
|
using (cancellationToken.Register(() => tcs.TrySetCanceled()))
|
||||||
{
|
{
|
||||||
BridgeConnector.Socket.Once<int>("dock-bounce-completed", tcs.SetResult);
|
BridgeConnector.Socket.Once<int>("dock-bounce-completed", tcs.SetResult);
|
||||||
BridgeConnector.Socket.Emit("dock-bounce", type.GetDescription());
|
BridgeConnector.Socket.Emit("dock-bounce", type);
|
||||||
|
|
||||||
return await tcs.Task
|
return await tcs.Task
|
||||||
.ConfigureAwait(false);
|
.ConfigureAwait(false);
|
||||||
@@ -208,7 +208,5 @@ namespace ElectronNET.API
|
|||||||
{
|
{
|
||||||
BridgeConnector.Socket.Emit("dock-setIcon", image);
|
BridgeConnector.Socket.Emit("dock-setIcon", image);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -140,7 +140,7 @@
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Allows you to execute native JavaScript/TypeScript code from the host process.
|
/// Allows you to execute native JavaScript/TypeScript code from the host process.
|
||||||
///
|
///
|
||||||
/// It is only possible if the Electron.NET CLI has previously added an
|
/// It is only possible if the Electron.NET CLI has previously added an
|
||||||
/// ElectronHostHook directory:
|
/// ElectronHostHook directory:
|
||||||
/// <c>electronize add HostHook</c>
|
/// <c>electronize add HostHook</c>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -153,7 +153,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Allows you to execute native Lock and Unlock process.
|
/// Allows you to execute native Lock and Unlock process.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static PowerMonitor PowerMonitor
|
public static PowerMonitor PowerMonitor
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,8 +1,11 @@
|
|||||||
namespace ElectronNET.API.Entities
|
using System.Runtime.Versioning;
|
||||||
|
|
||||||
|
namespace ElectronNET.API.Entities
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// About panel options.
|
/// About panel options.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <remarks>Up-to-date with Electron API 39.2</remarks>
|
||||||
public class AboutPanelOptions
|
public class AboutPanelOptions
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -21,28 +24,35 @@
|
|||||||
public string Copyright { get; set; }
|
public string Copyright { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The app's build version number.
|
/// The app's build version number (macOS).
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[SupportedOSPlatform("macos")]
|
||||||
public string Version { get; set; }
|
public string Version { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Credit information.
|
/// Credit information (macOS, Windows).
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[SupportedOSPlatform("macos")]
|
||||||
|
[SupportedOSPlatform("windows")]
|
||||||
public string Credits { get; set; }
|
public string Credits { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// List of app authors.
|
/// List of app authors (Linux).
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[SupportedOSPlatform("linux")]
|
||||||
public string[] Authors { get; set; }
|
public string[] Authors { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The app's website.
|
/// The app's website (Linux).
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[SupportedOSPlatform("linux")]
|
||||||
public string Website { get; set; }
|
public string Website { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Path to the app's icon. On Linux, will be shown as 64x64 pixels while retaining aspect ratio.
|
/// Path to the app's icon in a JPEG or PNG file format. On Linux, will be shown as 64x64 pixels while retaining aspect ratio. On Windows, a 48x48 PNG will result in the best visual quality.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[SupportedOSPlatform("linux")]
|
||||||
|
[SupportedOSPlatform("windows")]
|
||||||
public string IconPath { get; set; }
|
public string IconPath { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,32 +1,35 @@
|
|||||||
|
using System.Text.Json.Serialization;
|
||||||
|
|
||||||
namespace ElectronNET.API.Entities
|
namespace ElectronNET.API.Entities
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <remarks>Up-to-date with Electron API 39.2</remarks>
|
||||||
public class AddRepresentationOptions
|
public class AddRepresentationOptions
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the width
|
/// Gets or sets the width in pixels. Defaults to 0. Required if a bitmap buffer is specified as <see cref="Buffer"/>.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public int? Width { get; set; }
|
public int? Width { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the height
|
/// Gets or sets the height in pixels. Defaults to 0. Required if a bitmap buffer is specified as <see cref="Buffer"/>.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public int? Height { get; set; }
|
public int? Height { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the scalefactor
|
/// Gets or sets the image scale factor. Defaults to 1.0.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public float ScaleFactor { get; set; } = 1.0f;
|
public float ScaleFactor { get; set; } = 1.0f;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the buffer
|
/// Gets or sets the buffer containing the raw image data.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public byte[] Buffer { get; set; }
|
public byte[] Buffer { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the dataURL
|
/// Gets or sets the data URL containing a base 64 encoded PNG or JPEG image.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string DataUrl { get; set; }
|
public string DataUrl { get; set; }
|
||||||
}
|
}
|
||||||
|
|||||||
18
src/ElectronNET.API/API/Entities/AdjustSelectionOptions.cs
Normal file
18
src/ElectronNET.API/API/Entities/AdjustSelectionOptions.cs
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
namespace ElectronNET.API.Entities
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Options for <see cref="WebContents.AdjustSelection"/>.
|
||||||
|
/// </summary>
|
||||||
|
public class AdjustSelectionOptions
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Amount to shift the start index of the current selection.
|
||||||
|
/// </summary>
|
||||||
|
public int? Start { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Amount to shift the end index of the current selection.
|
||||||
|
/// </summary>
|
||||||
|
public int? End { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,32 +1,36 @@
|
|||||||
namespace ElectronNET.API.Entities
|
using System.Runtime.Versioning;
|
||||||
|
|
||||||
|
namespace ElectronNET.API.Entities
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <remarks>Up-to-date with Electron API 39.2</remarks>
|
||||||
|
[SupportedOSPlatform("windows")]
|
||||||
public class AppDetailsOptions
|
public class AppDetailsOptions
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Window’s App User Model ID. It has to be set, otherwise the other options will have no effect.
|
/// Window's App User Model ID. It has to be set, otherwise the other options will have no effect.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string AppId { get; set; }
|
public string AppId { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Window’s Relaunch Icon.
|
/// Window's relaunch icon resource path.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string AppIconPath { get; set; }
|
public string AppIconPath { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Index of the icon in appIconPath. Ignored when appIconPath is not set. Default is 0.
|
/// Index of the icon in <see cref="AppIconPath"/>. Ignored when <see cref="AppIconPath"/> is not set. Default is 0.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public int AppIconIndex { get; set; }
|
public int AppIconIndex { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Window’s Relaunch Command.
|
/// Window's relaunch command.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string RelaunchCommand { get; set; }
|
public string RelaunchCommand { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Window’s Relaunch Display Name.
|
/// Window's relaunch display name.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string RelaunchDisplayName { get; set; }
|
public string RelaunchDisplayName { get; set; }
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ namespace ElectronNET.API.Entities
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <remarks>Up-to-date with Electron API 39.2</remarks>
|
||||||
public class AutoResizeOptions
|
public class AutoResizeOptions
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -35,4 +36,4 @@ namespace ElectronNET.API.Entities
|
|||||||
[DefaultValue(false)]
|
[DefaultValue(false)]
|
||||||
public bool Vertical { get; set; } = false;
|
public bool Vertical { get; set; } = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -3,11 +3,12 @@
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <remarks>Up-to-date with Electron API 39.2</remarks>
|
||||||
public class BitmapOptions
|
public class BitmapOptions
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the scale factor
|
/// The image scale factor. Defaults to 1.0.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public float ScaleFactor { get; set; } = 1.0f;
|
public float ScaleFactor { get; set; } = 1.0f;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -3,6 +3,7 @@
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <remarks>Up-to-date with Electron API 39.2</remarks>
|
||||||
public class Blob : IPostData
|
public class Blob : IPostData
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@@ -28,4 +28,4 @@
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public bool IsAdminRightsRequired { get; set; }
|
public bool IsAdminRightsRequired { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -3,23 +3,26 @@
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <remarks>Up-to-date with Electron API 39.2</remarks>
|
||||||
public class BrowserViewConstructorOptions
|
public class BrowserViewConstructorOptions
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// See BrowserWindow.
|
/// Gets or sets the web preferences for the view (see WebPreferences).
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public WebPreferences WebPreferences { get; set; }
|
public WebPreferences WebPreferences { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// A proxy to set on creation in the format host:port.
|
/// Gets or sets a proxy to use on creation in the format host:port.
|
||||||
/// The proxy can be alternatively set using the BrowserView.WebContents.SetProxyAsync function.
|
/// The proxy can be alternatively set using the BrowserView.WebContents.SetProxyAsync function.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <remarks>This is custom shortcut. Not part of the Electron API.</remarks>
|
||||||
public string Proxy { get; set; }
|
public string Proxy { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The credentials of the Proxy in the format username:password.
|
/// Gets or sets the credentials of the proxy in the format username:password.
|
||||||
/// These will only be used if the Proxy field is also set.
|
/// These will only be used if the Proxy field is also set.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <remarks>This is custom shortcut. Not part of the Electron API.</remarks>
|
||||||
public string ProxyCredentials { get; set; }
|
public string ProxyCredentials { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
using ElectronNET.Converter;
|
using ElectronNET.Converter;
|
||||||
|
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
using System.Text.Json.Serialization;
|
using System.Text.Json.Serialization;
|
||||||
|
using System.Runtime.Versioning;
|
||||||
|
|
||||||
namespace ElectronNET.API.Entities
|
namespace ElectronNET.API.Entities
|
||||||
{
|
{
|
||||||
@@ -24,13 +24,13 @@ namespace ElectronNET.API.Entities
|
|||||||
/// ( if y is used) Window's left offset from screen. Default is to center the
|
/// ( if y is used) Window's left offset from screen. Default is to center the
|
||||||
/// window.
|
/// window.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public int X { get; set; } = -1;
|
public int? X { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// ( if x is used) Window's top offset from screen. Default is to center the
|
/// ( if x is used) Window's top offset from screen. Default is to center the
|
||||||
/// window.
|
/// window.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public int Y { get; set; } = -1;
|
public int? Y { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The width and height would be used as web page's size, which means the actual
|
/// The width and height would be used as web page's size, which means the actual
|
||||||
@@ -73,24 +73,32 @@ namespace ElectronNET.API.Entities
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Whether window is movable. This is not implemented on Linux. Default is true.
|
/// Whether window is movable. This is not implemented on Linux. Default is true.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[SupportedOSPlatform("macos")]
|
||||||
|
[SupportedOSPlatform("windows")]
|
||||||
[DefaultValue(true)]
|
[DefaultValue(true)]
|
||||||
public bool Movable { get; set; } = true;
|
public bool Movable { get; set; } = true;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Whether window is minimizable. This is not implemented on Linux. Default is true.
|
/// Whether window is minimizable. This is not implemented on Linux. Default is true.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[SupportedOSPlatform("macos")]
|
||||||
|
[SupportedOSPlatform("windows")]
|
||||||
[DefaultValue(true)]
|
[DefaultValue(true)]
|
||||||
public bool Minimizable { get; set; } = true;
|
public bool Minimizable { get; set; } = true;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Whether window is maximizable. This is not implemented on Linux. Default is true.
|
/// Whether window is maximizable. This is not implemented on Linux. Default is true.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[SupportedOSPlatform("macos")]
|
||||||
|
[SupportedOSPlatform("windows")]
|
||||||
[DefaultValue(true)]
|
[DefaultValue(true)]
|
||||||
public bool Maximizable { get; set; } = true;
|
public bool Maximizable { get; set; } = true;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Whether window is closable. This is not implemented on Linux. Default is true.
|
/// Whether window is closable. This is not implemented on Linux. Default is true.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[SupportedOSPlatform("macos")]
|
||||||
|
[SupportedOSPlatform("windows")]
|
||||||
[DefaultValue(true)]
|
[DefaultValue(true)]
|
||||||
public bool Closable { get; set; } = true;
|
public bool Closable { get; set; } = true;
|
||||||
|
|
||||||
@@ -116,16 +124,24 @@ namespace ElectronNET.API.Entities
|
|||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Whether the window can be put into fullscreen mode. On macOS, also whether the
|
/// Whether the window can be put into fullscreen mode. On macOS, also whether the
|
||||||
/// maximize/zoom button should toggle full screen mode or maximize window.Default
|
/// maximize/zoom button should toggle full screen mode or maximize window. Default
|
||||||
/// is true.
|
/// is true (Electron default).
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool Fullscreenable { get; set; }
|
[DefaultValue(true)]
|
||||||
|
public bool Fullscreenable { get; set; } = true; // FIX: previously defaulted to false in C#
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Whether to show the window in taskbar. Default is false.
|
/// Whether to show the window in taskbar. Default is false.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[SupportedOSPlatform("macos")]
|
||||||
|
[SupportedOSPlatform("windows")]
|
||||||
public bool SkipTaskbar { get; set; }
|
public bool SkipTaskbar { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Determines if Blazor is used. Will disable "module" and "process" globals. Default is false.
|
||||||
|
/// </summary>
|
||||||
|
public bool IsRunningBlazor { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The kiosk mode. Default is false.
|
/// The kiosk mode. Default is false.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -137,8 +153,7 @@ namespace ElectronNET.API.Entities
|
|||||||
public string Title { get; set; } = "Electron.NET";
|
public string Title { get; set; } = "Electron.NET";
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The window icon. On Windows it is recommended to use ICO icons to get best
|
/// The window icon. Can be a NativeImage or a string path. On Windows it is recommended to use ICO icons; when undefined, the executable's icon will be used.
|
||||||
/// visual effects, you can also leave it undefined so the executable's icon will be used.
|
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string Icon { get; set; }
|
public string Icon { get; set; }
|
||||||
|
|
||||||
@@ -149,7 +164,7 @@ namespace ElectronNET.API.Entities
|
|||||||
public bool Show { get; set; } = true;
|
public bool Show { get; set; } = true;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Specify false to create a . Default is true.
|
/// Specify false to create a frameless window. Default is true.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[DefaultValue(true)]
|
[DefaultValue(true)]
|
||||||
public bool Frame { get; set; } = true;
|
public bool Frame { get; set; } = true;
|
||||||
@@ -164,6 +179,7 @@ namespace ElectronNET.API.Entities
|
|||||||
/// Whether the web view accepts a single mouse-down event that simultaneously
|
/// Whether the web view accepts a single mouse-down event that simultaneously
|
||||||
/// activates the window.Default is false.
|
/// activates the window.Default is false.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[SupportedOSPlatform("macos")]
|
||||||
public bool AcceptFirstMouse { get; set; }
|
public bool AcceptFirstMouse { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -174,28 +190,36 @@ namespace ElectronNET.API.Entities
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Auto hide the menu bar unless the Alt key is pressed. Default is false.
|
/// Auto hide the menu bar unless the Alt key is pressed. Default is false.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[SupportedOSPlatform("windows")]
|
||||||
|
[SupportedOSPlatform("linux")]
|
||||||
public bool AutoHideMenuBar { get; set; }
|
public bool AutoHideMenuBar { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Enable the window to be resized larger than screen. Default is false.
|
/// Enable the window to be resized larger than screen. Default is false.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[SupportedOSPlatform("macos")]
|
||||||
public bool EnableLargerThanScreen { get; set; }
|
public bool EnableLargerThanScreen { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Window's background color as Hexadecimal value, like #66CD00 or #FFF or
|
/// The window's background color in Hex, RGB, RGBA, HSL, HSLA or named CSS color format. Alpha in #AARRGGBB format is supported if transparent is set to true. Default is #FFF (white).
|
||||||
/// #80FFFFFF (alpha is supported). Default is #FFF (white).
|
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string BackgroundColor { get; set; }
|
public string BackgroundColor { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Whether window should have a shadow. This is only implemented on macOS. Default
|
/// Initial opacity of the window, between 0.0 (fully transparent) and 1.0 (fully opaque). Only implemented on Windows and macOS.
|
||||||
/// is true.
|
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool HasShadow { get; set; }
|
[SupportedOSPlatform("windows")]
|
||||||
|
[SupportedOSPlatform("macos")]
|
||||||
|
public double? Opacity { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Forces using dark theme for the window, only works on some GTK+3 desktop
|
/// Whether window should have a shadow. Default is true.
|
||||||
/// environments.Default is false.
|
/// </summary>
|
||||||
|
[DefaultValue(true)]
|
||||||
|
public bool HasShadow { get; set; } = true;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Forces using dark theme for the window, only works on some GTK+3 desktop environments. Default is false.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool DarkTheme { get; set; }
|
public bool DarkTheme { get; set; }
|
||||||
|
|
||||||
@@ -215,6 +239,12 @@ namespace ElectronNET.API.Entities
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public TitleBarStyle TitleBarStyle { get; set; }
|
public TitleBarStyle TitleBarStyle { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Set a custom position for the traffic light buttons in frameless windows (macOS).
|
||||||
|
/// </summary>
|
||||||
|
[SupportedOSPlatform("macos")]
|
||||||
|
public Point TrafficLightPosition { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Configures the window's title bar overlay when using a frameless window.
|
/// Configures the window's title bar overlay when using a frameless window.
|
||||||
/// Can be either:
|
/// Can be either:
|
||||||
@@ -228,9 +258,9 @@ namespace ElectronNET.API.Entities
|
|||||||
public TitleBarOverlay TitleBarOverlay { get; set; }
|
public TitleBarOverlay TitleBarOverlay { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Shows the title in the tile bar in full screen mode on macOS for all
|
/// Shows the title in the title bar in full screen mode on macOS for all titleBarStyle options. Default is false.
|
||||||
/// titleBarStyle options.Default is false.
|
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <remarks>Not documented by MCP base-window-options / browser-window-options.</remarks>
|
||||||
public bool FullscreenWindowTitle { get; set; }
|
public bool FullscreenWindowTitle { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -238,6 +268,7 @@ namespace ElectronNET.API.Entities
|
|||||||
/// window frame.Setting it to false will remove window shadow and window
|
/// window frame.Setting it to false will remove window shadow and window
|
||||||
/// animations. Default is true.
|
/// animations. Default is true.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[SupportedOSPlatform("windows")]
|
||||||
[DefaultValue(true)]
|
[DefaultValue(true)]
|
||||||
public bool ThickFrame { get; set; } = true;
|
public bool ThickFrame { get; set; } = true;
|
||||||
|
|
||||||
@@ -247,14 +278,17 @@ namespace ElectronNET.API.Entities
|
|||||||
/// Windows versions older than Windows 11 Build 22000 this property has no effect, and
|
/// Windows versions older than Windows 11 Build 22000 this property has no effect, and
|
||||||
/// frameless windows will not have rounded corners.
|
/// frameless windows will not have rounded corners.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[SupportedOSPlatform("macos")]
|
||||||
|
[SupportedOSPlatform("windows")]
|
||||||
[DefaultValue(true)]
|
[DefaultValue(true)]
|
||||||
public bool RoundedCorners { get; set; } = true;
|
public bool RoundedCorners { get; set; } = true;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Add a type of vibrancy effect to the window, only on macOS. Can be
|
/// Add a type of vibrancy effect to the window, only on macOS. Can be
|
||||||
/// appearance-based, light, dark, titlebar, selection, menu, popover, sidebar,
|
/// appearance-based, titlebar, selection, menu, popover, sidebar, header, sheet,
|
||||||
/// medium-light or ultra-dark.
|
/// window, hud, fullscreen-ui, tooltip, content, under-window, or under-page.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[SupportedOSPlatform("macos")]
|
||||||
public Vibrancy Vibrancy { get; set; }
|
public Vibrancy Vibrancy { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -264,6 +298,7 @@ namespace ElectronNET.API.Entities
|
|||||||
/// it to zoom to the width of the screen.This will also affect the behavior when
|
/// it to zoom to the width of the screen.This will also affect the behavior when
|
||||||
/// calling maximize() directly.Default is false.
|
/// calling maximize() directly.Default is false.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[SupportedOSPlatform("macos")]
|
||||||
public bool ZoomToPageWidth { get; set; }
|
public bool ZoomToPageWidth { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -272,6 +307,7 @@ namespace ElectronNET.API.Entities
|
|||||||
/// adds a native new tab button to your window's tab bar and allows your app and
|
/// adds a native new tab button to your window's tab bar and allows your app and
|
||||||
/// window to receive the new-window-for-tab event.
|
/// window to receive the new-window-for-tab event.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[SupportedOSPlatform("macos")]
|
||||||
public string TabbingIdentifier { get; set; }
|
public string TabbingIdentifier { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -283,16 +319,39 @@ namespace ElectronNET.API.Entities
|
|||||||
/// A proxy to set on creation in the format host:port.
|
/// A proxy to set on creation in the format host:port.
|
||||||
/// The proxy can be alternatively set using the BrowserWindow.WebContents.SetProxyAsync function.
|
/// The proxy can be alternatively set using the BrowserWindow.WebContents.SetProxyAsync function.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <remarks>Not documented by MCP base-window-options / browser-window-options.</remarks>
|
||||||
public string Proxy { get; set; }
|
public string Proxy { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The credentials of the Proxy in the format username:password.
|
/// The credentials of the Proxy in the format username:password.
|
||||||
/// These will only be used if the Proxy field is also set.
|
/// These will only be used if the Proxy field is also set.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <remarks>Not documented by MCP base-window-options / browser-window-options.</remarks>
|
||||||
public string ProxyCredentials { get; set; }
|
public string ProxyCredentials { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets whether to use pre-Lion fullscreen on macOS. Default is false.
|
||||||
|
/// </summary>
|
||||||
|
[SupportedOSPlatform("macos")]
|
||||||
|
public bool SimpleFullscreen { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets whether the window should be hidden when the user toggles into mission control (macOS).
|
||||||
|
/// </summary>
|
||||||
|
[SupportedOSPlatform("macos")]
|
||||||
|
public bool HiddenInMissionControl { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets how the material appearance should reflect window activity state on macOS. Must be used with the vibrancy property.
|
||||||
|
/// Possible values: 'followWindow' (default), 'active', 'inactive'.
|
||||||
|
/// </summary>
|
||||||
|
[SupportedOSPlatform("macos")]
|
||||||
|
public string VisualEffectState { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the system-drawn background material on Windows. Can be 'auto', 'none', 'mica', 'acrylic' or 'tabbed'.
|
||||||
|
/// </summary>
|
||||||
|
[SupportedOSPlatform("windows")]
|
||||||
|
public string BackgroundMaterial { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -3,6 +3,7 @@
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <remarks>Up-to-date with Electron API 39.2</remarks>
|
||||||
public class CPUUsage
|
public class CPUUsage
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -11,9 +12,14 @@
|
|||||||
public double PercentCPUUsage { get; set; }
|
public double PercentCPUUsage { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The number of average idle cpu wakeups per second since the last call to
|
/// Total seconds of CPU time used since process startup, if available.
|
||||||
/// getCPUUsage.First call returns 0.
|
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public int IdleWakeupsPerSecond { get; set; }
|
public double? CumulativeCPUUsage { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The number of average idle CPU wakeups per second since the last call to
|
||||||
|
/// getCPUUsage. First call returns 0. Will always return 0 on Windows.
|
||||||
|
/// </summary>
|
||||||
|
public double IdleWakeupsPerSecond { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -3,6 +3,7 @@
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <remarks>Up-to-date with Electron API 39.2</remarks>
|
||||||
public class Certificate
|
public class Certificate
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <remarks>Up-to-date with Electron API 39.2</remarks>
|
||||||
public class CertificatePrincipal
|
public class CertificatePrincipal
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <remarks>Up-to-date with Electron API 39.2</remarks>
|
||||||
public class CertificateTrustDialogOptions
|
public class CertificateTrustDialogOptions
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Provide metadata about the current loaded Chrome extension
|
/// Provide metadata about the current loaded Chrome extension
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <yremarks>Project-specific: no matching Electron structure found in MCP docs (electronjs).</yremarks>
|
||||||
public class ChromeExtensionInfo
|
public class ChromeExtensionInfo
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -26,4 +27,4 @@
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public string Version { get; set; }
|
public string Version { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -3,6 +3,7 @@
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <remarks>Up-to-date with Electron API 39.2</remarks>
|
||||||
public class ClearStorageDataOptions
|
public class ClearStorageDataOptions
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -11,14 +12,17 @@
|
|||||||
public string Origin { get; set; }
|
public string Origin { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The types of storages to clear, can contain: appcache, cookies, filesystem,
|
/// The types of storages to clear. Can contain: cookies, filesystem, indexdb,
|
||||||
/// indexdb, localstorage, shadercache, websql, serviceworkers, cachestorage.
|
/// localstorage, shadercache, websql, serviceworkers, cachestorage.
|
||||||
|
/// If not specified, all storage types are cleared.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string[] Storages { get; set; }
|
public string[] Storages { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The types of quotas to clear, can contain: temporary, persistent, syncable.
|
/// The types of quotas to clear. Can contain: temporary. If not specified,
|
||||||
|
/// all quotas are cleared. The <c>quotas</c> option is deprecated;
|
||||||
|
/// "temporary" is the only remaining supported quota type.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string[] Quotas { get; set; }
|
public string[] Quotas { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,53 +1,59 @@
|
|||||||
namespace ElectronNET.API.Entities
|
namespace ElectronNET.API.Entities
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Cookie structure as used by Electron session.cookies APIs.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <remarks>Up-to-date with Electron API 39.2</remarks>
|
||||||
public class Cookie
|
public class Cookie
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The name of the cookie.
|
/// Gets or sets the name of the cookie.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string Name { get; set; }
|
public string Name { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The value of the cookie.
|
/// Gets or sets the value of the cookie.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string Value { get; set; }
|
public string Value { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// (optional) - The domain of the cookie; this will be normalized with a preceding dot so that it's also valid for subdomains.
|
/// Gets or sets the domain of the cookie; this will be normalized with a preceding dot so that it's also valid for subdomains.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string Domain { get; set; }
|
public string Domain { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// (optional) - Whether the cookie is a host-only cookie; this will only be true if no domain was passed.
|
/// Gets or sets a value indicating whether the cookie is a host-only cookie; this will only be true if no domain was passed.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool HostOnly { get; set; }
|
public bool? HostOnly { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// (optional) - The path of the cookie.
|
/// Gets or sets the path of the cookie.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string Path { get; set; }
|
public string Path { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// (optional) - Whether the cookie is marked as secure.
|
/// Gets or sets a value indicating whether the cookie is marked as secure.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool Secure { get; set; }
|
public bool? Secure { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// (optional) - Whether the cookie is marked as HTTP only.
|
/// Gets or sets a value indicating whether the cookie is marked as HTTP only.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool HttpOnly { get; set; }
|
public bool? HttpOnly { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// (optional) - Whether the cookie is a session cookie or a persistent cookie with an expiration date.
|
/// Gets or sets a value indicating whether the cookie is a session cookie or a persistent cookie with an expiration date.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool Session { get; set; }
|
public bool? Session { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// (optional) - The expiration date of the cookie as the number of seconds since the UNIX epoch. Not provided for session cookies.
|
/// Gets or sets the expiration date of the cookie as the number of seconds since the UNIX epoch. Not provided for session cookies.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public long ExpirationDate { get; set; }
|
public double? ExpirationDate { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the SameSite policy applied to this cookie. Can be "unspecified", "no_restriction", "lax" or "strict".
|
||||||
|
/// </summary>
|
||||||
|
public string SameSite { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,17 +1,15 @@
|
|||||||
|
|
||||||
using System.Text.Json.Serialization;
|
|
||||||
|
|
||||||
namespace ElectronNET.API.Entities
|
namespace ElectronNET.API.Entities
|
||||||
{
|
{
|
||||||
|
using System.Text.Json.Serialization;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The cause of the change
|
/// The cause of the cookie change (per Electron Cookies 'changed' event).
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public enum CookieChangedCause
|
public enum CookieChangedCause
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///The cookie was changed directly by a consumer's action.
|
/// The cookie was changed directly by a consumer's action.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[JsonPropertyName("explicit")]
|
|
||||||
@explicit,
|
@explicit,
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -20,19 +18,19 @@ namespace ElectronNET.API.Entities
|
|||||||
overwrite,
|
overwrite,
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The cookie was automatically removed as it expired.
|
/// The cookie was automatically removed as it expired.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
expired,
|
expired,
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The cookie was automatically evicted during garbage collection.
|
/// The cookie was automatically evicted during garbage collection.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
evicted,
|
evicted,
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The cookie was overwritten with an already-expired expiration date.
|
/// The cookie was overwritten with an already-expired expiration date.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[JsonPropertyName("expired_overwrite")]
|
[JsonPropertyName("expired_overwrite")]
|
||||||
expiredOverwrite
|
expiredOverwrite
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -5,54 +5,59 @@ namespace ElectronNET.API.Entities
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <remarks>Up-to-date with Electron API 39.2</remarks>
|
||||||
public class CookieDetails
|
public class CookieDetails
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The URL to associate the cookie with. The callback will be rejected if the URL is invalid.
|
/// Gets or sets the URL to associate the cookie with. The operation will be rejected if the URL is invalid.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string Url { get; set; }
|
public string Url { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// (optional) - The name of the cookie. Empty by default if omitted.
|
/// Gets or sets the name of the cookie. Empty by default if omitted.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[DefaultValue("")]
|
[DefaultValue("")]
|
||||||
public string Name { get; set; }
|
public string Name { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// (optional) - The value of the cookie. Empty by default if omitted.
|
/// Gets or sets the value of the cookie. Empty by default if omitted.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[DefaultValue("")]
|
[DefaultValue("")]
|
||||||
public string Value { get; set; }
|
public string Value { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// (optional) - The domain of the cookie; this will be normalized with a preceding dot so that it's also valid for subdomains. Empty by default if omitted.
|
/// Gets or sets the domain of the cookie; this will be normalized with a preceding dot so that it's also valid for subdomains. Empty by default if omitted.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[DefaultValue("")]
|
[DefaultValue("")]
|
||||||
public string Domain { get; set; }
|
public string Domain { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// (optional) - The path of the cookie. Empty by default if omitted.
|
/// Gets or sets the path of the cookie. Empty by default if omitted.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[DefaultValue("")]
|
[DefaultValue("")]
|
||||||
public string Path { get; set; }
|
public string Path { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// (optional) - Whether the cookie is marked as secure. Defaults to false.
|
/// Gets or sets a value indicating whether the cookie should be marked as secure. Defaults to false unless the SameSite policy is set to <c>no_restriction</c> (SameSite=None).
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[DefaultValue(false)]
|
[DefaultValue(false)]
|
||||||
public bool Secure { get; set; }
|
public bool Secure { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// (optional) - Whether the cookie is marked as HTTP only. Defaults to false.
|
/// Gets or sets a value indicating whether the cookie should be marked as HTTP only. Defaults to false.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[DefaultValue(false)]
|
[DefaultValue(false)]
|
||||||
public bool HttpOnly { get; set; }
|
public bool HttpOnly { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// (optional) - The expiration date of the cookie as the number of seconds since the UNIX epoch.
|
/// Gets or sets the expiration date of the cookie as the number of seconds since the UNIX epoch. If omitted, the cookie becomes a session cookie and will not be retained between sessions.
|
||||||
/// If omitted then the cookie becomes a session cookie and will not be retained between sessions.
|
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[DefaultValue(0)]
|
[DefaultValue(0)]
|
||||||
public long ExpirationDate { get; set; }
|
public double ExpirationDate { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the SameSite policy to apply to this cookie. Can be "unspecified", "no_restriction", "lax" or "strict". Default is "lax".
|
||||||
|
/// </summary>
|
||||||
|
public string SameSite { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -3,10 +3,11 @@
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <remarks>Up-to-date with Electron API 39.2</remarks>
|
||||||
public class CookieFilter
|
public class CookieFilter
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// (optional) - Retrieves cookies which are associated with url.Empty implies retrieving cookies of all URLs.
|
/// (optional) - Retrieves cookies which are associated with url. Empty implies retrieving cookies of all URLs.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string Url { get; set; }
|
public string Url { get; set; }
|
||||||
|
|
||||||
@@ -28,11 +29,16 @@
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// (optional) - Filters cookies by their Secure property.
|
/// (optional) - Filters cookies by their Secure property.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool Secure { get; set; }
|
public bool? Secure { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// (optional) - Filters out session or persistent cookies.
|
/// (optional) - Filters out session or persistent cookies.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool Session { get; set; }
|
public bool? Session { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// (optional) - Filters cookies by httpOnly.
|
||||||
|
/// </summary>
|
||||||
|
public bool? HttpOnly { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -3,21 +3,22 @@
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <remarks>Up-to-date with Electron API 39.2</remarks>
|
||||||
public class CreateFromBitmapOptions
|
public class CreateFromBitmapOptions
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the width
|
/// Gets or sets the width in pixels. Required for nativeImage.createFromBitmap(buffer, options).
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public int? Width { get; set; }
|
public int? Width { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the height
|
/// Gets or sets the height in pixels. Required for nativeImage.createFromBitmap(buffer, options).
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public int? Height { get; set; }
|
public int? Height { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the scalefactor
|
/// Gets or sets the image scale factor. Optional, defaults to 1.0.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public float ScaleFactor { get; set; } = 1.0f;
|
public float ScaleFactor { get; set; } = 1.0f;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -3,20 +3,21 @@ namespace ElectronNET.API.Entities
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <remarks>Up-to-date with Electron API 39.2</remarks>
|
||||||
public class CreateFromBufferOptions
|
public class CreateFromBufferOptions
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the width
|
/// Gets or sets the width. Required for bitmap buffers passed to nativeImage.createFromBuffer.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public int? Width { get; set; }
|
public int? Width { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the height
|
/// Gets or sets the height. Required for bitmap buffers passed to nativeImage.createFromBuffer.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public int? Height { get; set; }
|
public int? Height { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the scalefactor
|
/// The image scale factor. Optional, defaults to 1.0.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public float ScaleFactor { get; set; } = 1.0f;
|
public float ScaleFactor { get; set; } = 1.0f;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <remarks>Up-to-date with Electron API 39.2</remarks>
|
||||||
public class CreateInterruptedDownloadOptions
|
public class CreateInterruptedDownloadOptions
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -16,7 +17,7 @@
|
|||||||
public string[] UrlChain { get; set; }
|
public string[] UrlChain { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// (optional) - MIME type of the download.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string MimeType { get; set; }
|
public string MimeType { get; set; }
|
||||||
|
|
||||||
@@ -41,9 +42,10 @@
|
|||||||
public string ETag { get; set; }
|
public string ETag { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Time when download was started in number of seconds since UNIX epoch.
|
/// (optional) - Time when download was started in number of seconds since UNIX epoch.
|
||||||
|
/// Electron documents this as a Number (Double).
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public int StartTime { get; set; }
|
public double? StartTime { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
@@ -64,4 +66,4 @@
|
|||||||
ETag = eTag;
|
ETag = eTag;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -21,6 +21,12 @@
|
|||||||
/// </value>
|
/// </value>
|
||||||
public string Html { get; set; }
|
public string Html { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the image.
|
||||||
|
/// Maps to clipboard.write({ image: NativeImage }).
|
||||||
|
/// </summary>
|
||||||
|
public NativeImage Image { get; set; }
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the RTF.
|
/// Gets or sets the RTF.
|
||||||
|
|||||||
@@ -34,5 +34,10 @@
|
|||||||
/// Defaults to Impact.
|
/// Defaults to Impact.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string Fantasy { get; set; }
|
public string Fantasy { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Defaults to Latin Modern Math.
|
||||||
|
/// </summary>
|
||||||
|
public string Math { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,9 +1,9 @@
|
|||||||
namespace ElectronNET.API.Entities
|
namespace ElectronNET.API.Entities
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Opens the devtools with specified dock state, can be right, bottom, undocked,
|
/// Opens the devtools with specified dock state, can be left, right, bottom, undocked,
|
||||||
/// detach.Defaults to last used dock state.In undocked mode it's possible to dock
|
/// detach. Defaults to last used dock state. In undocked mode it's possible to dock
|
||||||
/// back.In detach mode it's not.
|
/// back. In detach mode it's not.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public enum DevToolsMode
|
public enum DevToolsMode
|
||||||
{
|
{
|
||||||
@@ -25,6 +25,11 @@
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// The detach
|
/// The detach
|
||||||
/// </summary>
|
/// </summary>
|
||||||
detach
|
detach,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The left
|
||||||
|
/// </summary>
|
||||||
|
left,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -3,10 +3,11 @@
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <remarks>Up-to-date with Electron API 39.2</remarks>
|
||||||
public class Display
|
public class Display
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Can be available, unavailable, unknown.
|
/// Gets or sets the accelerometer support status; can be 'available', 'unavailable', or 'unknown'.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string AccelerometerSupport { get; set; }
|
public string AccelerometerSupport { get; set; }
|
||||||
|
|
||||||
@@ -19,57 +20,72 @@
|
|||||||
public Rectangle Bounds { get; set; }
|
public Rectangle Bounds { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The number of bits per pixel.
|
/// Gets or sets the number of bits per pixel.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public int ColorDepth { get; set; }
|
public int ColorDepth { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Represent a color space (three-dimensional object which contains all realizable color combinations) for the purpose of color conversions.
|
/// Gets or sets the color space description used for color conversions.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string ColorSpace { get; set; }
|
public string ColorSpace { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The number of bits per color component.
|
/// Gets or sets the number of bits per color component.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public int DepthPerComponent { get; set; }
|
public int DepthPerComponent { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The display refresh rate.
|
/// Gets or sets a value indicating whether the display is detected by the system.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public int DisplayFrequency { get; set; }
|
public bool Detected { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Unique identifier associated with the display.
|
/// Gets or sets the display refresh rate.
|
||||||
|
/// </summary>
|
||||||
|
public double DisplayFrequency { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the unique identifier associated with the display. A value of -1 means the display is invalid or the correct id is not yet known, and a value of -10 means the display is a virtual display assigned to a unified desktop.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public long Id { get; set; }
|
public long Id { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// true for an internal display and false for an external display.
|
/// Gets or sets a value indicating whether the display is internal (true) or external (false).
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool Internal { get; set; }
|
public bool Internal { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// User-friendly label, determined by the platform.
|
/// Gets or sets the user-friendly label, determined by the platform.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string Label { get; set; }
|
public string Label { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Can be 0, 90, 180, 270, represents screen rotation in clock-wise degrees.
|
/// Gets or sets the maximum cursor size in native pixels.
|
||||||
|
/// </summary>
|
||||||
|
public Size MaximumCursorSize { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the display's origin in pixel coordinates. Only available on windowing systems that position displays in pixel coordinates (e.g., X11).
|
||||||
|
/// </summary>
|
||||||
|
public Point NativeOrigin { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the screen rotation in clock-wise degrees. Can be 0, 90, 180, or 270.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public int Rotation { get; set; }
|
public int Rotation { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Output device's pixel scale factor.
|
/// Gets or sets the output device's pixel scale factor.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public double ScaleFactor { get; set; }
|
public double ScaleFactor { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Can be available, unavailable, unknown.
|
/// Gets or sets the touch support status; can be 'available', 'unavailable', or 'unknown'.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string TouchSupport { get; set; }
|
public string TouchSupport { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Whether or not the display is a monochrome display.
|
/// Gets or sets a value indicating whether the display is monochrome.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool Monochrome { get; set; }
|
public bool Monochrome { get; set; }
|
||||||
|
|
||||||
@@ -82,10 +98,10 @@
|
|||||||
public Size Size { get; set; }
|
public Size Size { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the work area.
|
/// Gets or sets the work area of the display in DIP points.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>
|
/// <value>
|
||||||
/// The work area.
|
/// The work area of the display in DIP points.
|
||||||
/// </value>
|
/// </value>
|
||||||
public Rectangle WorkArea { get; set; }
|
public Rectangle WorkArea { get; set; }
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,21 @@
|
|||||||
namespace ElectronNET.API
|
using System.Runtime.Versioning;
|
||||||
|
|
||||||
|
namespace ElectronNET.API
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
public enum DisplayBalloonIconType
|
||||||
|
{
|
||||||
|
none,
|
||||||
|
info,
|
||||||
|
warning,
|
||||||
|
error,
|
||||||
|
custom
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <remarks>Up-to-date with Electron API 39.2</remarks>
|
||||||
|
[SupportedOSPlatform("Windows")]
|
||||||
public class DisplayBalloonOptions
|
public class DisplayBalloonOptions
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -28,5 +41,29 @@
|
|||||||
/// The content.
|
/// The content.
|
||||||
/// </value>
|
/// </value>
|
||||||
public string Content { get; set; }
|
public string Content { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// (optional) - Icon type for the balloon: none, info, warning, error or custom.
|
||||||
|
/// Default is custom.
|
||||||
|
/// </summary>
|
||||||
|
public DisplayBalloonIconType IconType { get; set; } = DisplayBalloonIconType.custom;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// (optional) - Use the large version of the icon. Default is true.
|
||||||
|
/// Maps to Windows NIIF_LARGE_ICON.
|
||||||
|
/// </summary>
|
||||||
|
public bool LargeIcon { get; set; } = true;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// (optional) - Do not play the associated sound. Default is false.
|
||||||
|
/// Maps to Windows NIIF_NOSOUND.
|
||||||
|
/// </summary>
|
||||||
|
public bool NoSound { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// (optional) - Do not display the balloon if the current user is in "quiet time".
|
||||||
|
/// Default is false. Maps to Windows NIIF_RESPECT_QUIET_TIME.
|
||||||
|
/// </summary>
|
||||||
|
public bool RespectQuietTime { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,10 +1,13 @@
|
|||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
|
using System.Runtime.Versioning;
|
||||||
|
|
||||||
namespace ElectronNET.API.Entities
|
namespace ElectronNET.API.Entities
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Defines the DockBounceType enumeration.
|
/// Defines the DockBounceType enumeration.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <remarks>Up-to-date with Electron API 39.2</remarks>
|
||||||
|
[SupportedOSPlatform("macOS")]
|
||||||
public enum DockBounceType
|
public enum DockBounceType
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <remarks>Up-to-date with Electron API 39.2</remarks>
|
||||||
public class EnableNetworkEmulationOptions
|
public class EnableNetworkEmulationOptions
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -12,17 +13,20 @@
|
|||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// RTT in ms. Defaults to 0 which will disable latency throttling.
|
/// RTT in ms. Defaults to 0 which will disable latency throttling.
|
||||||
|
/// Electron documents this as a Number (Double).
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public int Latency { get; set; }
|
public double Latency { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Download rate in Bps. Defaults to 0 which will disable download throttling.
|
/// Download rate in Bps. Defaults to 0 which will disable download throttling.
|
||||||
|
/// Electron documents this as a Number (Double).
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public int DownloadThroughput { get; set; }
|
public double DownloadThroughput { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Upload rate in Bps. Defaults to 0 which will disable upload throttling.
|
/// Upload rate in Bps. Defaults to 0 which will disable upload throttling.
|
||||||
|
/// Electron documents this as a Number (Double).
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public int UploadThroughput { get; set; }
|
public double UploadThroughput { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -3,6 +3,7 @@
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Docs: https://electronjs.org/docs/api/structures/extension
|
/// Docs: https://electronjs.org/docs/api/structures/extension
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <remarks>Up-to-date with Electron API 39.2</remarks>
|
||||||
public class Extension
|
public class Extension
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -35,4 +36,4 @@
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public string Version { get; set; }
|
public string Version { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -3,6 +3,7 @@
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <remarks>Up-to-date with Electron API 39.2</remarks>
|
||||||
public class FileFilter
|
public class FileFilter
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@@ -3,14 +3,13 @@
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <remarks>Up-to-date with Electron API 39.2</remarks>
|
||||||
public class FileIconOptions
|
public class FileIconOptions
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the size.
|
/// The requested icon size string passed to app.getFileIcon:
|
||||||
|
/// "small" (16x16), "normal" (32x32), or "large" (48x48 on Linux, 32x32 on Windows; unsupported on macOS).
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>
|
|
||||||
/// The size.
|
|
||||||
/// </value>
|
|
||||||
public string Size { get; private set; }
|
public string Size { get; private set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@@ -1,23 +1,28 @@
|
|||||||
namespace ElectronNET.API.Entities
|
using System.Runtime.Versioning;
|
||||||
|
|
||||||
|
namespace ElectronNET.API.Entities
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <remarks>Up-to-date with Electron API 39.2</remarks>
|
||||||
public enum FileIconSize
|
public enum FileIconSize
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The small
|
/// small - 16x16 (per app.getFileIcon size mapping).
|
||||||
/// </summary>
|
/// </summary>
|
||||||
small,
|
small,
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The normal
|
/// normal - 32x32 (per app.getFileIcon size mapping).
|
||||||
/// </summary>
|
/// </summary>
|
||||||
normal,
|
normal,
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The large
|
/// large - 48x48 on Linux, 32x32 on Windows, unsupported on macOS (per app.getFileIcon size mapping).
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[SupportedOSPlatform("Linux")]
|
||||||
|
[SupportedOSPlatform("Windows")]
|
||||||
large
|
large
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
24
src/ElectronNET.API/API/Entities/FindInPageOptions.cs
Normal file
24
src/ElectronNET.API/API/Entities/FindInPageOptions.cs
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
namespace ElectronNET.API.Entities
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Options for <see cref="WebContents.FindInPageAsync"/>.
|
||||||
|
/// </summary>
|
||||||
|
public class FindInPageOptions
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Whether to search forward or backward, defaults to true.
|
||||||
|
/// </summary>
|
||||||
|
public bool? Forward { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Whether to begin a new text finding session with this request. Should be true
|
||||||
|
/// for initial requests, and false for subsequent requests. Defaults to false.
|
||||||
|
/// </summary>
|
||||||
|
public bool? FindNext { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Whether search should be case-sensitive, defaults to false.
|
||||||
|
/// </summary>
|
||||||
|
public bool? MatchCase { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,15 +1,18 @@
|
|||||||
namespace ElectronNET.API.Entities
|
using System.Runtime.Versioning;
|
||||||
|
|
||||||
|
namespace ElectronNET.API.Entities
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Controls the behavior of <see cref="App.Focus(FocusOptions)"/>.
|
/// Controls the behavior of <see cref="App.Focus(FocusOptions)"/>.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <remarks>Up-to-date with Electron API 39.2</remarks>
|
||||||
public class FocusOptions
|
public class FocusOptions
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Make the receiver the active app even if another app is currently active.
|
/// Make the receiver the active app even if another app is currently active.
|
||||||
/// <para/>
|
/// You should seek to use the steal option as sparingly as possible.
|
||||||
/// You should seek to use the <see cref="Steal"/> option as sparingly as possible.
|
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[SupportedOSPlatform("macOS")]
|
||||||
public bool Steal { get; set; }
|
public bool Steal { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
33
src/ElectronNET.API/API/Entities/FoundInPageResult.cs
Normal file
33
src/ElectronNET.API/API/Entities/FoundInPageResult.cs
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
namespace ElectronNET.API.Entities
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// The result of a text finding session, reported by the found-in-page event.
|
||||||
|
/// </summary>
|
||||||
|
public class FoundInPageResult
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// The identifier of the request returned by FindInPageAsync.
|
||||||
|
/// </summary>
|
||||||
|
public int RequestId { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Position of the active match.
|
||||||
|
/// </summary>
|
||||||
|
public int ActiveMatchOrdinal { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Number of matches.
|
||||||
|
/// </summary>
|
||||||
|
public int Matches { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Coordinates of the first match region.
|
||||||
|
/// </summary>
|
||||||
|
public Rectangle SelectionArea { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Indicates whether more responses are to follow.
|
||||||
|
/// </summary>
|
||||||
|
public bool FinalUpdate { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,85 +1,99 @@
|
|||||||
|
|
||||||
using System.Text.Json.Serialization;
|
using System.Text.Json.Serialization;
|
||||||
|
|
||||||
namespace ElectronNET.API.Entities
|
namespace ElectronNET.API.Entities
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
/// Graphics Feature Status from chrome://gpu/ as returned by app.getGPUFeatureStatus().
|
||||||
|
/// Each field reflects the status of a GPU capability reported by Chromium.
|
||||||
///
|
///
|
||||||
|
/// Possible values for all fields:
|
||||||
|
/// - disabled_software: Software only. Hardware acceleration disabled (yellow)
|
||||||
|
/// - disabled_off: Disabled (red)
|
||||||
|
/// - disabled_off_ok: Disabled (yellow)
|
||||||
|
/// - unavailable_software: Software only, hardware acceleration unavailable (yellow)
|
||||||
|
/// - unavailable_off: Unavailable (red)
|
||||||
|
/// - unavailable_off_ok: Unavailable (yellow)
|
||||||
|
/// - enabled_readback: Hardware accelerated but at reduced performance (yellow)
|
||||||
|
/// - enabled_force: Hardware accelerated on all pages (green)
|
||||||
|
/// - enabled: Hardware accelerated (green)
|
||||||
|
/// - enabled_on: Enabled (green)
|
||||||
|
/// - enabled_force_on: Force enabled (green)
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <remarks>Up-to-date with Electron API 39.2</remarks>
|
||||||
public class GPUFeatureStatus
|
public class GPUFeatureStatus
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Canvas.
|
/// Gets or sets the status for Canvas.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[JsonPropertyName("2d_canvas")]
|
[JsonPropertyName("2d_canvas")]
|
||||||
public string Canvas { get; set; }
|
public string Canvas { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Flash.
|
/// Gets or sets the status for Flash.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[JsonPropertyName("flash_3d")]
|
[JsonPropertyName("flash_3d")]
|
||||||
public string Flash3D { get; set; }
|
public string Flash3D { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Flash Stage3D.
|
/// Gets or sets the status for Flash Stage3D.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[JsonPropertyName("flash_stage3d")]
|
[JsonPropertyName("flash_stage3d")]
|
||||||
public string FlashStage3D { get; set; }
|
public string FlashStage3D { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Flash Stage3D Baseline profile.
|
/// Gets or sets the status for Flash Stage3D Baseline profile.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[JsonPropertyName("flash_stage3d_baseline")]
|
[JsonPropertyName("flash_stage3d_baseline")]
|
||||||
public string FlashStage3dBaseline { get; set; }
|
public string FlashStage3dBaseline { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Compositing.
|
/// Gets or sets the status for Compositing.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[JsonPropertyName("gpu_compositing")]
|
[JsonPropertyName("gpu_compositing")]
|
||||||
public string GpuCompositing { get; set; }
|
public string GpuCompositing { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Multiple Raster Threads.
|
/// Gets or sets the status for Multiple Raster Threads.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[JsonPropertyName("multiple_raster_threads")]
|
[JsonPropertyName("multiple_raster_threads")]
|
||||||
public string MultipleRasterThreads { get; set; }
|
public string MultipleRasterThreads { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Native GpuMemoryBuffers.
|
/// Gets or sets the status for Native GpuMemoryBuffers.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[JsonPropertyName("native_gpu_memory_buffers")]
|
[JsonPropertyName("native_gpu_memory_buffers")]
|
||||||
public string NativeGpuMemoryBuffers { get; set; }
|
public string NativeGpuMemoryBuffers { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Rasterization.
|
/// Gets or sets the status for Rasterization.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string Rasterization { get; set; }
|
public string Rasterization { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Video Decode.
|
/// Gets or sets the status for Video Decode.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[JsonPropertyName("video_decode")]
|
[JsonPropertyName("video_decode")]
|
||||||
public string VideoDecode { get; set; }
|
public string VideoDecode { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Video Encode.
|
/// Gets or sets the status for Video Encode.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[JsonPropertyName("video_encode")]
|
[JsonPropertyName("video_encode")]
|
||||||
public string VideoEncode { get; set; }
|
public string VideoEncode { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// VPx Video Decode.
|
/// Gets or sets the status for VPx Video Decode.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[JsonPropertyName("vpx_decode")]
|
[JsonPropertyName("vpx_decode")]
|
||||||
public string VpxDecode { get; set; }
|
public string VpxDecode { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// WebGL.
|
/// Gets or sets the status for WebGL.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string Webgl { get; set; }
|
public string Webgl { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// WebGL2.
|
/// Gets or sets the status for WebGL2.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string Webgl2 { get; set; }
|
public string Webgl2 { get; set; }
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,15 +1,17 @@
|
|||||||
namespace ElectronNET.API.Entities
|
namespace ElectronNET.API.Entities
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Interface to use Electrons PostData Object
|
/// Represents a postData item for loadURL/webContents.loadURL options.
|
||||||
|
/// Valid types per Electron docs: 'rawData' and 'file'.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <remarks>Up-to-date with Electron API 39.2</remarks>
|
||||||
public interface IPostData
|
public interface IPostData
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// One of the following:
|
/// One of the following:
|
||||||
/// rawData - <see cref="UploadRawData"/> The data is available as a Buffer, in the rawData field.
|
/// rawData - <see cref="UploadRawData"/>.
|
||||||
/// file - <see cref="UploadFile"/> The object represents a file. The filePath, offset, length and modificationTime fields will be used to describe the file.
|
/// file - <see cref="UploadFile"/>.
|
||||||
/// blob - <see cref="Blob"/> The object represents a Blob. The blobUUID field will be used to describe the Blob.
|
/// Based on Electron postData definitions.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string Type { get; }
|
public string Type { get; }
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,8 +1,12 @@
|
|||||||
namespace ElectronNET.API.Entities
|
using System.Runtime.Versioning;
|
||||||
|
|
||||||
|
namespace ElectronNET.API.Entities
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Options for app.importCertificate(options) on Linux.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <remarks>Up-to-date with Electron API 39.2</remarks>
|
||||||
|
[SupportedOSPlatform("linux")]
|
||||||
public class ImportCertificateOptions
|
public class ImportCertificateOptions
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@@ -6,8 +6,10 @@ namespace ElectronNET.API.Entities
|
|||||||
using System.Text.Json.Serialization;
|
using System.Text.Json.Serialization;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Input event payload as used by webContents 'input-event' and 'before-input-event'.
|
||||||
|
/// Fields map to KeyboardEvent properties where noted, and type/modifiers follow Electron's InputEvent structure.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <remarks>Up-to-date with Electron API 39.2</remarks>
|
||||||
public class InputEvent
|
public class InputEvent
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -57,15 +59,95 @@ namespace ElectronNET.API.Entities
|
|||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// An array of modifiers of the event, can be `shift`, `control`, `ctrl`, `alt`,
|
/// An array of modifiers of the event, can be `shift`, `control`, `ctrl`, `alt`,
|
||||||
/// `meta`, `command`, `cmd`, `isKeypad`, `isAutoRepeat`, `leftButtonDown`,
|
/// `meta`, `command`, `cmd`, `iskeypad`, `isautorepeat`, `leftbuttondown`,
|
||||||
/// `middleButtonDown`, `rightButtonDown`, `capsLock`, `numLock`, `left`, `right`
|
/// `middlebuttondown`, `rightbuttondown`, `capslock`, `numlock`, `left`, `right`.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[JsonConverter(typeof(ModifierTypeListConverter))]
|
[JsonConverter(typeof(ModifierTypeListConverter))]
|
||||||
public List<ModifierType> Modifiers { get; set; }
|
public List<ModifierType> Modifiers { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// For MouseInputEvent: The x-coordinate of the event (Integer).
|
||||||
|
/// </summary>
|
||||||
|
public int? X { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// For MouseInputEvent: The y-coordinate of the event (Integer).
|
||||||
|
/// </summary>
|
||||||
|
public int? Y { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// For MouseInputEvent: The button pressed, can be 'left', 'middle', or 'right' (optional).
|
||||||
|
/// </summary>
|
||||||
|
public string Button { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// For MouseInputEvent: Global x in screen coordinates (Integer, optional).
|
||||||
|
/// </summary>
|
||||||
|
public int? GlobalX { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// For MouseInputEvent: Global y in screen coordinates (Integer, optional).
|
||||||
|
/// </summary>
|
||||||
|
public int? GlobalY { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// For MouseInputEvent: Movement delta on x-axis since last event (Integer, optional).
|
||||||
|
/// </summary>
|
||||||
|
public int? MovementX { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// For MouseInputEvent: Movement delta on y-axis since last event (Integer, optional).
|
||||||
|
/// </summary>
|
||||||
|
public int? MovementY { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// For MouseInputEvent: Click count (Integer, optional).
|
||||||
|
/// </summary>
|
||||||
|
public int? ClickCount { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// For MouseWheelInputEvent: Horizontal scroll delta (Integer, optional).
|
||||||
|
/// </summary>
|
||||||
|
public int? DeltaX { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// For MouseWheelInputEvent: Vertical scroll delta (Integer, optional).
|
||||||
|
/// </summary>
|
||||||
|
public int? DeltaY { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// For MouseWheelInputEvent: Horizontal wheel ticks (Integer, optional).
|
||||||
|
/// </summary>
|
||||||
|
public int? WheelTicksX { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// For MouseWheelInputEvent: Vertical wheel ticks (Integer, optional).
|
||||||
|
/// </summary>
|
||||||
|
public int? WheelTicksY { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// For MouseWheelInputEvent: Horizontal acceleration ratio (Integer, optional).
|
||||||
|
/// </summary>
|
||||||
|
public int? AccelerationRatioX { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// For MouseWheelInputEvent: Vertical acceleration ratio (Integer, optional).
|
||||||
|
/// </summary>
|
||||||
|
public int? AccelerationRatioY { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// For MouseWheelInputEvent: True if wheel deltas are precise (optional).
|
||||||
|
/// </summary>
|
||||||
|
public bool? HasPreciseScrollingDeltas { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// For MouseWheelInputEvent: True if the target can scroll (optional).
|
||||||
|
/// </summary>
|
||||||
|
public bool? CanScroll { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Can be `undefined`, `mouseDown`, `mouseUp`, `mouseMove`, `mouseEnter`,
|
/// Can be `undefined`, `mouseDown`, `mouseUp`, `mouseMove`, `mouseEnter`,
|
||||||
/// `mouseLeave`, `contextMenu`, `mouseWheel`, `rawKeyDown`, `keyDown`, `keyUp`,
|
/// `mouseLeave`, `contextMenu`, `mouseWheel`, `rawKeyDown`, `keyDown`, `keyUp`, `char`,
|
||||||
/// `gestureScrollBegin`, `gestureScrollEnd`, `gestureScrollUpdate`,
|
/// `gestureScrollBegin`, `gestureScrollEnd`, `gestureScrollUpdate`,
|
||||||
/// `gestureFlingStart`, `gestureFlingCancel`, `gesturePinchBegin`,
|
/// `gestureFlingStart`, `gestureFlingCancel`, `gesturePinchBegin`,
|
||||||
/// `gesturePinchEnd`, `gesturePinchUpdate`, `gestureTapDown`, `gestureShowPress`,
|
/// `gesturePinchEnd`, `gesturePinchUpdate`, `gestureTapDown`, `gestureShowPress`,
|
||||||
@@ -77,6 +159,4 @@ namespace ElectronNET.API.Entities
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public InputEventType Type { get; set; }
|
public InputEventType Type { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -60,6 +60,11 @@ public enum InputEventType
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
keyUp,
|
keyUp,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
@char,
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -1,27 +1,29 @@
|
|||||||
|
|
||||||
using System.Text.Json.Serialization;
|
using System.Text.Json.Serialization;
|
||||||
|
using System.Runtime.Versioning;
|
||||||
|
|
||||||
namespace ElectronNET.API.Entities
|
namespace ElectronNET.API.Entities
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Jump List category definition used with app.setJumpList(categories).
|
||||||
|
/// Matches Electron's JumpListCategory structure.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <remarks>Up-to-date with Electron API 39.2</remarks>
|
||||||
|
[SupportedOSPlatform("windows")]
|
||||||
public class JumpListCategory
|
public class JumpListCategory
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Must be set if type is custom, otherwise it should be omitted.
|
/// Gets or sets the name; must be set if <c>type</c> is <c>custom</c>, otherwise it should be omitted.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string Name { get; set; }
|
public string Name { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Array of objects if type is tasks or custom, otherwise it should be omitted.
|
/// Gets or sets the array of <see cref="JumpListItem"/> objects if <c>type</c> is <c>tasks</c> or <c>custom</c>; otherwise it should be omitted.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public JumpListItem[] Items { get; set; }
|
public JumpListItem[] Items { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// One of the following: "tasks" | "frequent" | "recent" | "custom"
|
/// Gets or sets the category type. One of: <c>tasks</c> | <c>frequent</c> | <c>recent</c> | <c>custom</c>.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public JumpListCategoryType Type { get; set; }
|
public JumpListCategoryType Type { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1,8 +1,12 @@
|
|||||||
namespace ElectronNET.API.Entities
|
using System.Runtime.Versioning;
|
||||||
|
|
||||||
|
namespace ElectronNET.API.Entities
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Jump list category kinds for app.setJumpList (Windows).
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <remarks>Up-to-date with Electron API 39.2</remarks>
|
||||||
|
[SupportedOSPlatform("Windows")]
|
||||||
public enum JumpListCategoryType
|
public enum JumpListCategoryType
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@@ -1,59 +1,65 @@
|
|||||||
|
|
||||||
using System.Text.Json.Serialization;
|
using System.Text.Json.Serialization;
|
||||||
|
using System.Runtime.Versioning;
|
||||||
|
|
||||||
namespace ElectronNET.API.Entities
|
namespace ElectronNET.API.Entities
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Jump List item used in app.setJumpList(categories) on Windows.
|
||||||
|
/// Matches Electron's JumpListItem structure.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <remarks>Up-to-date with Electron API 39.2</remarks>
|
||||||
|
[SupportedOSPlatform("windows")]
|
||||||
public class JumpListItem
|
public class JumpListItem
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The command line arguments when program is executed. Should only be set if type is task.
|
/// Gets or sets the command line arguments when <c>program</c> is executed. Should only be set if <c>type</c> is <c>task</c>.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string Args { get; set; }
|
public string Args { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Description of the task (displayed in a tooltip). Should only be set if type is task.
|
/// Gets or sets the description of the task (displayed in a tooltip). Should only be set if <c>type</c> is <c>task</c>. Maximum length 260 characters.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string Description { get; set; }
|
public string Description { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The index of the icon in the resource file. If a resource file contains multiple
|
/// Gets or sets the index of the icon in the resource file. If a resource file contains multiple
|
||||||
/// icons this value can be used to specify the zero-based index of the icon that
|
/// icons this value can be used to specify the zero-based index of the icon that
|
||||||
/// should be displayed for this task.If a resource file contains only one icon,
|
/// should be displayed for this task. If a resource file contains only one icon,
|
||||||
/// this property should be set to zero.
|
/// this property should be set to zero.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public int IconIndex { get; set; }
|
public int IconIndex { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The absolute path to an icon to be displayed in a Jump List, which can be an
|
/// Gets or sets the absolute path to an icon to be displayed in a Jump List, which can be an
|
||||||
/// arbitrary resource file that contains an icon(e.g. .ico, .exe, .dll). You can
|
/// arbitrary resource file that contains an icon(e.g. .ico, .exe, .dll). You can
|
||||||
/// usually specify process.execPath to show the program icon.
|
/// usually specify process.execPath to show the program icon.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string IconPath { get; set; }
|
public string IconPath { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Path of the file to open, should only be set if type is file.
|
/// Gets or sets the path of the file to open; should only be set if <c>type</c> is <c>file</c>.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string Path { get; set; }
|
public string Path { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Path of the program to execute, usually you should specify process.execPath
|
/// Gets or sets the path of the program to execute, usually specify process.execPath
|
||||||
/// which opens the current program.Should only be set if type is task.
|
/// which opens the current program. Should only be set if <c>type</c> is <c>task</c>.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string Program { get; set; }
|
public string Program { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The text to be displayed for the item in the Jump List. Should only be set if type is task.
|
/// Gets or sets the text to be displayed for the item in the Jump List. Should only be set if <c>type</c> is <c>task</c>.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string Title { get; set; }
|
public string Title { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// One of the following: "task" | "separator" | "file"
|
/// Gets or sets the item type. One of: <c>task</c> | <c>separator</c> | <c>file</c>.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public JumpListItemType Type { get; set; }
|
public JumpListItemType Type { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the working directory. Default is empty.
|
||||||
|
/// </summary>
|
||||||
|
public string WorkingDirectory { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -1,8 +1,12 @@
|
|||||||
namespace ElectronNET.API.Entities
|
using System.Runtime.Versioning;
|
||||||
|
|
||||||
|
namespace ElectronNET.API.Entities
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Jump list item kinds for app.setJumpList (Windows).
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <remarks>Up-to-date with Electron API 39.2</remarks>
|
||||||
|
[SupportedOSPlatform("Windows")]
|
||||||
public enum JumpListItemType
|
public enum JumpListItemType
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@@ -1,20 +1,24 @@
|
|||||||
namespace ElectronNET.API.Entities
|
using System.Runtime.Versioning;
|
||||||
|
|
||||||
|
namespace ElectronNET.API.Entities
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Settings returned by app.getJumpListSettings() on Windows.
|
||||||
|
/// Matches Electron's JumpListSettings object.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <remarks>Up-to-date with Electron API 39.2</remarks>
|
||||||
|
[SupportedOSPlatform("windows")]
|
||||||
public class JumpListSettings
|
public class JumpListSettings
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The minimum number of items that will be shown in the Jump List (for a more detailed description of this value see the
|
/// The minimum number of items that will be shown in the Jump List.
|
||||||
/// <see href="https://msdn.microsoft.com/en-us/library/windows/desktop/dd378398(v=vs.85).aspx">MSDN</see> docs).
|
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public int MinItems { get; set; } = 0;
|
public int MinItems { get; set; } = 0;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Array of JumpListItem objects that correspond to items that the user has explicitly removed from custom categories
|
/// Array of JumpListItem objects that correspond to items that the user has explicitly removed from custom categories
|
||||||
/// in the Jump List. These items must not be re-added to the Jump List in the next call to <see cref="App.SetJumpList"/>, Windows will
|
/// in the Jump List. These items must not be re-added to the Jump List in the next call to app.setJumpList(categories);
|
||||||
/// not display any custom category that contains any of the removed items.
|
/// Windows will not display any custom category that contains any of the removed items.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public JumpListItem[] RemovedItems { get; set; } = new JumpListItem[0];
|
public JumpListItem[] RemovedItems { get; set; } = new JumpListItem[0];
|
||||||
}
|
}
|
||||||
|
|||||||
25
src/ElectronNET.API/API/Entities/LoadFileOptions.cs
Normal file
25
src/ElectronNET.API/API/Entities/LoadFileOptions.cs
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
namespace ElectronNET.API.Entities
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Options for loading a local file into a web page.
|
||||||
|
/// </summary>
|
||||||
|
public class LoadFileOptions
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Passed to url.format().
|
||||||
|
/// </summary>
|
||||||
|
public Dictionary<string, string> Query { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Passed to url.format().
|
||||||
|
/// </summary>
|
||||||
|
public string Search { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Passed to url.format().
|
||||||
|
/// </summary>
|
||||||
|
public string Hash { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,12 +1,14 @@
|
|||||||
namespace ElectronNET.API.Entities
|
namespace ElectronNET.API.Entities
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Options for BrowserWindow.loadURL(url, options) / webContents.loadURL(url, options).
|
||||||
|
/// Matches Electron's loadURL options.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <remarks>Up-to-date with Electron API 39.2</remarks>
|
||||||
public class LoadURLOptions
|
public class LoadURLOptions
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// A HTTP Referrer url.
|
/// An HTTP Referrer URL. In Electron this may be a string or a Referrer object.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string HttpReferrer { get; set; }
|
public string HttpReferrer { get; set; }
|
||||||
|
|
||||||
@@ -16,20 +18,18 @@
|
|||||||
public string UserAgent { get; set; }
|
public string UserAgent { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Base url (with trailing path separator) for files to be loaded by the data url.
|
/// Base URL (with trailing path separator) for files to be loaded by the data URL.
|
||||||
/// This is needed only if the specified url is a data url and needs to load other
|
/// Needed only if the specified URL is a data URL and needs to load other files.
|
||||||
/// files.
|
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string BaseURLForDataURL { get; set; }
|
public string BaseURLForDataURL { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Extra headers for the request.
|
/// Extra headers separated by "\n".
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string ExtraHeaders { get; set; }
|
public string ExtraHeaders { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// PostData Object for the request.
|
/// Post data for the request. Matches Electron's postData: (UploadRawData | UploadFile)[]
|
||||||
/// Can be <see cref="UploadRawData"/>, <see cref="UploadFile"/> or <see cref="Blob"/>
|
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public IPostData[] PostData { get; set; }
|
public IPostData[] PostData { get; set; }
|
||||||
}
|
}
|
||||||
|
|||||||
37
src/ElectronNET.API/API/Entities/LoginItemLaunchItem.cs
Normal file
37
src/ElectronNET.API/API/Entities/LoginItemLaunchItem.cs
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
using System.Runtime.Versioning;
|
||||||
|
|
||||||
|
namespace ElectronNET.API.Entities
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Windows launch entry as returned by app.getLoginItemSettings().launchItems.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>Up-to-date with Electron API 39.2</remarks>
|
||||||
|
[SupportedOSPlatform("windows")]
|
||||||
|
public class LoginItemLaunchItem
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Name value of a registry entry.
|
||||||
|
/// </summary>
|
||||||
|
public string Name { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The executable to an app that corresponds to a registry entry.
|
||||||
|
/// </summary>
|
||||||
|
public string Path { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The command-line arguments to pass to the executable.
|
||||||
|
/// </summary>
|
||||||
|
public string[] Args { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// One of <c>user</c> or <c>machine</c>. Indicates whether the registry entry is under HKEY_CURRENT_USER or HKEY_LOCAL_MACHINE.
|
||||||
|
/// </summary>
|
||||||
|
public string Scope { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// True if the app registry key is startup approved and therefore shows as enabled in Task Manager and Windows settings.
|
||||||
|
/// </summary>
|
||||||
|
public bool Enabled { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,8 +1,11 @@
|
|||||||
namespace ElectronNET.API.Entities
|
using System.Runtime.Versioning;
|
||||||
|
|
||||||
|
namespace ElectronNET.API.Entities
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Return object for app.getLoginItemSettings() on macOS and Windows.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <remarks>Up-to-date with Electron API 39.2</remarks>
|
||||||
public class LoginItemSettings
|
public class LoginItemSettings
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -11,29 +14,52 @@
|
|||||||
public bool OpenAtLogin { get; set; }
|
public bool OpenAtLogin { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// <see langword="true"/> if the app is set to open as hidden at login. This setting is not available
|
/// <see langword="true"/> if the app is set to open as hidden at login. Deprecated on macOS 13 and up; not available
|
||||||
/// on <see href="https://www.electronjs.org/docs/tutorial/mac-app-store-submission-guide">MAS builds</see>.
|
/// on <see href="https://www.electronjs.org/docs/tutorial/mac-app-store-submission-guide">MAS builds</see>.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[SupportedOSPlatform("macos")]
|
||||||
public bool OpenAsHidden { get; set; }
|
public bool OpenAsHidden { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// <see langword="true"/> if the app was opened at login automatically. This setting is not available
|
/// <see langword="true"/> if the app was opened at login automatically. This setting is not available
|
||||||
/// on <see href="https://www.electronjs.org/docs/tutorial/mac-app-store-submission-guide">MAS builds</see>.
|
/// on <see href="https://www.electronjs.org/docs/tutorial/mac-app-store-submission-guide">MAS builds</see>.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[SupportedOSPlatform("macos")]
|
||||||
public bool WasOpenedAtLogin { get; set; }
|
public bool WasOpenedAtLogin { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// <see langword="true"/> if the app was opened as a hidden login item. This indicates that the app should not
|
/// <see langword="true"/> if the app was opened as a hidden login item. This indicates that the app should not
|
||||||
/// open any windows at startup. This setting is not available on
|
/// open any windows at startup. Deprecated on macOS 13 and up; not available on
|
||||||
/// <see href="https://www.electronjs.org/docs/tutorial/mac-app-store-submission-guide">MAS builds</see>.
|
/// <see href="https://www.electronjs.org/docs/tutorial/mac-app-store-submission-guide">MAS builds</see>.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[SupportedOSPlatform("macos")]
|
||||||
public bool WasOpenedAsHidden { get; set; }
|
public bool WasOpenedAsHidden { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// <see langword="true"/> if the app was opened as a login item that should restore the state from the previous
|
/// <see langword="true"/> if the app was opened as a login item that should restore the state from the previous
|
||||||
/// session. This indicates that the app should restore the windows that were open the last time the app was closed.
|
/// session. This indicates that the app should restore the windows that were open the last time the app was closed.
|
||||||
/// This setting is not available on <see href="https://www.electronjs.org/docs/tutorial/mac-app-store-submission-guide">MAS builds</see>.
|
/// Deprecated on macOS 13 and up; not available on <see href="https://www.electronjs.org/docs/tutorial/mac-app-store-submission-guide">MAS builds</see>.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[SupportedOSPlatform("macos")]
|
||||||
public bool RestoreState { get; set; }
|
public bool RestoreState { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// macOS status: one of <c>not-registered</c>, <c>enabled</c>, <c>requires-approval</c>, or <c>not-found</c>.
|
||||||
|
/// </summary>
|
||||||
|
[SupportedOSPlatform("macos")]
|
||||||
|
public string Status { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Windows: true if app is set to open at login and its run key is not deactivated.
|
||||||
|
/// Differs from <c>OpenAtLogin</c> as it ignores the <c>args</c> option; this is true if the given executable would be launched at login with any arguments.
|
||||||
|
/// </summary>
|
||||||
|
[SupportedOSPlatform("windows")]
|
||||||
|
public bool ExecutableWillLaunchAtLogin { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Windows launch entries found in registry.
|
||||||
|
/// </summary>
|
||||||
|
[SupportedOSPlatform("windows")]
|
||||||
|
public LoginItemLaunchItem[] LaunchItems { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,4 +1,6 @@
|
|||||||
namespace ElectronNET.API.Entities
|
using System.Runtime.Versioning;
|
||||||
|
|
||||||
|
namespace ElectronNET.API.Entities
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
@@ -8,11 +10,25 @@
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// The executable path to compare against. Defaults to process.execPath.
|
/// The executable path to compare against. Defaults to process.execPath.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[SupportedOSPlatform("windows")]
|
||||||
public string Path { get; set; }
|
public string Path { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The command-line arguments to compare against. Defaults to an empty array.
|
/// The command-line arguments to compare against. Defaults to an empty array.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[SupportedOSPlatform("windows")]
|
||||||
public string[] Args { get; set; }
|
public string[] Args { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The type of service to query on macOS 13+. Defaults to 'mainAppService'. Only available on macOS 13 and up.
|
||||||
|
/// </summary>
|
||||||
|
[SupportedOSPlatform("macos")]
|
||||||
|
public string Type { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The name of the service. Required if type is non-default. Only available on macOS 13 and up.
|
||||||
|
/// </summary>
|
||||||
|
[SupportedOSPlatform("macos")]
|
||||||
|
public string ServiceName { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,8 +1,11 @@
|
|||||||
namespace ElectronNET.API.Entities
|
using System.Runtime.Versioning;
|
||||||
|
|
||||||
|
namespace ElectronNET.API.Entities
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Settings object for app.setLoginItemSettings() on macOS and Windows.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <remarks>Up-to-date with Electron API 39.2</remarks>
|
||||||
public class LoginSettings
|
public class LoginSettings
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -14,19 +17,46 @@
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// <see langword="true"/> to open the app as hidden. Defaults to <see langword="false"/>. The user can edit this
|
/// <see langword="true"/> to open the app as hidden. Defaults to <see langword="false"/>. The user can edit this
|
||||||
/// setting from the System Preferences so app.getLoginItemSettings().wasOpenedAsHidden should be checked when the app is
|
/// setting from the System Preferences so app.getLoginItemSettings().wasOpenedAsHidden should be checked when the app is
|
||||||
/// opened to know the current value. This setting is not available on <see href="https://www.electronjs.org/docs/tutorial/mac-app-store-submission-guide">MAS builds</see>.
|
/// opened to know the current value. This setting is not available on <see href="https://www.electronjs.org/docs/tutorial/mac-app-store-submission-guide">MAS builds</see> and does not work on macOS 13 and up.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[SupportedOSPlatform("macos")]
|
||||||
public bool OpenAsHidden { get; set; }
|
public bool OpenAsHidden { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The executable to launch at login. Defaults to process.execPath.
|
/// The executable to launch at login. Defaults to process.execPath.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[SupportedOSPlatform("windows")]
|
||||||
public string Path { get; set; }
|
public string Path { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The command-line arguments to pass to the executable. Defaults to an empty
|
/// The command-line arguments to pass to the executable. Defaults to an empty
|
||||||
/// array.Take care to wrap paths in quotes.
|
/// array.Take care to wrap paths in quotes.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[SupportedOSPlatform("windows")]
|
||||||
public string[] Args { get; set; }
|
public string[] Args { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The type of service to add as a login item. Defaults to 'mainAppService'. Only available on macOS 13 and up.
|
||||||
|
/// </summary>
|
||||||
|
[SupportedOSPlatform("macos")]
|
||||||
|
public string Type { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The name of the service. Required if <c>Type</c> is non-default. Only available on macOS 13 and up.
|
||||||
|
/// </summary>
|
||||||
|
[SupportedOSPlatform("macos")]
|
||||||
|
public string ServiceName { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Change the startup approved registry key and enable/disable the app in Task Manager and Windows Settings. Defaults to true.
|
||||||
|
/// </summary>
|
||||||
|
[SupportedOSPlatform("windows")]
|
||||||
|
public bool Enabled { get; set; } = true;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Value name to write into registry. Defaults to the app's AppUserModelId().
|
||||||
|
/// </summary>
|
||||||
|
[SupportedOSPlatform("windows")]
|
||||||
|
public string Name { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,33 +1,42 @@
|
|||||||
namespace ElectronNET.API.Entities;
|
namespace ElectronNET.API.Entities;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Margins object used by webContents.print options and webContents.printToPDF.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <remarks>Up-to-date with Electron API 39.2</remarks>
|
||||||
public class Margins
|
public class Margins
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Can be `default`, `none`, `printableArea`, or `custom`. If `custom` is chosen,
|
/// Gets or sets the margin type. Can be `default`, `none`, `printableArea`, or `custom`. If `custom` is chosen,
|
||||||
/// you will also need to specify `top`, `bottom`, `left`, and `right`.
|
/// you will also need to specify `top`, `bottom`, `left`, and `right`.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string MarginType { get; set; }
|
public string MarginType { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The top margin of the printed web page, in pixels.
|
/// Gets or sets the top margin of the printed web page. Units depend on API:
|
||||||
|
/// - webContents.print: pixels
|
||||||
|
/// - webContents.printToPDF: inches
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public int Top { get; set; }
|
public double Top { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The bottom margin of the printed web page, in pixels.
|
/// Gets or sets the bottom margin of the printed web page. Units depend on API:
|
||||||
|
/// - webContents.print: pixels
|
||||||
|
/// - webContents.printToPDF: inches
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public int Bottom { get; set; }
|
public double Bottom { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The left margin of the printed web page, in pixels.
|
/// Gets or sets the left margin of the printed web page. Units depend on API:
|
||||||
|
/// - webContents.print: pixels
|
||||||
|
/// - webContents.printToPDF: inches
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public int Left { get; set; }
|
public double Left { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The right margin of the printed web page, in pixels.
|
/// Gets or sets the right margin of the printed web page. Units depend on API:
|
||||||
|
/// - webContents.print: pixels
|
||||||
|
/// - webContents.printToPDF: inches
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public int Right { get; set; }
|
public double Right { get; set; }
|
||||||
}
|
}
|
||||||
@@ -1,24 +1,28 @@
|
|||||||
namespace ElectronNET.API.Entities
|
using System.Runtime.Versioning;
|
||||||
|
|
||||||
|
namespace ElectronNET.API.Entities
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Process memory info as returned by process.getProcessMemoryInfo().
|
||||||
|
/// Values are reported in Kilobytes.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <remarks>Up-to-date with Electron API 39.2</remarks>
|
||||||
public class MemoryInfo
|
public class MemoryInfo
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The amount of memory currently pinned to actual physical RAM.
|
/// Gets or sets the amount of memory currently pinned to actual physical RAM.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public int WorkingSetSize { get; set; }
|
public int WorkingSetSize { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The maximum amount of memory that has ever been pinned to actual physical RAM.
|
/// Gets or sets the maximum amount of memory that has ever been pinned to actual physical RAM.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public int PeakWorkingSetSize { get; set; }
|
public int PeakWorkingSetSize { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The amount of memory not shared by other processes, such as JS heap or HTML
|
/// Gets or sets the amount of memory not shared by other processes, such as JS heap or HTML content. Windows only.
|
||||||
/// content.
|
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[SupportedOSPlatform("windows")]
|
||||||
public int PrivateBytes { get; set; }
|
public int PrivateBytes { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,28 +1,29 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Text.Json.Serialization;
|
using System.Text.Json.Serialization;
|
||||||
|
using System.Runtime.Versioning;
|
||||||
|
|
||||||
namespace ElectronNET.API.Entities
|
namespace ElectronNET.API.Entities
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <remarks>Up-to-date with Electron API 39.2</remarks>
|
||||||
public class MenuItem
|
public class MenuItem
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Will be called with click(menuItem, browserWindow, event) when the menu item is
|
/// Will be called with click(menuItem, browserWindow, event) when the menu item is
|
||||||
/// clicked.
|
/// clicked.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
public Action Click { get; set; }
|
public Action Click { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Define the action of the menu item, when specified the click property will be
|
/// Gets or sets the action (role) of the menu item. When specified, the click property will be ignored.
|
||||||
/// ignored.
|
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public MenuRole Role { get; set; }
|
public MenuRole Role { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Can be normal, separator, submenu, checkbox or radio.
|
/// Gets or sets the menu item type. Can be normal, separator, submenu, checkbox, radio, header (macOS 14+), or palette (macOS 14+).
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public MenuType Type { get; set; }
|
public MenuType Type { get; set; }
|
||||||
|
|
||||||
@@ -42,8 +43,15 @@ namespace ElectronNET.API.Entities
|
|||||||
/// <value>
|
/// <value>
|
||||||
/// The sublabel.
|
/// The sublabel.
|
||||||
/// </value>
|
/// </value>
|
||||||
|
[SupportedOSPlatform("macos")]
|
||||||
public string Sublabel { get; set; }
|
public string Sublabel { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Hover text for this menu item (macOS).
|
||||||
|
/// </summary>
|
||||||
|
[SupportedOSPlatform("macos")]
|
||||||
|
public string ToolTip { get; set; }
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the accelerator.
|
/// Gets or sets the accelerator.
|
||||||
@@ -63,17 +71,31 @@ namespace ElectronNET.API.Entities
|
|||||||
public string Icon { get; set; }
|
public string Icon { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// If false, the menu item will be greyed out and unclickable.
|
/// Gets or sets a value indicating whether the item is enabled. If false, the menu item will be greyed out and unclickable.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool Enabled { get; set; } = true;
|
public bool Enabled { get; set; } = true;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// If false, the menu item will be entirely hidden.
|
/// Gets or sets a value indicating whether the item is visible. If false, the menu item will be entirely hidden.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool Visible { get; set; } = true;
|
public bool Visible { get; set; } = true;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Should only be specified for checkbox or radio type menu items.
|
/// Gets or sets a value indicating whether the accelerator should work when the item is hidden. Default is true (macOS).
|
||||||
|
/// When false, prevents the accelerator from triggering the item if the item is not visible.
|
||||||
|
/// </summary>
|
||||||
|
[SupportedOSPlatform("macos")]
|
||||||
|
public bool? AcceleratorWorksWhenHidden { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets a value indicating whether the accelerator should be registered with the system or only displayed (Linux/Windows). Defaults to true.
|
||||||
|
/// </summary>
|
||||||
|
[SupportedOSPlatform("windows")]
|
||||||
|
[SupportedOSPlatform("linux")]
|
||||||
|
public bool? RegisterAccelerator { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets a value indicating whether the item is checked. Should only be specified for checkbox or radio items.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool Checked { get; set; }
|
public bool Checked { get; set; }
|
||||||
|
|
||||||
@@ -85,17 +107,44 @@ namespace ElectronNET.API.Entities
|
|||||||
public MenuItem[] Submenu { get; set; }
|
public MenuItem[] Submenu { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Unique within a single menu. If defined then it can be used as a reference to
|
/// The item to share when the role is shareMenu (macOS).
|
||||||
/// this item by the position attribute.
|
/// </summary>
|
||||||
|
[SupportedOSPlatform("macos")]
|
||||||
|
public SharingItem SharingItem { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets a unique id within a single menu. If defined then it can be used as a reference for placement.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string Id { get; internal set; }
|
public string Id { get; internal set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// This field allows fine-grained definition of the specific location within a
|
/// This field allows fine-grained definition of the specific location within a given menu.
|
||||||
/// given menu.
|
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string Position { get; set; }
|
public string Position { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets a list of item ids. Inserts this item before the item(s) with the specified id(s).
|
||||||
|
/// If the referenced item doesn't exist the item will be inserted at the end of the menu.
|
||||||
|
/// Also implies that this item should be placed in the same group as the referenced item(s).
|
||||||
|
/// </summary>
|
||||||
|
public string[] Before { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets a list of item ids. Inserts this item after the item(s) with the specified id(s).
|
||||||
|
/// If the referenced item doesn't exist the item will be inserted at the end of the menu.
|
||||||
|
/// </summary>
|
||||||
|
public string[] After { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets a list of item ids. Places this item's containing group before the containing group
|
||||||
|
/// of the item(s) with the specified id(s).
|
||||||
|
/// </summary>
|
||||||
|
public string[] BeforeGroupContaining { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets a list of item ids. Places this item's containing group after the containing group
|
||||||
|
/// of the item(s) with the specified id(s).
|
||||||
|
/// </summary>
|
||||||
|
public string[] AfterGroupContaining { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -31,14 +31,14 @@
|
|||||||
paste,
|
paste,
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The pasteandmatchstyle
|
/// The pasteAndMatchStyle
|
||||||
/// </summary>
|
/// </summary>
|
||||||
pasteandmatchstyle,
|
pasteAndMatchStyle,
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The selectall
|
/// The selectAll
|
||||||
/// </summary>
|
/// </summary>
|
||||||
selectall,
|
selectAll,
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The delete
|
/// The delete
|
||||||
@@ -68,12 +68,12 @@
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Reload the current window ignoring the cache.
|
/// Reload the current window ignoring the cache.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
forcereload,
|
forceReload,
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Toggle developer tools in the current window
|
/// Toggle developer tools in the current window
|
||||||
/// </summary>
|
/// </summary>
|
||||||
toggledevtools,
|
toggleDevTools,
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Toggle full screen mode on the current window
|
/// Toggle full screen mode on the current window
|
||||||
@@ -83,17 +83,17 @@
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Reset the focused page’s zoom level to the original size
|
/// Reset the focused page’s zoom level to the original size
|
||||||
/// </summary>
|
/// </summary>
|
||||||
resetzoom,
|
resetZoom,
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Zoom in the focused page by 10%
|
/// Zoom in the focused page by 10%
|
||||||
/// </summary>
|
/// </summary>
|
||||||
zoomin,
|
zoomIn,
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Zoom out the focused page by 10%
|
/// Zoom out the focused page by 10%
|
||||||
/// </summary>
|
/// </summary>
|
||||||
zoomout,
|
zoomOut,
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Whole default “Edit” menu (Undo, Copy, etc.)
|
/// Whole default “Edit” menu (Undo, Copy, etc.)
|
||||||
@@ -118,7 +118,7 @@
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Only macOS: Map to the hideOtherApplications action
|
/// Only macOS: Map to the hideOtherApplications action
|
||||||
/// </summary>
|
/// </summary>
|
||||||
hideothers,
|
hideOthers,
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Only macOS: Map to the unhideAllApplications action
|
/// Only macOS: Map to the unhideAllApplications action
|
||||||
@@ -128,12 +128,12 @@
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Only macOS: Map to the startSpeaking action
|
/// Only macOS: Map to the startSpeaking action
|
||||||
/// </summary>
|
/// </summary>
|
||||||
startspeaking,
|
startSpeaking,
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Only macOS: Map to the stopSpeaking action
|
/// Only macOS: Map to the stopSpeaking action
|
||||||
/// </summary>
|
/// </summary>
|
||||||
stopspeaking,
|
stopSpeaking,
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Only macOS: Map to the arrangeInFront action
|
/// Only macOS: Map to the arrangeInFront action
|
||||||
@@ -158,6 +158,108 @@
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Only macOS: The submenu is a “Services” menu
|
/// Only macOS: The submenu is a “Services” menu
|
||||||
/// </summary>
|
/// </summary>
|
||||||
services
|
services,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Toggle built-in spellchecker.
|
||||||
|
/// </summary>
|
||||||
|
toggleSpellChecker,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The submenu is a "File" menu.
|
||||||
|
/// </summary>
|
||||||
|
fileMenu,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The submenu is a "View" menu.
|
||||||
|
/// </summary>
|
||||||
|
viewMenu,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The application menu.
|
||||||
|
/// </summary>
|
||||||
|
appMenu,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The submenu is a "Share" menu.
|
||||||
|
/// </summary>
|
||||||
|
shareMenu,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Displays a list of files recently opened by the app.
|
||||||
|
/// </summary>
|
||||||
|
recentDocuments,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Clear the recent documents list.
|
||||||
|
/// </summary>
|
||||||
|
clearRecentDocuments,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Toggle the tab bar (macOS).
|
||||||
|
/// </summary>
|
||||||
|
toggleTabBar,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Select the next tab (macOS).
|
||||||
|
/// </summary>
|
||||||
|
selectNextTab,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Select the previous tab (macOS).
|
||||||
|
/// </summary>
|
||||||
|
selectPreviousTab,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Show all tabs (macOS).
|
||||||
|
/// </summary>
|
||||||
|
showAllTabs,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Merge all windows (macOS).
|
||||||
|
/// </summary>
|
||||||
|
mergeAllWindows,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Move the current tab to a new window (macOS).
|
||||||
|
/// </summary>
|
||||||
|
moveTabToNewWindow,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Show substitutions panel (macOS).
|
||||||
|
/// </summary>
|
||||||
|
showSubstitutions,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Toggle smart quotes (macOS).
|
||||||
|
/// </summary>
|
||||||
|
toggleSmartQuotes,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Toggle smart dashes (macOS).
|
||||||
|
/// </summary>
|
||||||
|
toggleSmartDashes,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Toggle text replacement (macOS).
|
||||||
|
/// </summary>
|
||||||
|
toggleTextReplacement,
|
||||||
|
|
||||||
|
// Backwards-compatibility aliases (old identifiers) to avoid breaking existing code.
|
||||||
|
// These map to the same enum values as their official values.
|
||||||
|
pasteandmatchstyle = pasteAndMatchStyle,
|
||||||
|
selectall = selectAll,
|
||||||
|
forcereload = forceReload,
|
||||||
|
toggledevtools = toggleDevTools,
|
||||||
|
resetzoom = resetZoom,
|
||||||
|
zoomin = zoomIn,
|
||||||
|
zoomout = zoomOut,
|
||||||
|
hideothers = hideOthers,
|
||||||
|
startspeaking = startSpeaking,
|
||||||
|
stopspeaking = stopSpeaking,
|
||||||
|
togglespellchecker = toggleSpellChecker,
|
||||||
|
togglesmartquotes = toggleSmartQuotes,
|
||||||
|
togglesmartdashes = toggleSmartDashes,
|
||||||
|
toggletextreplacement = toggleTextReplacement
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,33 +1,48 @@
|
|||||||
namespace ElectronNET.API.Entities
|
using System.Runtime.Versioning;
|
||||||
|
|
||||||
|
namespace ElectronNET.API.Entities
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Menu item types matching Electron's MenuItem.type values.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <remarks>Up-to-date with Electron API 39.2</remarks>
|
||||||
public enum MenuType
|
public enum MenuType
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The normal
|
/// Normal menu item.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
normal,
|
normal,
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The separator
|
/// Separator between items.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
separator,
|
separator,
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The submenu
|
/// Submenu container.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
submenu,
|
submenu,
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The checkbox
|
/// Checkbox item.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
checkbox,
|
checkbox,
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The radio
|
/// Radio item.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
radio
|
radio,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Header item (macOS 14+).
|
||||||
|
/// </summary>
|
||||||
|
[SupportedOSPlatform("macos")]
|
||||||
|
header,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Palette item (macOS 14+).
|
||||||
|
/// </summary>
|
||||||
|
[SupportedOSPlatform("macos")]
|
||||||
|
palette
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,89 +1,82 @@
|
|||||||
|
|
||||||
using System.Text.Json.Serialization;
|
using System.Text.Json.Serialization;
|
||||||
|
using System.Runtime.Versioning;
|
||||||
|
|
||||||
namespace ElectronNET.API.Entities
|
namespace ElectronNET.API.Entities
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Options for dialog.showMessageBox / dialog.showMessageBoxSync.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <remarks>Up-to-date with Electron API 39.2</remarks>
|
||||||
public class MessageBoxOptions
|
public class MessageBoxOptions
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Can be "none", "info", "error", "question" or "warning". On Windows, "question"
|
/// Gets or sets the type. Can be "none", "info", "error", "question" or "warning". On Windows, "question" displays the same icon as "info", unless you set an icon using the "icon" option. On macOS, both "warning" and "error" display the same warning icon.
|
||||||
/// displays the same icon as "info", unless you set an icon using the "icon"
|
|
||||||
/// option. On macOS, both "warning" and "error" display the same warning icon.
|
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public MessageBoxType Type { get; set; }
|
public MessageBoxType Type { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Array of texts for buttons. On Windows, an empty array will result in one button
|
/// Gets or sets the array of texts for buttons. On Windows, an empty array will result in one button labeled "OK".
|
||||||
/// labeled "OK".
|
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string[] Buttons { get; set; }
|
public string[] Buttons { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Index of the button in the buttons array which will be selected by default when
|
/// Gets or sets the index of the button in the buttons array which will be selected by default when the message box opens.
|
||||||
/// the message box opens.
|
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public int DefaultId { get; set; }
|
public int DefaultId { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Title of the message box, some platforms will not show it.
|
/// Gets or sets the title of the message box; some platforms will not show it.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string Title { get; set; }
|
public string Title { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Content of the message box.
|
/// Gets or sets the content of the message box.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string Message { get; set; }
|
public string Message { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Extra information of the message.
|
/// Gets or sets the extra information of the message.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string Detail { get; set; }
|
public string Detail { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// If provided, the message box will include a checkbox with the given label. The
|
/// Gets or sets the checkbox label. If provided, the message box will include a checkbox with the given label.
|
||||||
/// checkbox state can be inspected only when using callback.
|
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string CheckboxLabel { get; set; }
|
public string CheckboxLabel { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Initial checked state of the checkbox. false by default.
|
/// Gets or sets the initial checked state of the checkbox. Defaults to false.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool CheckboxChecked { get; set; }
|
public bool CheckboxChecked { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the icon.
|
/// Gets or sets the icon for the message box.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>
|
|
||||||
/// The icon.
|
|
||||||
/// </value>
|
|
||||||
public string Icon { get; set; }
|
public string Icon { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The index of the button to be used to cancel the dialog, via the Esc key. By
|
/// Gets or sets the custom width of the text in the message box.
|
||||||
/// default this is assigned to the first button with "cancel" or "no" as the label.
|
/// </summary>
|
||||||
/// If no such labeled buttons exist and this option is not set, 0 will be used as
|
[SupportedOSPlatform("macos")]
|
||||||
/// the return value or callback response. This option is ignored on Windows.
|
public int? TextWidth { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the index of the button to be used to cancel the dialog via the Esc key. By default this is assigned to the first button with "cancel" or "no" as the label. If no such labeled buttons exist and this option is not set, 0 will be used.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public int CancelId { get; set; }
|
public int CancelId { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// On Windows Electron will try to figure out which one of the buttons are common
|
/// Gets or sets a value indicating whether to disable Windows command-links behavior (noLink).
|
||||||
/// buttons(like "Cancel" or "Yes"), and show the others as command links in the
|
/// On Windows Electron will try to figure out which one of the buttons are common buttons (like "Cancel" or "Yes"), and show the others as command links in the dialog. Set to true to disable this behavior.
|
||||||
/// dialog.This can make the dialog appear in the style of modern Windows apps. If
|
|
||||||
/// you don't like this behavior, you can set noLink to true.
|
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[SupportedOSPlatform("windows")]
|
||||||
public bool NoLink { get; set; }
|
public bool NoLink { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Normalize the keyboard access keys across platforms. Default is false. Enabling
|
/// Gets or sets a value indicating whether to normalize the keyboard access keys across platforms. Default is false. Enabling this assumes '&' is used in the button labels for the placement of the keyboard
|
||||||
/// this assumes AND character is used in the button labels for the placement of the keyboard
|
|
||||||
/// shortcut access key and labels will be converted so they work correctly on each
|
/// shortcut access key and labels will be converted so they work correctly on each
|
||||||
/// platform, AND characters are removed on macOS, converted to _ on Linux, and left
|
/// platform, '&' characters are removed on macOS, converted to '_' on Linux, and left
|
||||||
/// untouched on Windows.For example, a button label of VieANDw will be converted to
|
/// untouched on Windows. For example, a button label of "View" will be converted to "Vie_w" on Linux and "View" on macOS and can be selected via Alt-W on Windows and
|
||||||
/// Vie_w on Linux and View on macOS and can be selected via Alt-W on Windows and
|
|
||||||
/// Linux.
|
/// Linux.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool NormalizeAccessKeys { get; set; }
|
public bool NormalizeAccessKeys { get; set; }
|
||||||
@@ -97,6 +90,4 @@ namespace ElectronNET.API.Entities
|
|||||||
Message = message;
|
Message = message;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -1,24 +1,19 @@
|
|||||||
namespace ElectronNET.API.Entities
|
namespace ElectronNET.API.Entities
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Result returned by dialog.showMessageBox / dialog.showMessageBoxSync.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <remarks>Up-to-date with Electron API 39.2</remarks>
|
||||||
public class MessageBoxResult
|
public class MessageBoxResult
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the response.
|
/// The index of the clicked button.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>
|
|
||||||
/// The response.
|
|
||||||
/// </value>
|
|
||||||
public int Response { get; set; }
|
public int Response { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets a value indicating whether [checkbox checked].
|
/// The checked state of the checkbox if CheckboxLabel was set; otherwise false.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>
|
|
||||||
/// <c>true</c> if [checkbox checked]; otherwise, <c>false</c>.
|
|
||||||
/// </value>
|
|
||||||
public bool CheckboxChecked { get; set; }
|
public bool CheckboxChecked { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,8 +1,9 @@
|
|||||||
namespace ElectronNET.API.Entities
|
namespace ElectronNET.API.Entities
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Message box type for dialog.showMessageBox/showMessageBoxSync.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <remarks>Up-to-date with Electron API 39.2</remarks>
|
||||||
public enum MessageBoxType
|
public enum MessageBoxType
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@@ -1,8 +1,9 @@
|
|||||||
namespace ElectronNET.API.Entities;
|
namespace ElectronNET.API.Entities;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Specifies the possible modifier keys for a keyboard input.
|
/// Specifies the possible modifier keys for a keyboard input (maps to InputEvent.modifiers).
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <remarks>Up-to-date with Electron API 39.2</remarks>
|
||||||
public enum ModifierType
|
public enum ModifierType
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ using System.IO;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text.Json.Serialization;
|
using System.Text.Json.Serialization;
|
||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
|
using System.Runtime.Versioning;
|
||||||
|
|
||||||
namespace ElectronNET.API.Entities
|
namespace ElectronNET.API.Entities
|
||||||
{
|
{
|
||||||
@@ -268,6 +269,12 @@ namespace ElectronNET.API.Entities
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public bool IsTemplateImage => _isTemplateImage;
|
public bool IsTemplateImage => _isTemplateImage;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Whether the image is considered a macOS template image.
|
||||||
|
/// </summary>
|
||||||
|
[SupportedOSPlatform("macos")]
|
||||||
|
public bool IsMacTemplateImage => _isTemplateImage;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Deprecated. Marks the image as a template image.
|
/// Deprecated. Marks the image as a template image.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ using System.Text.Json.Serialization;
|
|||||||
|
|
||||||
namespace ElectronNET.API.Entities
|
namespace ElectronNET.API.Entities
|
||||||
{
|
{
|
||||||
|
/// <yremarks>Project-specific: JSON converter for NativeImage; no MCP structure equivalent.</yremarks>
|
||||||
internal class NativeImageJsonConverter : JsonConverter<NativeImage>
|
internal class NativeImageJsonConverter : JsonConverter<NativeImage>
|
||||||
{
|
{
|
||||||
public override void Write(Utf8JsonWriter writer, NativeImage value, JsonSerializerOptions options)
|
public override void Write(Utf8JsonWriter writer, NativeImage value, JsonSerializerOptions options)
|
||||||
@@ -35,5 +36,4 @@ namespace ElectronNET.API.Entities
|
|||||||
return new NativeImage(newDictionary);
|
return new NativeImage(newDictionary);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user