Merge pull request #895 from softworkz/electronnet_core

Add documentation
This commit is contained in:
Florian Rappl
2025-10-16 08:44:08 +02:00
committed by GitHub
46 changed files with 13368 additions and 59 deletions

BIN
.github/WikiLinks.exe vendored Normal file

Binary file not shown.

59
.github/workflows/publish-wiki.yml vendored Normal file
View File

@@ -0,0 +1,59 @@
name: Publish wiki
on:
push:
branches: [electronnet_core, main]
workflow_dispatch:
concurrency:
group: publish-wiki
cancel-in-progress: true
permissions:
contents: write
jobs:
publish-wiki:
runs-on: windows-latest
steps:
- uses: actions/checkout@v3
- name: Remove level 1 headings from Markdown files
shell: bash
run: |
find docs/ -name '*.md' -exec sed -i '1d' {} \;
- name: Move all files to root folder
shell: bash
run: |
mv docs/*/* docs/
- name: Delete unwanted files
shell: bash
run: |
# rm docs/*.xlsm
# rm docs/*.pptx
rm docs/*.shproj
- name: Stripping file extensions....
uses: softworkz/strip-markdown-extensions-from-links-action@main
with:
path: ./docs/
- name: Copy Changelog
shell: bash
run: |
cp Changelog.md docs/RelInfo/ 2>/dev/null || true
- name: Copy images to wiki/wiki folder
shell: bash
run: |
mkdir docs/wiki
cp docs/*.svg docs/wiki/ 2>/dev/null || true
cp docs/*.png docs/wiki/ 2>/dev/null || true
cp docs/*.jpg docs/wiki/ 2>/dev/null || true
cp docs/*.gif docs/wiki/ 2>/dev/null || true
cp docs/*.mp4 docs/wiki/ 2>/dev/null || true
- name: Commit and push changes
run: |
git config --global user.name "GitHub Action"
git config --global user.email "action@github.com"
git add -A
git commit -m "Automatically update Markdown files" || echo "No changes to commit"
- uses: Andrew-Chen-Wang/github-wiki-action@v4.4.0
with:
path: docs/
ignore: |
'**/*.xlsm'
'**/*.pptx'
'**/*.shproj'

View File

@@ -8,7 +8,7 @@
ElectronNET.Core represents a fundamental modernization of Electron.NET, addressing years of accumulated pain points while preserving full API compatibility. This isn't just an update—it's a complete rethinking of how .NET developers build and debug cross-platform desktop applications with Electron.
Read more: [**What's New in ElectronNET.Core**](WHATS_NEW.md)
Read more: [**What's New in ElectronNET.Core**](wiki/What's-New)
Build cross platform desktop applications with .NET 6/8 - from console apps to ASP.Net Core (Razor Pages, MVC) to Blazor
@@ -41,9 +41,9 @@ Also you should have installed:
- Install the following two nuget packages:
```ps1
PM> Install-Package ElectronNET.Core
dotnet add package ElectronNET.Core
PM> Install-Package ElectronNET.Core.AspNet
dotnet add package ElectronNET.Core.AspNet
```
### Enable Electron.NET on Startup
@@ -85,15 +85,13 @@ Just press F5 in Visual Studio or use dotnet for debugging.
## 📔 Usage of the Electron API
A complete documentation will follow. Until then take a look in the source code of the sample application:
[Electron.NET API Demos](https://github.com/ElectronNET/electron.net-api-demos)
A 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)
> [!NOTE]
> The video hasn't been updated for the changes in ElectronNET.Core, so it is partially outdated.
### Note
> 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.
## 👨‍💻 Authors
@@ -110,15 +108,6 @@ See also the list of [contributors](https://github.com/ElectronNET/Electron.NET/
Feel free to submit a pull request if you find any bugs (to see a list of active issues, visit the [Issues section](https://github.com/ElectronNET/Electron.NET/issues).
Please make sure all commits are properly documented.
## 🧪 Working with this Repo
This video provides an introduction to development for Electron.NET: [Electron.NET - Contributing Getting Started](https://youtu.be/Po-saU_Z6Ws)
This repository consists of the main parts (API & CLI) and it's own "playground" ASP.NET Core application. Both main parts produce local NuGet packages, that are versioned with 99.0.0. The first thing you will need is to run one of the build scripts (.cmd or .ps1 for Windows, the .sh for macOS/Linux).
If you look for pure __[demo projects](https://github.com/ElectronNET)__ checkout the other repositories.
The problem working with this repository is, that NuGet has a pretty aggressive cache, see [here for further information](https://github.com/ElectronNET/Electron.NET/wiki).
## 🙏 Donate
@@ -141,38 +130,3 @@ MIT-licensed. See [LICENSE](./LICENSE) for details.
### 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:
```csharp
WebPreferences wp = new WebPreferences();
wp.NodeIntegration = false;
BrowserWindowOptions browserWindowOptions = new BrowserWindowOptions
{
WebPreferences = wp
};
```
### Dependency Injection
ElectronNET.API can be added to your DI container within the `Startup` class. All of the modules available in Electron will be added as Singletons.
```csharp
using ElectronNET.API;
public void ConfigureServices(IServiceCollection services)
{
services.AddElectron();
}
```
## 💬 Community
[![Gitter](https://badges.gitter.im/ElectronNET/community.svg)](https://gitter.im/ElectronNET/community?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge)
Besides the chat on Gitter and the issues [discussed here](https://github.com/ElectronNET/Electron.NET/issues) you can also use [StackOverflow](https://stackoverflow.com/questions/tagged/electron.net) with the tag `electron.net`.
If you want to sponsor the further maintenance and development of this project [see the donate section](#🙏-donate).

View File

@@ -0,0 +1,27 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<TargetPlatformVersion>8.1</TargetPlatformVersion>
<IsCodeSharingProject>true</IsCodeSharingProject>
<DefineCommonItemSchemas>true</DefineCommonItemSchemas>
</PropertyGroup>
<PropertyGroup>
<MdIncludes>**/*.md;**/*.markdown</MdIncludes>
<ImageIncludes>**/*.png;**/*.bmp;**/*.jpg;**/*.gif;**/*.mp4</ImageIncludes>
<WebIncludes>**/*.css;**/*.js;**/*.json</WebIncludes>
</PropertyGroup>
<ItemGroup>
<Compile Remove="**/*" />
<Content Remove="**/*" />
</ItemGroup>
<ItemGroup>
<None Include="$(ImageIncludes)" />
<None Include="$(WebIncludes)" />
<None Include="$(MdIncludes)" />
</ItemGroup>
</Project>

View File

@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<ProjectCapability Include="SourceItemsFromImports;SharedImports;SharedAssetsProject"/>
<ProjectCapability Include="HandlesOwnReload"/>
<ProjectCapability Include="UserSourceItems"/>
<ProjectCapability Include="OpenProjectFile"/>
<ProjectCapability Include="UseFileGlobs"/>
<ProjectCapability Include="SingleFileGenerators"/>
</ItemGroup>
<Target Name="Compile">
</Target>
<Target Name="Build">
</Target>
<Target Name="Clean">
</Target>
<Target Name="_CheckForInvalidConfigurationAndPlatform">
</Target>
</Project>

489
docs/API/App.md Normal file
View File

@@ -0,0 +1,489 @@
# Electron.App
Control your application's event lifecycle.
## Overview
The `Electron.App` API provides comprehensive control over your application's lifecycle, including startup, shutdown, window management, and system integration. It handles application-level events and provides methods for managing the overall application state.
## Properties
#### 📋 `CommandLine`
A `CommandLine` object that allows you to read and manipulate the command line arguments that Chromium uses.
#### 📋 `IsReady`
Application host fully started.
#### 📋 `Name`
A string property that indicates the current application's name, which is the name in the application's package.json file.
Usually the name field of package.json is a short lowercase name, according to the npm modules spec. You should usually also specify a productName field, which is your application's full capitalized name, and which will be preferred over name by Electron.
#### 📋 `NameAsync`
A `Task<string>` property that indicates the current application's name, which is the name in the application's package.json file.
Usually the name field of package.json is a short lowercase name, according to the npm modules spec. You should usually also specify a productName field, which is your application's full capitalized name, and which will be preferred over name by Electron.
#### 📋 `UserAgentFallback`
A string which is the user agent string Electron will use as a global fallback.
This is the user agent that will be used when no user agent is set at the webContents or session level. It is useful for ensuring that your entire app has the same user agent. Set to a custom value as early as possible in your app's initialization to ensure that your overridden value is used.
#### 📋 `UserAgentFallbackAsync`
A `Task<string>` which is the user agent string Electron will use as a global fallback.
This is the user agent that will be used when no user agent is set at the webContents or session level. It is useful for ensuring that your entire app has the same user agent. Set to a custom value as early as possible in your app's initialization to ensure that your overridden value is used.
## Methods
#### 🧊 `void AddRecentDocument(string path)`
Adds path to the recent documents list. This list is managed by the OS. On Windows you can visit the list from the task bar, and on macOS you can visit it from dock menu.
#### 🧊 `void ClearRecentDocuments()`
Clears the recent documents list.
#### 🧊 `void Exit(int exitCode = 0)`
All windows will be closed immediately without asking user and the BeforeQuit and WillQuit events will not be emitted.
**Parameters:**
- `exitCode` - Exits immediately with exitCode. exitCode defaults to 0.
#### 🧊 `void Focus()`
On Linux, focuses on the first visible window. On macOS, makes the application the active app. On Windows, focuses on the application's first window.
#### 🧊 `void Focus(FocusOptions focusOptions)`
On Linux, focuses on the first visible window. On macOS, makes the application the active app. On Windows, focuses on the application's first window.
You should seek to use the `FocusOptions.Steal` option as sparingly as possible.
**Parameters:**
- `focusOptions` - Focus options
#### 🧊 `Task<ProcessMetric[]> GetAppMetricsAsync(CancellationToken cancellationToken = default)`
Memory and cpu usage statistics of all the processes associated with the app.
**Returns:**
Array of ProcessMetric objects that correspond to memory and cpu usage statistics of all the processes associated with the app.
#### 🧊 `Task<string> GetAppPathAsync(CancellationToken cancellationToken = default)`
The current application directory.
**Returns:**
The current application directory.
#### 🧊 `Task<int> GetBadgeCountAsync(CancellationToken cancellationToken = default)`
The current value displayed in the counter badge.
**Returns:**
The current value displayed in the counter badge.
#### 🧊 `Task<string> GetCurrentActivityTypeAsync(CancellationToken cancellationToken = default)`
The type of the currently running activity.
**Returns:**
The type of the currently running activity.
#### 🧊 `Task<GPUFeatureStatus> GetGpuFeatureStatusAsync(CancellationToken cancellationToken = default)`
The Graphics Feature Status from chrome://gpu/.
Note: This information is only usable after the gpu-info-update event is emitted.
**Returns:**
The Graphics Feature Status from chrome://gpu/.
#### 🧊 `Task<JumpListSettings> GetJumpListSettingsAsync(CancellationToken cancellationToken = default)`
Jump List settings for the application.
**Returns:**
Jump List settings.
#### 🧊 `Task<string> GetLocaleAsync(CancellationToken cancellationToken = default)`
The current application locale. Possible return values are documented [here](https://www.electronjs.org/docs/api/locales).
Note: When distributing your packaged app, you have to also ship the locales folder.
Note: On Windows, you have to call it after the Ready events gets emitted.
**Returns:**
The current application locale.
#### 🧊 `Task<LoginItemSettings> GetLoginItemSettingsAsync(CancellationToken cancellationToken = default)`
If you provided path and args options to SetLoginItemSettings then you need to pass the same arguments here for LoginItemSettings.OpenAtLogin to be set correctly.
**Returns:**
Login item settings.
#### 🧊 `Task<string> GetPathAsync(PathName pathName, CancellationToken cancellationToken = default)`
The path to a special directory. If GetPathAsync is called without called SetAppLogsPath being called first, a default directory will be created equivalent to calling SetAppLogsPath without a path parameter.
**Parameters:**
- `pathName` - Special directory.
**Returns:**
A path to a special directory or file associated with name.
#### 🧊 `Task<string> GetVersionAsync(CancellationToken cancellationToken = default)`
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.
**Returns:**
The version of the loaded application.
#### 🧊 `Task<bool> HasSingleInstanceLockAsync(CancellationToken cancellationToken = default)`
This method returns whether or not this instance of your app is currently holding the single instance lock. You can request the lock with RequestSingleInstanceLockAsync and release with ReleaseSingleInstanceLock.
**Returns:**
Whether this instance of your app is currently holding the single instance lock.
#### 🧊 `void Hide()`
Hides all application windows without minimizing them.
#### 🧊 `Task<int> ImportCertificateAsync(ImportCertificateOptions options, CancellationToken cancellationToken = default)`
Imports the certificate in pkcs12 format into the platform certificate store. callback is called with the result of import operation, a value of 0 indicates success while any other value indicates failure according to chromium net_error_list.
**Parameters:**
- `options` - Import certificate options
- `cancellationToken` - The cancellation token
**Returns:**
Result of import. Value of 0 indicates success.
#### 🧊 `void InvalidateCurrentActivity()`
Invalidates the current Handoff user activity.
#### 🧊 `Task<bool> IsAccessibilitySupportEnabledAsync(CancellationToken cancellationToken = default)`
true if Chrome's accessibility support is enabled, false otherwise. This API will return true if the use of assistive technologies, such as screen readers, has been detected. See Chromium's accessibility docs for more details.
**Returns:**
true if Chrome's accessibility support is enabled, false otherwise.
#### 🧊 `Task<bool> IsDefaultProtocolClientAsync(string protocol, CancellationToken cancellationToken = default)`
This method checks if the current executable is the default handler for a protocol (aka URI scheme).
Note: On macOS, you can use this method to check if the app has been registered as the default protocol handler for a protocol. You can also verify this by checking ~/Library/Preferences/com.apple.LaunchServices.plist on the macOS machine. Please refer to Apple's documentation for details.
The API uses the Windows Registry and LSCopyDefaultHandlerForURLScheme internally.
**Parameters:**
- `protocol` - The name of your protocol, without ://
- `cancellationToken` - The cancellation token
**Returns:**
Whether the current executable is the default handler for a protocol (aka URI scheme).
#### 🧊 `Task<bool> IsUnityRunningAsync(CancellationToken cancellationToken = default)`
Whether the current desktop environment is Unity launcher.
**Returns:**
Whether the current desktop environment is Unity launcher.
#### 🧊 `void Quit()`
Try to close all windows. The BeforeQuit event will be emitted first. If all windows are successfully closed, the WillQuit event will be emitted and by default the application will terminate. This method guarantees that all beforeunload and unload event handlers are correctly executed. It is possible that a window cancels the quitting by returning false in the beforeunload event handler.
#### 🧊 `void ReleaseSingleInstanceLock()`
Releases all locks that were created by makeSingleInstance. This will allow multiple instances of the application to once again run side by side.
#### 🧊 `void Relaunch()`
Relaunches the app when current instance exits. By default the new instance will use the same working directory and command line arguments with current instance.
Note that this method does not quit the app when executed, you have to call Quit or Exit after calling Relaunch() to make the app restart.
When Relaunch() is called for multiple times, multiple instances will be started after current instance exited.
#### 🧊 `void Relaunch(RelaunchOptions relaunchOptions)`
Relaunches the app when current instance exits. By default the new instance will use the same working directory and command line arguments with current instance. When RelaunchOptions.Args is specified, the RelaunchOptions.Args will be passed as command line arguments instead. When RelaunchOptions.ExecPath is specified, the RelaunchOptions.ExecPath will be executed for relaunch instead of current app.
Note that this method does not quit the app when executed, you have to call Quit or Exit after calling Relaunch() to make the app restart.
When Relaunch() is called for multiple times, multiple instances will be started after current instance exited.
**Parameters:**
- `relaunchOptions` - Options for the relaunch
#### 🧊 `Task<bool> RemoveAsDefaultProtocolClientAsync(string protocol, CancellationToken cancellationToken = default)`
This method checks if the current executable as the default handler for a protocol (aka URI scheme). If so, it will remove the app as the default handler.
**Parameters:**
- `protocol` - The name of your protocol, without ://
- `cancellationToken` - The cancellation token
**Returns:**
Whether the call succeeded.
#### 🧊 `Task<bool> RequestSingleInstanceLockAsync(Action<string[], string> newInstanceOpened, CancellationToken cancellationToken = default)`
The return value of this method indicates whether or not this instance of your application successfully obtained the lock. If it failed to obtain the lock, you can assume that another instance of your application is already running with the lock and exit immediately.
I.e.This method returns true if your process is the primary instance of your application and your app should continue loading. It returns false if your process should immediately quit as it has sent its parameters to another instance that has already acquired the lock.
On macOS, the system enforces single instance automatically when users try to open a second instance of your app in Finder, and the open-file and open-url events will be emitted for that.However when users start your app in command line, the system's single instance mechanism will be bypassed, and you have to use this method to ensure single instance.
**Parameters:**
- `newInstanceOpened` - Lambda with an array of the second instance's command line arguments. The second parameter is the working directory path.
- `cancellationToken` - The cancellation token
**Returns:**
This method returns false if your process is the primary instance of the application and your app should continue loading. And returns true if your process has sent its parameters to another instance, and you should immediately quit.
#### 🧊 `void ResignCurrentActivity()`
Marks the current Handoff user activity as inactive without invalidating it.
#### 🧊 `void SetAccessibilitySupportEnabled(bool enabled)`
Manually enables Chrome's accessibility support, allowing to expose accessibility switch to users in application settings. See Chromium's accessibility docs for more details. Disabled (false) by default.
This API must be called after the Ready event is emitted.
Note: Rendering accessibility tree can significantly affect the performance of your app. It should not be enabled by default.
**Parameters:**
- `enabled` - Enable or disable accessibility tree rendering
#### 🧊 `void SetAppLogsPath(string path)`
Sets or creates a directory your app's logs which can then be manipulated with GetPathAsync or SetPath.
Calling SetAppLogsPath without a path parameter will result in this directory being set to ~/Library/Logs/YourAppName on macOS, and inside the userData directory on Linux and Windows.
**Parameters:**
- `path` - A custom path for your logs. Must be absolute
#### 🧊 `void SetAppUserModelId(string id)`
Changes the Application User Model ID to id.
**Parameters:**
- `id` - Model Id
#### 🧊 `Task<bool> SetAsDefaultProtocolClientAsync(string protocol, CancellationToken cancellationToken = default)`
Sets the current executable as the default handler for a protocol (aka URI scheme). It allows you to integrate your app deeper into the operating system. Once registered, all links with your-protocol:// will be opened with the current executable. The whole link, including protocol, will be passed to your application as a parameter.
Note: On macOS, you can only register protocols that have been added to your app's info.plist, which cannot be modified at runtime. However, you can change the file during build time via Electron Forge, Electron Packager, or by editing info.plist with a text editor. Please refer to Apple's documentation for details.
Note: In a Windows Store environment (when packaged as an appx) this API will return true for all calls but the registry key it sets won't be accessible by other applications. In order to register your Windows Store application as a default protocol handler you must declare the protocol in your manifest.
The API uses the Windows Registry and LSSetDefaultHandlerForURLScheme internally.
**Parameters:**
- `protocol` - The name of your protocol, without ://. For example, if you want your app to handle electron:// links, call this method with electron as the parameter.
- `cancellationToken` - The cancellation token
**Returns:**
Whether the call succeeded.
#### 🧊 `Task<bool> SetBadgeCountAsync(int count, CancellationToken cancellationToken = default)`
Sets the counter badge for current app. Setting the count to 0 will hide the badge. On macOS it shows on the dock icon. On Linux it only works for Unity launcher.
Note: Unity launcher requires the existence of a .desktop file to work, for more information please read Desktop Environment Integration.
**Parameters:**
- `count` - Counter badge
- `cancellationToken` - The cancellation token
**Returns:**
Whether the call succeeded.
#### 🧊 `void SetJumpList(JumpListCategory[] categories)`
Sets or removes a custom Jump List for the application. If categories is null the previously set custom Jump List (if any) will be replaced by the standard Jump List for the app (managed by Windows).
Note: If a JumpListCategory object has neither the Type nor the Name property set then its Type is assumed to be tasks. If the Name property is set but the Type property is omitted then the Type is assumed to be custom.
Note: Users can remove items from custom categories, and Windows will not allow a removed item to be added back into a custom category until after the next successful call to SetJumpList. Any attempt to re-add a removed item to a custom category earlier than that will result in the entire custom category being omitted from the Jump List. The list of removed items can be obtained using GetJumpListSettingsAsync.
**Parameters:**
- `categories` - Array of JumpListCategory objects
#### 🧊 `void SetLoginItemSettings(LoginSettings loginSettings)`
Set the app's login item settings.
To work with Electron's autoUpdater on Windows, which uses Squirrel, you'll want to set the launch path to Update.exe, and pass arguments that specify your application name.
**Parameters:**
- `loginSettings` - Login settings
#### 🧊 `void SetPath(PathName name, string path)`
Overrides the path to a special directory or file associated with name. If the path specifies a directory that does not exist, an Error is thrown. In that case, the directory should be created with fs.mkdirSync or similar.
You can only override paths of a name defined in GetPathAsync.
By default, web pages' cookies and caches will be stored under the PathName.UserData directory. If you want to change this location, you have to override the PathName.UserData path before the Ready event of the App module is emitted.
**Parameters:**
- `name` - Special directory name
- `path` - New path to a special directory
#### 🧊 `void SetUserActivity(string type, object userInfo)`
Creates an NSUserActivity and sets it as the current activity. The activity is eligible for Handoff to another device afterward.
**Parameters:**
- `type` - Uniquely identifies the activity. Maps to NSUserActivity.activityType.
- `userInfo` - App-specific state to store for use by another device
#### 🧊 `Task<bool> SetUserTasksAsync(UserTask[] userTasks, CancellationToken cancellationToken = default)`
Adds tasks to the UserTask category of the JumpList on Windows.
Note: If you'd like to customize the Jump List even more use SetJumpList instead.
**Parameters:**
- `userTasks` - Array of UserTask objects
- `cancellationToken` - The cancellation token
**Returns:**
Whether the call succeeded.
#### 🧊 `void Show()`
Shows application windows after they were hidden. Does not automatically focus them.
#### 🧊 `void ShowAboutPanel()`
Show the app's about panel options. These options can be overridden with SetAboutPanelOptions.
## Events
#### ⚡ `AccessibilitySupportChanged`
Emitted when Chrome's accessibility support changes. This event fires when assistive technologies, such as screen readers, are enabled or disabled. See https://www.chromium.org/developers/design-documents/accessibility for more details.
#### ⚡ `BrowserWindowBlur`
Emitted when a BrowserWindow blurred.
#### ⚡ `BrowserWindowCreated`
Emitted when a new BrowserWindow is created.
#### ⚡ `BrowserWindowFocus`
Emitted when a BrowserWindow gets focused.
#### ⚡ `OpenFile`
Emitted when a macOS user wants to open a file with the application. The open-file event is usually emitted when the application is already open and the OS wants to reuse the application to open the file. open-file is also emitted when a file is dropped onto the dock and the application is not yet running.
On Windows, you have to parse the arguments using App.CommandLine to get the filepath.
#### ⚡ `OpenUrl`
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.
#### ⚡ `Quitting`
Emitted when the application is quitting.
Note: On Windows, this event will not be emitted if the app is closed due to a shutdown/restart of the system or a user logout.
#### ⚡ `Ready`
Emitted when the application has finished basic startup.
#### ⚡ `WebContentsCreated`
Emitted when a new WebContents is created.
#### ⚡ `WillQuit`
Emitted when all windows have been closed and the application will quit.
See the description of the WindowAllClosed event for the differences between the WillQuit and WindowAllClosed events.
Note: On Windows, this event will not be emitted if the app is closed due to a shutdown/restart of the system or a user logout.
#### ⚡ `WindowAllClosed`
Emitted when all windows have been closed.
If you do not subscribe to this event and all windows are closed, the default behavior is to quit the app; however, if you subscribe, you control whether the app quits or not.If the user pressed Cmd + Q, or the developer called Quit, Electron will first try to close all the windows and then emit the WillQuit event, and in this case the WindowAllClosed event would not be emitted.
## Usage Examples
### Application Lifecycle
```csharp
// Handle app startup
Electron.App.Ready += () =>
{
Console.WriteLine("App is ready!");
};
// Handle window management
Electron.App.WindowAllClosed += () =>
{
if (!RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
{
Electron.App.Quit();
}
};
// Prevent quit
Electron.App.BeforeQuit += async (args) =>
{
var result = await Electron.Dialog.ShowMessageBoxAsync("Do you want to quit?");
if (result.Response == 1) // Cancel
{
args.PreventDefault = true;
}
};
```
### Protocol Handling
```csharp
// Register custom protocol
var success = await Electron.App.SetAsDefaultProtocolClientAsync("myapp");
// Check if registered
var isDefault = await Electron.App.IsDefaultProtocolClientAsync("myapp");
```
### Jump List (Windows)
```csharp
// Set user tasks
await Electron.App.SetUserTasksAsync(new[]
{
new UserTask
{
Program = "myapp.exe",
Arguments = "--new-document",
Title = "New Document",
Description = "Create a new document"
}
});
```
### Application Information
```csharp
// Get app information
var appPath = await Electron.App.GetAppPathAsync();
var version = await Electron.App.GetVersionAsync();
var locale = await Electron.App.GetLocaleAsync();
// Set app name
await Electron.App.NameAsync; // Get current name
Electron.App.Name = "My Custom App Name";
```
### Badge Count (macOS/Linux)
```csharp
// Set badge count
await Electron.App.SetBadgeCountAsync(5);
// Get current badge count
var count = await Electron.App.GetBadgeCountAsync();
```
## Related APIs
- [Electron.WindowManager](WindowManager.md) - Window creation and management
- [Electron.Dialog](Dialog.md) - User interaction dialogs
- [Electron.Menu](Menu.md) - Application menus
## Additional Resources
- [Electron App Documentation](https://electronjs.org/docs/api/app) - Official Electron app API
- [Startup Methods](../Using/Startup-Methods.md) - Different application startup modes

243
docs/API/AutoUpdater.md Normal file
View File

@@ -0,0 +1,243 @@
# Electron.AutoUpdater
Handle application updates and installation processes.
## Overview
The `Electron.AutoUpdater` API provides comprehensive functionality for handling application updates, including checking for updates, downloading, and installation. It supports multiple update providers and platforms with automatic update capabilities.
## Properties
#### 📋 `bool AllowDowngrade`
Whether to allow version downgrade. Default is false.
#### 📋 `bool AllowPrerelease`
GitHub provider only. Whether to allow update to pre-release versions. Defaults to true if application version contains prerelease components.
#### 📋 `bool AutoDownload`
Whether to automatically download an update when it is found. Default is true.
#### 📋 `bool AutoInstallOnAppQuit`
Whether to automatically install a downloaded update on app quit. Applicable only on Windows and Linux.
#### 📋 `string Channel`
Get the update channel. Not applicable for GitHub. Doesn't return channel from the update configuration, only if was previously set.
#### 📋 `Task<string> ChannelAsync`
Get the update channel. Not applicable for GitHub. Doesn't return channel from the update configuration, only if was previously set.
#### 📋 `Task<SemVer> CurrentVersionAsync`
Get the current application version.
#### 📋 `bool FullChangelog`
GitHub provider only. Get all release notes (from current version to latest), not just the latest. Default is false.
#### 📋 `Dictionary<string, string> RequestHeaders`
The request headers.
#### 📋 `Task<Dictionary<string, string>> RequestHeadersAsync`
Get the current request headers.
#### 📋 `string UpdateConfigPath`
For test only. Configuration path for updates.
## Methods
#### 🧊 `Task<UpdateCheckResult> CheckForUpdatesAndNotifyAsync()`
Asks the server whether there is an update and notifies the user if an update is available.
#### 🧊 `Task<UpdateCheckResult> CheckForUpdatesAsync()`
Asks the server whether there is an update.
#### 🧊 `Task<string> DownloadUpdateAsync()`
Start downloading update manually. Use this method if AutoDownload option is set to false.
**Returns:**
Path to downloaded file.
#### 🧊 `Task<string> GetFeedURLAsync()`
Get the current feed URL.
**Returns:**
Feed URL.
#### 🧊 `void QuitAndInstall(bool isSilent = false, bool isForceRunAfter = false)`
Restarts the app and installs the update after it has been downloaded. 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. This is different from the normal quit event sequence.
**Parameters:**
- `isSilent` - Windows-only: Runs the installer in silent mode. Defaults to false
- `isForceRunAfter` - Run the app after finish even on silent install. Not applicable for macOS
## Events
#### ⚡ `OnCheckingForUpdate`
Emitted when checking if an update has started.
#### ⚡ `OnDownloadProgress`
Emitted on download progress.
#### ⚡ `OnError`
Emitted when there is an error while updating.
#### ⚡ `OnUpdateAvailable`
Emitted when there is an available update. The update is downloaded automatically if AutoDownload is true.
#### ⚡ `OnUpdateDownloaded`
Emitted on download complete.
#### ⚡ `OnUpdateNotAvailable`
Emitted when there is no available update.
## Usage Examples
### Basic Auto-Update Setup
```csharp
// Configure auto-updater
Electron.AutoUpdater.AutoDownload = true;
Electron.AutoUpdater.AutoInstallOnAppQuit = true;
// Check for updates
var updateCheck = await Electron.AutoUpdater.CheckForUpdatesAsync();
if (updateCheck.UpdateInfo != null)
{
Console.WriteLine($"Update available: {updateCheck.UpdateInfo.Version}");
}
```
### Manual Update Management
```csharp
// Disable auto-download for manual control
Electron.AutoUpdater.AutoDownload = false;
// Check for updates
var result = await Electron.AutoUpdater.CheckForUpdatesAsync();
if (result.UpdateInfo != null)
{
Console.WriteLine($"Update found: {result.UpdateInfo.Version}");
// Ask user confirmation
var confirmResult = await Electron.Dialog.ShowMessageBoxAsync(
"Update Available",
$"Version {result.UpdateInfo.Version} is available. Download now?");
if (confirmResult.Response == 1) // Yes
{
// Download update manually
var downloadPath = await Electron.AutoUpdater.DownloadUpdateAsync();
Console.WriteLine($"Downloaded to: {downloadPath}");
// Install update
Electron.AutoUpdater.QuitAndInstall();
}
}
```
### Update Event Handling
```csharp
// Handle update events
Electron.AutoUpdater.OnCheckingForUpdate += () =>
{
Console.WriteLine("Checking for updates...");
};
Electron.AutoUpdater.OnUpdateAvailable += (updateInfo) =>
{
Console.WriteLine($"Update available: {updateInfo.Version}");
};
Electron.AutoUpdater.OnUpdateNotAvailable += (updateInfo) =>
{
Console.WriteLine("No updates available");
};
Electron.AutoUpdater.OnDownloadProgress += (progressInfo) =>
{
Console.WriteLine($"Download progress: {progressInfo.Percent}%");
};
Electron.AutoUpdater.OnUpdateDownloaded += (updateInfo) =>
{
Console.WriteLine($"Update downloaded: {updateInfo.Version}");
// Show notification to user
Electron.Notification.Show(new NotificationOptions
{
Title = "Update Downloaded",
Body = $"Version {updateInfo.Version} is ready to install.",
Actions = new[]
{
new NotificationAction { Text = "Install Now", Type = NotificationActionType.Button },
new NotificationAction { Text = "Later", Type = NotificationActionType.Button }
}
});
};
Electron.AutoUpdater.OnError += (error) =>
{
Console.WriteLine($"Update error: {error}");
Electron.Dialog.ShowErrorBox("Update Error", $"Failed to update: {error}");
};
```
### GitHub Provider Configuration
```csharp
// Configure for GitHub releases
Electron.AutoUpdater.AllowPrerelease = true; // Allow pre-release versions
Electron.AutoUpdater.FullChangelog = true; // Get full changelog
Electron.AutoUpdater.AllowDowngrade = false; // Prevent downgrades
// Set request headers if needed
Electron.AutoUpdater.RequestHeaders = new Dictionary<string, string>
{
["Authorization"] = "token your-github-token",
["User-Agent"] = "MyApp-Updater"
};
```
### Update Installation
```csharp
// Install update immediately
if (updateDownloaded)
{
Electron.AutoUpdater.QuitAndInstall();
}
// Silent install (Windows only)
Electron.AutoUpdater.QuitAndInstall(isSilent: true, isForceRunAfter: true);
```
### Version Management
```csharp
// Get current version
var currentVersion = await Electron.AutoUpdater.CurrentVersionAsync;
Console.WriteLine($"Current version: {currentVersion}");
// Get update channel
var channel = await Electron.AutoUpdater.ChannelAsync;
Console.WriteLine($"Update channel: {channel}");
// Set custom feed URL
// Note: This would typically be configured in electron-builder.json
var feedUrl = await Electron.AutoUpdater.GetFeedURLAsync();
Console.WriteLine($"Feed URL: {feedUrl}");
```
## Related APIs
- [Electron.App](App.md) - Application lifecycle events during updates
- [Electron.Notification](Notification.md) - Notify users about update status
- [Electron.Dialog](Dialog.md) - Show update confirmation dialogs
## Additional Resources
- [Electron AutoUpdater Documentation](https://electronjs.org/docs/api/auto-updater) - Official Electron auto-updater API

231
docs/API/Clipboard.md Normal file
View File

@@ -0,0 +1,231 @@
# Electron.Clipboard
Perform copy and paste operations on the system clipboard.
## Overview
The `Electron.Clipboard` API provides comprehensive access to the system clipboard, supporting multiple data formats including text, HTML, RTF, images, and custom data. It enables reading from and writing to the clipboard with platform-specific behavior.
## Methods
#### 🧊 `Task<string[]> AvailableFormatsAsync(string type = "")`
Get an array of supported formats for the clipboard type.
**Parameters:**
- `type` - Clipboard type
**Returns:**
An array of supported formats for the clipboard type.
#### 🧊 `void Clear(string type = "")`
Clears the clipboard content.
**Parameters:**
- `type` - Clipboard type
#### 🧊 `Task<ReadBookmark> ReadBookmarkAsync()`
Returns an Object containing title and url keys representing the bookmark in the clipboard. The title and url values will be empty strings when the bookmark is unavailable.
**Returns:**
Object containing title and url keys representing the bookmark in the clipboard.
#### 🧊 `Task<string> ReadFindTextAsync()`
macOS: The text on the find pasteboard. This method uses synchronous IPC when called from the renderer process. The cached value is reread from the find pasteboard whenever the application is activated.
**Returns:**
The text on the find pasteboard.
#### 🧊 `Task<string> ReadHTMLAsync(string type = "")`
Read the content in the clipboard as HTML markup.
**Parameters:**
- `type` - Clipboard type
**Returns:**
The content in the clipboard as markup.
#### 🧊 `Task<NativeImage> ReadImageAsync(string type = "")`
Read an image from the clipboard.
**Parameters:**
- `type` - Clipboard type
**Returns:**
An image from the clipboard.
#### 🧊 `Task<string> ReadRTFAsync(string type = "")`
Read the content in the clipboard as RTF.
**Parameters:**
- `type` - Clipboard type
**Returns:**
The content in the clipboard as RTF.
#### 🧊 `Task<string> ReadTextAsync(string type = "")`
Read the content in the clipboard as plain text.
**Parameters:**
- `type` - Clipboard type
**Returns:**
The content in the clipboard as plain text.
#### 🧊 `void Write(Data data, string type = "")`
Writes data to the clipboard.
**Parameters:**
- `data` - Data object to write
- `type` - Clipboard type
#### 🧊 `void WriteBookmark(string title, string url, string type = "")`
Writes the title and url into the clipboard as a bookmark.
Note: Most apps on Windows don't support pasting bookmarks into them so you can use clipboard.write to write both a bookmark and fallback text to the clipboard.
**Parameters:**
- `title` - Bookmark title
- `url` - Bookmark URL
- `type` - Clipboard type
#### 🧊 `void WriteFindText(string text)`
macOS: Writes the text into the find pasteboard as plain text. This method uses synchronous IPC when called from the renderer process.
**Parameters:**
- `text` - Text to write to find pasteboard
#### 🧊 `void WriteHTML(string markup, string type = "")`
Writes markup to the clipboard.
**Parameters:**
- `markup` - HTML markup to write
- `type` - Clipboard type
#### 🧊 `void WriteImage(NativeImage image, string type = "")`
Writes an image to the clipboard.
**Parameters:**
- `image` - Image to write to clipboard
- `type` - Clipboard type
#### 🧊 `void WriteRTF(string text, string type = "")`
Writes the text into the clipboard in RTF.
**Parameters:**
- `text` - RTF content to write
- `type` - Clipboard type
#### 🧊 `void WriteText(string text, string type = "")`
Writes the text into the clipboard as plain text.
**Parameters:**
- `text` - Text content to write
- `type` - Clipboard type
## Usage Examples
### Basic Text Operations
```csharp
// Read text from clipboard
var text = await Electron.Clipboard.ReadTextAsync();
Console.WriteLine($"Clipboard text: {text}");
// Write text to clipboard
Electron.Clipboard.WriteText("Hello, Electron.NET!");
// Read with specific type
var html = await Electron.Clipboard.ReadHTMLAsync("public.main");
```
### Rich Content Handling
```csharp
// Copy formatted text
var htmlContent = "<h1>Title</h1><p>Some <strong>bold</strong> text</p>";
Electron.Clipboard.WriteHTML(htmlContent);
// Read RTF content
var rtf = await Electron.Clipboard.ReadRTFAsync();
Console.WriteLine($"RTF content: {rtf}");
```
### Image Operations
```csharp
// Read image from clipboard
var image = await Electron.Clipboard.ReadImageAsync();
if (image != null)
{
Console.WriteLine($"Image size: {image.Size.Width}x{image.Size.Height}");
}
// Write image to clipboard
var nativeImage = NativeImage.CreateFromPath("screenshot.png");
Electron.Clipboard.WriteImage(nativeImage);
```
### Bookmark Management
```csharp
// Read bookmark from clipboard
var bookmark = await Electron.Clipboard.ReadBookmarkAsync();
if (!string.IsNullOrEmpty(bookmark.Title))
{
Console.WriteLine($"Bookmark: {bookmark.Title} -> {bookmark.Url}");
}
// Write bookmark to clipboard
Electron.Clipboard.WriteBookmark("Electron.NET", "https://github.com/ElectronNET/Electron.NET");
```
### Advanced Clipboard Operations
```csharp
// Check available formats
var formats = await Electron.Clipboard.AvailableFormatsAsync();
Console.WriteLine($"Available formats: {string.Join(", ", formats)}");
// Clear clipboard
Electron.Clipboard.Clear();
// Write custom data
var data = new Data
{
Text = "Custom data",
Html = "<p>Custom HTML</p>",
Image = nativeImage
};
Electron.Clipboard.Write(data);
```
### macOS Find Pasteboard
```csharp
// macOS specific find pasteboard operations
if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
{
// Read find text
var findText = await Electron.Clipboard.ReadFindTextAsync();
Console.WriteLine($"Find text: {findText}");
// Write find text
Electron.Clipboard.WriteFindText("search term");
}
```
## Related APIs
- [Electron.Shell](Shell.md) - Work with file paths from clipboard
- [Electron.Notification](Notification.md) - Show clipboard operation results
## Additional Resources
- [Electron Clipboard Documentation](https://electronjs.org/docs/api/clipboard) - Official Electron clipboard API

160
docs/API/Dialog.md Normal file
View File

@@ -0,0 +1,160 @@
# Electron.Dialog
Display native system dialogs for opening and saving files, alerting, etc.
## Overview
The `Electron.Dialog` API provides access to native system dialogs for file operations, message boxes, and certificate trust dialogs. These dialogs are modal and provide a consistent user experience across different platforms.
## Methods
#### 🧊 `Task<MessageBoxResult> ShowMessageBoxAsync(BrowserWindow browserWindow, MessageBoxOptions messageBoxOptions)`
Shows a message box, it will block the process until the message box is closed. It returns the index of the clicked button. If a callback is passed, the dialog will not block the process.
**Parameters:**
- `browserWindow` - The browserWindow argument allows the dialog to attach itself to a parent window, making it modal.
- `messageBoxOptions` - Message content and configuration
**Returns:**
The API call will be asynchronous and the result will be passed via MessageBoxResult.
#### 🧊 `Task<MessageBoxResult> ShowMessageBoxAsync(BrowserWindow browserWindow, string message)`
Shows a message box, it will block the process until the message box is closed. It returns the index of the clicked button. If a callback is passed, the dialog will not block the process.
**Parameters:**
- `browserWindow` - The browserWindow argument allows the dialog to attach itself to a parent window, making it modal.
- `message` - Message content
**Returns:**
The API call will be asynchronous and the result will be passed via MessageBoxResult.
#### 🧊 `Task<MessageBoxResult> ShowMessageBoxAsync(MessageBoxOptions messageBoxOptions)`
Shows a message box, it will block the process until the message box is closed. It returns the index of the clicked button. If a callback is passed, the dialog will not block the process.
**Parameters:**
- `messageBoxOptions` - Message content and configuration
**Returns:**
The API call will be asynchronous and the result will be passed via MessageBoxResult.
#### 🧊 `Task<MessageBoxResult> ShowMessageBoxAsync(string message)`
Shows a message box, it will block the process until the message box is closed. It returns the index of the clicked button. If a callback is passed, the dialog will not block the process.
**Parameters:**
- `message` - Message content
**Returns:**
The API call will be asynchronous and the result will be passed via MessageBoxResult.
#### 🧊 `Task<string[]> ShowOpenDialogAsync(BrowserWindow browserWindow, OpenDialogOptions options)`
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'] on these platforms, a directory selector will be shown.
**Parameters:**
- `browserWindow` - The browserWindow argument allows the dialog to attach itself to a parent window, making it modal.
- `options` - Dialog configuration options
**Returns:**
An array of file paths chosen by the user
#### 🧊 `Task<string> ShowSaveDialogAsync(BrowserWindow browserWindow, SaveDialogOptions options)`
Dialog for save files.
**Parameters:**
- `browserWindow` - The browserWindow argument allows the dialog to attach itself to a parent window, making it modal.
- `options` - Dialog configuration options
**Returns:**
Returns String, the path of the file chosen by the user, if a callback is provided it returns an empty string.
#### 🧊 `void ShowErrorBox(string title, string content)`
Displays a modal dialog that shows an error message.
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 before the app readyevent on Linux, the message will be emitted to stderr, and no GUI dialog will appear.
**Parameters:**
- `title` - The title to display in the error box.
- `content` - The text content to display in the error box.
#### 🧊 `Task ShowCertificateTrustDialogAsync(BrowserWindow browserWindow, CertificateTrustDialogOptions options)`
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 browserWindow argument the dialog will be attached to the parent window, making it modal.
**Parameters:**
- `browserWindow` - Parent window for modal behavior
- `options` - Certificate trust dialog options
#### 🧊 `Task ShowCertificateTrustDialogAsync(CertificateTrustDialogOptions options)`
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 browserWindow argument the dialog will be attached to the parent window, making it modal.
**Parameters:**
- `options` - Certificate trust dialog options
## Usage Examples
### File Operations
```csharp
// Open multiple files
var files = await Electron.Dialog.ShowOpenDialogAsync(window, new OpenDialogOptions
{
Properties = new[] { OpenDialogProperty.OpenFile, OpenDialogProperty.MultiSelections }
});
// Save with custom extension
var path = await Electron.Dialog.ShowSaveDialogAsync(window, new SaveDialogOptions
{
DefaultPath = "backup.json",
Filters = new[] { new FileFilter { Name = "JSON", Extensions = new[] { "json" } } }
});
```
### User Confirmation
```csharp
// Confirmation dialog
var result = await Electron.Dialog.ShowMessageBoxAsync(window, new MessageBoxOptions
{
Type = MessageBoxType.Question,
Title = "Confirm Delete",
Message = $"Delete {filename}?",
Buttons = new[] { "Cancel", "Delete" },
DefaultId = 0,
CancelId = 0
});
if (result.Response == 1)
{
// Delete file
}
```
### Error Handling
```csharp
// Error dialog
Electron.Dialog.ShowErrorBox("Save Failed", "Could not save file. Please check permissions and try again.");
// Warning dialog
await Electron.Dialog.ShowMessageBoxAsync(new MessageBoxOptions
{
Type = MessageBoxType.Warning,
Title = "Warning",
Message = "This operation may take several minutes.",
Buttons = new[] { "Continue", "Cancel" }
});
```
## Related APIs
- [Electron.WindowManager](WindowManager.md) - Parent windows for modal dialogs
- [Electron.App](App.md) - Application lifecycle events
- [Electron.Shell](Shell.md) - File operations with selected paths
## Additional Resources
- [Electron Dialog Documentation](https://electronjs.org/docs/api/dialog) - Official Electron dialog API

209
docs/API/Dock.md Normal file
View File

@@ -0,0 +1,209 @@
# Electron.Dock
Control your app in the macOS dock.
## Overview
The `Electron.Dock` API provides control over your application's appearance and behavior in the macOS dock. This includes bouncing the dock icon, setting badges, managing menus, and controlling visibility.
## Properties
#### 📋 `IReadOnlyCollection<MenuItem> MenuItems`
Gets a read-only collection of all current dock menu items.
## Methods
#### 🧊 `Task<int> BounceAsync(DockBounceType type, CancellationToken cancellationToken = default)`
When `DockBounceType.Critical` is passed, the dock icon will bounce until either the application becomes active or the request is canceled. When `DockBounceType.Informational` is passed, the dock icon will bounce for one second. However, the request remains active until either the application becomes active or the request is canceled.
Note: This method can only be used while the app is not focused; when the app is focused it will return -1.
**Parameters:**
- `type` - Can be critical or informational. The default is informational.
- `cancellationToken` - The cancellation token
**Returns:**
An ID representing the request.
#### 🧊 `void CancelBounce(int id)`
Cancel the bounce of id.
**Parameters:**
- `id` - Id of the request
#### 🧊 `void DownloadFinished(string filePath)`
Bounces the Downloads stack if the filePath is inside the Downloads folder.
**Parameters:**
- `filePath` - Path to the downloaded file
#### 🧊 `Task<string> GetBadgeAsync(CancellationToken cancellationToken = default)`
Gets the string to be displayed in the dock's badging area.
**Returns:**
The badge string of the dock.
#### 🧊 `Task<Menu> GetMenu(CancellationToken cancellationToken = default)`
Gets the application's dock menu.
**Returns:**
The application's dock menu.
#### 🧊 `void Hide()`
Hides the dock icon.
#### 🧊 `Task<bool> IsVisibleAsync(CancellationToken cancellationToken = default)`
Whether the dock icon is visible. The app.dock.show() call is asynchronous so this method might not return true immediately after that call.
**Returns:**
Whether the dock icon is visible.
#### 🧊 `void SetBadge(string text)`
Sets the string to be displayed in the dock's badging area.
**Parameters:**
- `text` - Badge text to display
#### 🧊 `void SetIcon(string image)`
Sets the image associated with this dock icon.
**Parameters:**
- `image` - Icon image path
#### 🧊 `void SetMenu(MenuItem[] menuItems)`
Sets the application's dock menu.
**Parameters:**
- `menuItems` - Array of menu items for the dock menu
#### 🧊 `void Show()`
Shows the dock icon.
## Usage Examples
### Basic Dock Operations
```csharp
// Hide/Show dock icon
Electron.Dock.Hide();
await Task.Delay(2000);
Electron.Dock.Show();
// Check visibility
var isVisible = await Electron.Dock.IsVisibleAsync();
Console.WriteLine($"Dock visible: {isVisible}");
```
### Badge Notifications
```csharp
// Set badge count
Electron.Dock.SetBadge("5");
// Get current badge
var badge = await Electron.Dock.GetBadgeAsync();
Console.WriteLine($"Current badge: {badge}");
// Clear badge
Electron.Dock.SetBadge("");
```
### Dock Icon Animation
```csharp
// Bounce for attention
var bounceId = await Electron.Dock.BounceAsync(DockBounceType.Critical);
Console.WriteLine($"Bounce ID: {bounceId}");
// Cancel bounce after 3 seconds
await Task.Delay(3000);
Electron.Dock.CancelBounce(bounceId);
// Informational bounce
await Electron.Dock.BounceAsync(DockBounceType.Informational);
```
### Dock Menu
```csharp
// Create dock menu
var dockMenuItems = new[]
{
new MenuItem { Label = "Show Window", Click = () => ShowMainWindow() },
new MenuItem { Label = "Settings", Click = () => OpenSettings() },
new MenuItem { Type = MenuType.Separator },
new MenuItem { Label = "Exit", Click = () => Electron.App.Quit() }
};
// Set dock menu
Electron.Dock.SetMenu(dockMenuItems);
// Get current menu
var currentMenu = await Electron.Dock.GetMenu();
Console.WriteLine($"Menu items: {Electron.Dock.MenuItems.Count}");
```
### Download Notifications
```csharp
// Notify about completed download
var downloadPath = "/Users/username/Downloads/document.pdf";
Electron.Dock.DownloadFinished(downloadPath);
```
### Custom Dock Icon
```csharp
// Set custom dock icon
Electron.Dock.SetIcon("assets/custom-dock-icon.png");
// Set icon based on status
if (isConnected)
{
Electron.Dock.SetIcon("assets/connected-icon.png");
}
else
{
Electron.Dock.SetIcon("assets/disconnected-icon.png");
}
```
### Application Integration
```csharp
// Update dock badge based on unread count
UpdateDockBadge(unreadMessageCount);
void UpdateDockBadge(int count)
{
if (count > 0)
{
Electron.Dock.SetBadge(count.ToString());
}
else
{
Electron.Dock.SetBadge("");
}
}
// Animate dock when receiving message
private async void OnMessageReceived()
{
await Electron.Dock.BounceAsync(DockBounceType.Informational);
Electron.Dock.SetBadge((unreadCount + 1).ToString());
}
```
## Related APIs
- [Electron.App](App.md) - Application lifecycle events
- [Electron.Notification](Notification.md) - Desktop notifications
- [Electron.Menu](Menu.md) - Menu items for dock menu
## Additional Resources
- [Electron Dock Documentation](https://electronjs.org/docs/api/dock) - Official Electron dock API

189
docs/API/GlobalShortcut.md Normal file
View File

@@ -0,0 +1,189 @@
# Electron.GlobalShortcut
Register global keyboard shortcuts that work even when the application is not focused.
## Overview
The `Electron.GlobalShortcut` API provides the ability to register global keyboard shortcuts that can be triggered even when the application does not have keyboard focus. This is useful for creating system-wide hotkeys and shortcuts.
## Methods
#### 🧊 `Task<bool> IsRegisteredAsync(string accelerator)`
Check if the accelerator is registered.
**Parameters:**
- `accelerator` - Keyboard shortcut to check
**Returns:**
Whether this application has registered the accelerator.
#### 🧊 `void Register(string accelerator, Action function)`
Registers a global shortcut of accelerator. The callback is called when the registered shortcut is pressed by the user.
**Parameters:**
- `accelerator` - Keyboard shortcut combination
- `function` - Callback function to execute when shortcut is pressed
#### 🧊 `void Unregister(string accelerator)`
Unregisters the global shortcut of accelerator.
**Parameters:**
- `accelerator` - Keyboard shortcut to unregister
#### 🧊 `void UnregisterAll()`
Unregisters all of the global shortcuts.
## Usage Examples
### Basic Global Shortcuts
```csharp
// Register global shortcuts
Electron.GlobalShortcut.Register("CommandOrControl+N", () =>
{
CreateNewDocument();
});
Electron.GlobalShortcut.Register("CommandOrControl+O", () =>
{
OpenDocument();
});
Electron.GlobalShortcut.Register("CommandOrControl+S", () =>
{
SaveDocument();
});
```
### Media Control Shortcuts
```csharp
// Media playback shortcuts
Electron.GlobalShortcut.Register("MediaPlayPause", () =>
{
TogglePlayback();
});
Electron.GlobalShortcut.Register("MediaNextTrack", () =>
{
NextTrack();
});
Electron.GlobalShortcut.Register("MediaPreviousTrack", () =>
{
PreviousTrack();
});
```
### Application Control Shortcuts
```csharp
// Application control shortcuts
Electron.GlobalShortcut.Register("CommandOrControl+Shift+Q", async () =>
{
var result = await Electron.Dialog.ShowMessageBoxAsync("Quit Application?", "Are you sure you want to quit?");
if (result.Response == 1) // Yes
{
Electron.App.Quit();
}
});
Electron.GlobalShortcut.Register("CommandOrControl+Shift+H", () =>
{
ToggleMainWindow();
});
```
### Dynamic Shortcut Management
```csharp
// Register shortcuts based on user preferences
public void RegisterUserShortcuts(Dictionary<string, Action> shortcuts)
{
foreach (var shortcut in shortcuts)
{
Electron.GlobalShortcut.Register(shortcut.Key, shortcut.Value);
}
}
// Check if shortcut is available
public async Task<bool> IsShortcutAvailable(string accelerator)
{
return await Electron.GlobalShortcut.IsRegisteredAsync(accelerator);
}
// Unregister specific shortcut
public void UnregisterShortcut(string accelerator)
{
Electron.GlobalShortcut.Unregister(accelerator);
}
```
### Platform-Specific Shortcuts
```csharp
// macOS specific shortcuts
if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
{
Electron.GlobalShortcut.Register("Command+Comma", () =>
{
OpenPreferences();
});
Electron.GlobalShortcut.Register("Command+H", () =>
{
Electron.App.Hide();
});
}
// Windows/Linux shortcuts
else
{
Electron.GlobalShortcut.Register("Ctrl+Shift+P", () =>
{
OpenPreferences();
});
Electron.GlobalShortcut.Register("Alt+F4", () =>
{
Electron.App.Quit();
});
}
```
### Shortcut Validation
```csharp
// Validate shortcuts before registration
public async Task<bool> TryRegisterShortcut(string accelerator, Action callback)
{
if (await Electron.GlobalShortcut.IsRegisteredAsync(accelerator))
{
Console.WriteLine($"Shortcut {accelerator} is already registered");
return false;
}
try
{
Electron.GlobalShortcut.Register(accelerator, callback);
Console.WriteLine($"Successfully registered shortcut: {accelerator}");
return true;
}
catch (Exception ex)
{
Console.WriteLine($"Failed to register shortcut {accelerator}: {ex.Message}");
return false;
}
}
```
## Related APIs
- [Electron.App](App.md) - Application lifecycle events
- [Electron.Menu](Menu.md) - Menu-based shortcuts
- [Electron.WindowManager](WindowManager.md) - Window focus management
## Additional Resources
- [Electron GlobalShortcut Documentation](https://electronjs.org/docs/api/global-shortcut) - Official Electron global shortcut API

152
docs/API/HostHook.md Normal file
View File

@@ -0,0 +1,152 @@
# Electron.HostHook
Execute native JavaScript/TypeScript code from the host process.
## Overview
The `Electron.HostHook` API allows you to execute native JavaScript/TypeScript code from the host process. This enables advanced integration scenarios where you need to run custom JavaScript code or access Node.js APIs directly.
## Methods
#### 🧊 `void Call(string socketEventName, params dynamic[] arguments)`
Execute native JavaScript/TypeScript code synchronously.
**Parameters:**
- `socketEventName` - Socket name registered on the host
- `arguments` - Optional parameters
#### 🧊 `Task<T> CallAsync<T>(string socketEventName, params dynamic[] arguments)`
Execute native JavaScript/TypeScript code asynchronously with type-safe return values.
**Parameters:**
- `T` - Expected return type
- `socketEventName` - Socket name registered on the host
- `arguments` - Optional parameters
**Returns:**
Task<T> with the result from the executed host code.
## Usage Examples
### Basic Host Hook Execution
```csharp
// Execute simple JavaScript function
Electron.HostHook.Call("myFunction", "parameter1", 42);
// Execute with callback-style result
var result = await Electron.HostHook.CallAsync<string>("getUserName", userId);
Console.WriteLine($"User name: {result}");
```
### Advanced Integration
```csharp
// Call custom Electron API
var fileContent = await Electron.HostHook.CallAsync<string>("readFile", "config.json");
Console.WriteLine($"Config: {fileContent}");
// Execute with multiple parameters
var processedData = await Electron.HostHook.CallAsync<object[]>("processData", rawData, options);
// Call with complex objects
var settings = new { theme = "dark", language = "en" };
var updatedSettings = await Electron.HostHook.CallAsync<object>("updateSettings", settings);
```
### Error Handling
```csharp
try
{
// Execute host function with error handling
var result = await Electron.HostHook.CallAsync<string>("riskyOperation", inputData);
Console.WriteLine($"Success: {result}");
}
catch (Exception ex)
{
// Handle execution errors
Console.WriteLine($"Host hook error: {ex.Message}");
Electron.Dialog.ShowErrorBox("Operation Failed", "Could not execute host function.");
}
```
### Type-Safe Operations
```csharp
// Strongly typed return values
var userInfo = await Electron.HostHook.CallAsync<UserInfo>("getUserInfo", userId);
Console.WriteLine($"User: {userInfo.Name}, Email: {userInfo.Email}");
// Array results
var fileList = await Electron.HostHook.CallAsync<string[]>("listFiles", directoryPath);
foreach (var file in fileList)
{
Console.WriteLine($"File: {file}");
}
// Complex object results
var systemStats = await Electron.HostHook.CallAsync<SystemStatistics>("getSystemStats");
Console.WriteLine($"CPU: {systemStats.CpuUsage}%, Memory: {systemStats.MemoryUsage}%");
```
### Custom ElectronHostHook Setup
```csharp
// In your ElectronHostHook/index.ts
import { app } from 'electron';
export function getAppVersion(): string {
return app.getVersion();
}
export async function readConfigFile(): Promise<string> {
const fs = require('fs').promises;
return await fs.readFile('config.json', 'utf8');
}
export function customNotification(message: string): void {
// Custom notification logic
console.log(`Custom notification: ${message}`);
}
```
### Integration with .NET Code
```csharp
// Use host hook in your application logic
public async Task<string> GetApplicationVersion()
{
return await Electron.HostHook.CallAsync<string>("getAppVersion");
}
public async Task LoadConfiguration()
{
try
{
var config = await Electron.HostHook.CallAsync<ConfigObject>("readConfigFile");
ApplyConfiguration(config);
}
catch (Exception ex)
{
Console.WriteLine($"Failed to load config: {ex.Message}");
UseDefaultConfiguration();
}
}
public void ShowCustomNotification(string message)
{
Electron.HostHook.Call("customNotification", message);
}
```
## Related APIs
- [Electron.IpcMain](IpcMain.md) - Inter-process communication
- [Electron.App](App.md) - Application lifecycle events
- [Electron.WebContents](WebContents.md) - Web content integration
## Additional Resources
- [Host Hook Documentation](../Core/Advanced-Migration-Topics.md) - Setting up custom host hooks

167
docs/API/IpcMain.md Normal file
View File

@@ -0,0 +1,167 @@
# Electron.IpcMain
Communicate asynchronously from the main process to renderer processes.
## Overview
The `Electron.IpcMain` API provides inter-process communication between the main process and renderer processes. It allows you to send messages, listen for events, and handle communication between different parts of your Electron application.
## Methods
#### 🧊 `Task On(string channel, Action<object> listener)`
Listens to channel, when a new message arrives listener would be called with listener(event, args...).
**Parameters:**
- `channel` - Channel name to listen on
- `listener` - Callback method to handle incoming messages
#### 🧊 `void OnSync(string channel, Func<object, object> listener)`
Send a message to the renderer process synchronously via channel. Note: Sending a synchronous message will block the whole renderer process.
**Parameters:**
- `channel` - Channel name to listen on
- `listener` - Synchronous callback method
#### 🧊 `void Once(string channel, Action<object> listener)`
Adds a one time listener method for the event. This listener is invoked only the next time a message is sent to channel, after which it is removed.
**Parameters:**
- `channel` - Channel name to listen on
- `listener` - Callback method to handle the message once
#### 🧊 `void RemoveAllListeners(string channel)`
Removes all listeners of the specified channel.
**Parameters:**
- `channel` - Channel name to remove listeners from
#### 🧊 `void Send(BrowserView browserView, string channel, params object[] data)`
Send a message to the BrowserView renderer process asynchronously via channel.
**Parameters:**
- `browserView` - Target browser view
- `channel` - Channel name to send on
- `data` - Arguments to send
#### 🧊 `void Send(BrowserWindow browserWindow, string channel, params object[] data)`
Send a message to the renderer process asynchronously via channel.
**Parameters:**
- `browserWindow` - Target browser window
- `channel` - Channel name to send on
- `data` - Arguments to send
## Usage Examples
### Basic Message Handling
```csharp
// Listen for messages from renderer
await Electron.IpcMain.On("request-data", (args) =>
{
Console.WriteLine($"Received request: {args}");
// Process the request and send response
});
// Send response back to renderer
Electron.IpcMain.Send(mainWindow, "data-response", processedData);
```
### Synchronous Communication
```csharp
// Handle synchronous requests
Electron.IpcMain.OnSync("get-user-info", (request) =>
{
var userId = request.ToString();
var userInfo = GetUserInfo(userId);
return userInfo;
});
```
### One-time Event Handling
```csharp
// Handle initialization request once
Electron.IpcMain.Once("app-initialized", (args) =>
{
Console.WriteLine("App initialized, setting up...");
InitializeApplication();
});
```
### Complex Data Exchange
```csharp
// Send complex data to renderer
var appData = new
{
Version = "1.0.0",
Features = new[] { "feature1", "feature2" },
Settings = new { Theme = "dark", Language = "en" }
};
Electron.IpcMain.Send(mainWindow, "app-config", appData);
// Listen for settings updates
await Electron.IpcMain.On("update-settings", (settings) =>
{
var config = JsonConvert.DeserializeObject<AppSettings>(settings.ToString());
ApplySettings(config);
});
```
### Multi-Window Communication
```csharp
// Send message to specific window
var settingsWindow = await Electron.WindowManager.CreateWindowAsync();
Electron.IpcMain.Send(settingsWindow, "show-settings", currentSettings);
// Broadcast to all windows
foreach (var window in Electron.WindowManager.BrowserWindows)
{
Electron.IpcMain.Send(window, "notification", message);
}
```
### Error Handling
```csharp
// Handle IPC errors gracefully
await Electron.IpcMain.On("risky-operation", async (args) =>
{
try
{
var result = await PerformRiskyOperation(args);
Electron.IpcMain.Send(mainWindow, "operation-success", result);
}
catch (Exception ex)
{
Electron.IpcMain.Send(mainWindow, "operation-error", ex.Message);
}
});
```
### Integration with Host Hooks
```csharp
// Use with custom host functionality
await Electron.IpcMain.On("execute-host-function", async (args) =>
{
var functionName = args.ToString();
var result = await Electron.HostHook.CallAsync<string>(functionName);
Electron.IpcMain.Send(mainWindow, "function-result", result);
});
```
## Related APIs
- [Electron.HostHook](HostHook.md) - Execute custom JavaScript functions
- [Electron.WindowManager](WindowManager.md) - Target specific windows for communication
- [Electron.WebContents](WebContents.md) - Send messages to web content
## Additional Resources
- [Electron IPC Documentation](https://electronjs.org/docs/api/ipc-main) - Official Electron IPC API

210
docs/API/Menu.md Normal file
View File

@@ -0,0 +1,210 @@
# Electron.Menu
Create application menus, context menus, and menu items with full keyboard shortcut support.
## Overview
The `Electron.Menu` API provides comprehensive control over application menus and context menus. It supports native platform menus with custom menu items, submenus, keyboard shortcuts, and role-based menu items.
## Properties
#### 📋 `IReadOnlyDictionary<int, ReadOnlyCollection<MenuItem>> ContextMenuItems`
Gets a read-only dictionary of all current context menu items, keyed by browser window ID.
#### 📋 `IReadOnlyCollection<MenuItem> MenuItems`
Gets a read-only collection of all current application menu items.
## Methods
#### 🧊 `void ContextMenuPopup(BrowserWindow browserWindow)`
Shows the context menu for the specified browser window.
**Parameters:**
- `browserWindow` - The browser window to show the context menu for
#### 🧊 `void SetApplicationMenu(MenuItem[] menuItems)`
Sets the application menu for the entire application.
**Parameters:**
- `menuItems` - Array of MenuItem objects defining the application menu
#### 🧊 `void SetContextMenu(BrowserWindow browserWindow, MenuItem[] menuItems)`
Sets a context menu for a specific browser window.
**Parameters:**
- `browserWindow` - The browser window to attach the context menu to
- `menuItems` - Array of MenuItem objects defining the context menu
## Usage Examples
### Application Menu
```csharp
// Create application menu
var menuItems = new[]
{
new MenuItem
{
Label = "File",
Submenu = new[]
{
new MenuItem { Label = "New", Click = () => CreateNewDocument() },
new MenuItem { Label = "Open", Click = () => OpenDocument() },
new MenuItem { Type = MenuType.Separator },
new MenuItem { Label = "Exit", Click = () => Electron.App.Quit() }
}
},
new MenuItem
{
Label = "Edit",
Submenu = new[]
{
new MenuItem { Role = MenuRole.Undo },
new MenuItem { Role = MenuRole.Redo },
new MenuItem { Type = MenuType.Separator },
new MenuItem { Role = MenuRole.Cut },
new MenuItem { Role = MenuRole.Copy },
new MenuItem { Role = MenuRole.Paste }
}
},
new MenuItem
{
Label = "View",
Submenu = new[]
{
new MenuItem { Role = MenuRole.Reload },
new MenuItem { Role = MenuRole.ForceReload },
new MenuItem { Role = MenuRole.ToggleDevTools },
new MenuItem { Type = MenuType.Separator },
new MenuItem { Role = MenuRole.ResetZoom },
new MenuItem { Role = MenuRole.ZoomIn },
new MenuItem { Role = MenuRole.ZoomOut }
}
},
new MenuItem
{
Label = "Window",
Submenu = new[]
{
new MenuItem { Role = MenuRole.Minimize },
new MenuItem { Role = MenuRole.Close }
}
}
};
// Set application menu
Electron.Menu.SetApplicationMenu(menuItems);
```
### Context Menu
```csharp
// Create context menu for specific window
var contextMenuItems = new[]
{
new MenuItem { Label = "Copy", Click = () => CopySelectedText() },
new MenuItem { Label = "Paste", Click = () => PasteText() },
new MenuItem { Type = MenuType.Separator },
new MenuItem { Label = "Inspect Element", Click = () => InspectElement() }
};
// Set context menu for window
Electron.Menu.SetContextMenu(mainWindow, contextMenuItems);
// Show context menu programmatically
Electron.Menu.ContextMenuPopup(mainWindow);
```
### Menu with Keyboard Shortcuts
```csharp
// Create menu with keyboard shortcuts
var menuItems = new[]
{
new MenuItem
{
Label = "File",
Submenu = new[]
{
new MenuItem
{
Label = "New",
Accelerator = "CmdOrCtrl+N",
Click = () => CreateNewDocument()
},
new MenuItem
{
Label = "Open",
Accelerator = "CmdOrCtrl+O",
Click = () => OpenDocument()
},
new MenuItem
{
Label = "Save",
Accelerator = "CmdOrCtrl+S",
Click = () => SaveDocument()
}
}
}
};
Electron.Menu.SetApplicationMenu(menuItems);
```
### Dynamic Menu Updates
```csharp
// Update menu items dynamically
var fileMenu = Electron.Menu.MenuItems.FirstOrDefault(m => m.Label == "File");
if (fileMenu?.Submenu != null)
{
var saveItem = fileMenu.Submenu.FirstOrDefault(m => m.Label == "Save");
if (saveItem != null)
{
saveItem.Enabled = HasUnsavedChanges;
}
}
```
### Platform-Specific Menus
```csharp
// macOS specific menu items
if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
{
var macMenuItems = new[]
{
new MenuItem
{
Label = "MyApp",
Submenu = new[]
{
new MenuItem { Role = MenuRole.About },
new MenuItem { Type = MenuType.Separator },
new MenuItem { Role = MenuRole.Services },
new MenuItem { Type = MenuType.Separator },
new MenuItem { Role = MenuRole.Hide },
new MenuItem { Role = MenuRole.HideOthers },
new MenuItem { Role = MenuRole.Unhide },
new MenuItem { Type = MenuType.Separator },
new MenuItem { Role = MenuRole.Quit }
}
}
};
// Insert before File menu
var allMenus = new List<MenuItem>(macMenuItems);
allMenus.AddRange(menuItems);
Electron.Menu.SetApplicationMenu(allMenus.ToArray());
}
```
## Related APIs
- [Electron.WindowManager](WindowManager.md) - Windows for context menus
- [Electron.App](App.md) - Application lifecycle events
- [Electron.GlobalShortcut](GlobalShortcut.md) - Global keyboard shortcuts
## Additional Resources
- [Electron Menu Documentation](https://electronjs.org/docs/api/menu) - Official Electron menu API

189
docs/API/NativeTheme.md Normal file
View File

@@ -0,0 +1,189 @@
# Electron.NativeTheme
Detect and respond to changes in Chromium's native color theme.
## Overview
The `Electron.NativeTheme` API provides access to Chromium's native color theme information and allows you to detect and respond to changes in the system's dark/light mode settings. This enables your application to automatically adapt to the user's theme preferences.
## Methods
#### 🧊 `Task<ThemeSourceMode> GetThemeSourceAsync()`
Get the current theme source setting.
**Returns:**
A `ThemeSourceMode` property that can be `ThemeSourceMode.System`, `ThemeSourceMode.Light` or `ThemeSourceMode.Dark`.
#### 🧊 `void SetThemeSource(ThemeSourceMode themeSourceMode)`
Setting this property to `ThemeSourceMode.System` will remove the override and everything will be reset to the OS default. By default 'ThemeSource' is `ThemeSourceMode.System`.
**Parameters:**
- `themeSourceMode` - The new ThemeSource
#### 🧊 `Task<bool> ShouldUseDarkColorsAsync()`
Check if the system is currently using dark colors.
**Returns:**
A bool for if the OS / Chromium currently has a dark mode enabled or is being instructed to show a dark-style UI.
#### 🧊 `Task<bool> ShouldUseHighContrastColorsAsync()`
Check if the system is currently using high contrast colors.
**Returns:**
A bool for if the OS / Chromium currently has high-contrast mode enabled or is being instructed to show a high-contrast UI.
#### 🧊 `Task<bool> ShouldUseInvertedColorSchemeAsync()`
Check if the system is currently using an inverted color scheme.
**Returns:**
A bool for if the OS / Chromium currently has an inverted color scheme or is being instructed to use an inverted color scheme.
## Events
#### ⚡ `Updated`
Emitted when something in the underlying NativeTheme has changed. This normally means that either the value of ShouldUseDarkColorsAsync, ShouldUseHighContrastColorsAsync or ShouldUseInvertedColorSchemeAsync has changed.
## Usage Examples
### Basic Theme Detection
```csharp
// Check current theme
var isDarkMode = await Electron.NativeTheme.ShouldUseDarkColorsAsync();
Console.WriteLine($"Dark mode: {isDarkMode}");
// Get current theme source
var themeSource = await Electron.NativeTheme.GetThemeSourceAsync();
Console.WriteLine($"Theme source: {themeSource}");
```
### Theme Change Monitoring
```csharp
// Monitor theme changes
Electron.NativeTheme.Updated += () =>
{
Console.WriteLine("Theme updated");
UpdateApplicationTheme();
};
async void UpdateApplicationTheme()
{
var isDarkMode = await Electron.NativeTheme.ShouldUseDarkColorsAsync();
var isHighContrast = await Electron.NativeTheme.ShouldUseHighContrastColorsAsync();
// Update application appearance
ApplyTheme(isDarkMode, isHighContrast);
}
```
### Manual Theme Control
```csharp
// Force dark theme
Electron.NativeTheme.SetThemeSource(ThemeSourceMode.Dark);
// Force light theme
Electron.NativeTheme.SetThemeSource(ThemeSourceMode.Light);
// Follow system theme
Electron.NativeTheme.SetThemeSource(ThemeSourceMode.System);
```
### Application Theme Integration
```csharp
public async Task InitializeThemeSupport()
{
// Set initial theme based on system preference
var isDarkMode = await Electron.NativeTheme.ShouldUseDarkColorsAsync();
ApplyTheme(isDarkMode);
// Monitor theme changes
Electron.NativeTheme.Updated += async () =>
{
var darkMode = await Electron.NativeTheme.ShouldUseDarkColorsAsync();
ApplyTheme(darkMode);
};
}
private void ApplyTheme(bool isDarkMode)
{
if (isDarkMode)
{
// Apply dark theme
SetDarkThemeColors();
UpdateWindowTheme("dark");
}
else
{
// Apply light theme
SetLightThemeColors();
UpdateWindowTheme("light");
}
}
```
### Advanced Theme Management
```csharp
// Check all theme properties
var isDarkMode = await Electron.NativeTheme.ShouldUseDarkColorsAsync();
var isHighContrast = await Electron.NativeTheme.ShouldUseHighContrastColorsAsync();
var isInverted = await Electron.NativeTheme.ShouldUseInvertedColorSchemeAsync();
Console.WriteLine($"Dark mode: {isDarkMode}");
Console.WriteLine($"High contrast: {isHighContrast}");
Console.WriteLine($"Inverted: {isInverted}");
// Apply appropriate theme
if (isHighContrast)
{
ApplyHighContrastTheme();
}
else if (isDarkMode)
{
ApplyDarkTheme();
}
else
{
ApplyLightTheme();
}
```
### Theme-Aware Window Creation
```csharp
// Create window with theme-appropriate settings
var isDarkMode = await Electron.NativeTheme.ShouldUseDarkColorsAsync();
var windowOptions = new BrowserWindowOptions
{
Width = 1200,
Height = 800,
Title = "My Application",
BackgroundColor = isDarkMode ? "#1a1a1a" : "#ffffff",
WebPreferences = new WebPreferences
{
// Additional web preferences based on theme
}
};
var window = await Electron.WindowManager.CreateWindowAsync(windowOptions);
```
## Related APIs
- [Electron.WindowManager](WindowManager.md) - Apply theme to windows
- [Electron.Screen](Screen.md) - Screen-related theme considerations
- [Electron.App](App.md) - Application-level theme events
## Additional Resources
- [Electron NativeTheme Documentation](https://electronjs.org/docs/api/native-theme) - Official Electron native theme API
- [Theme Support](../Core/What's-New.md) - Understanding theme functionality
- [User Experience](../Using/Configuration.md) - Design theme-aware applications

164
docs/API/Notification.md Normal file
View File

@@ -0,0 +1,164 @@
# Electron.Notification
Show native desktop notifications with custom content and actions.
## Overview
The `Electron.Notification` API provides the ability to show native desktop notifications with custom titles, bodies, icons, and actions. Notifications work across Windows, macOS, and Linux with platform-specific behavior.
## Methods
#### 🧊 `Task<bool> IsSupportedAsync()`
Check if desktop notifications are supported on the current platform.
**Returns:**
Whether or not desktop notifications are supported on the current system.
#### 🧊 `void Show(NotificationOptions notificationOptions)`
Create OS desktop notifications with the specified options.
**Parameters:**
- `notificationOptions` - Notification configuration options
## Usage Examples
### Basic Notification
```csharp
// Simple notification
Electron.Notification.Show(new NotificationOptions
{
Title = "My Application",
Body = "This is a notification message",
Icon = "assets/notification-icon.png"
});
```
### Notification with Actions
```csharp
// Notification with reply action
Electron.Notification.Show(new NotificationOptions
{
Title = "New Message",
Body = "You have a new message from John",
Icon = "assets/message-icon.png",
Actions = new[]
{
new NotificationAction { Text = "Reply", Type = NotificationActionType.Button },
new NotificationAction { Text = "View", Type = NotificationActionType.Button }
},
OnClick = () => OpenMessageWindow(),
OnAction = (action) =>
{
if (action == "Reply")
{
ShowReplyDialog();
}
else if (action == "View")
{
OpenMessageWindow();
}
}
});
```
### Rich Notifications
```csharp
// Rich notification with all options
Electron.Notification.Show(new NotificationOptions
{
Title = "Download Complete",
Subtitle = "Your file has finished downloading",
Body = "document.pdf has been downloaded to your Downloads folder.",
Icon = "assets/download-icon.png",
ImageUrl = "file://" + Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "assets/preview.png"),
Sound = NotificationSound.Default,
Urgency = NotificationUrgency.Normal,
Category = "transfer.complete",
Tag = "download-123",
Actions = new[]
{
new NotificationAction { Text = "Open", Type = NotificationActionType.Button },
new NotificationAction { Text = "Show in Folder", Type = NotificationActionType.Button }
},
OnShow = () => Console.WriteLine("Notification shown"),
OnClick = () => OpenDownloadedFile(),
OnClose = () => Console.WriteLine("Notification closed"),
OnAction = (action) =>
{
if (action == "Open")
{
OpenDownloadedFile();
}
else if (action == "Show in Folder")
{
ShowInFolder();
}
}
});
```
### Platform-Specific Notifications
```csharp
// Windows toast notification
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
{
Electron.Notification.Show(new NotificationOptions
{
Title = "Background Task",
Body = "Your backup is complete",
Icon = "assets/app-icon.ico",
Tag = "backup-complete",
RequireInteraction = true
});
}
// macOS notification with sound
else if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
{
Electron.Notification.Show(new NotificationOptions
{
Title = "Alert",
Body = "Something needs your attention",
Sound = NotificationSound.Default,
Actions = new[]
{
new NotificationAction { Text = "View", Type = NotificationActionType.Button }
}
});
}
```
### Notification Management
```csharp
// Check notification support
var isSupported = await Electron.Notification.IsSupportedAsync();
Console.WriteLine($"Notifications supported: {isSupported}");
// Create notification with events
var notification = new NotificationOptions
{
Title = "Task Complete",
Body = "Your long-running task has finished",
OnShow = () => Console.WriteLine("Notification displayed"),
OnClick = () => OpenTaskResults(),
OnClose = () => Console.WriteLine("Notification dismissed")
};
Electron.Notification.Show(notification);
```
## Related APIs
- [Electron.App](App.md) - Application lifecycle events
- [Electron.Tray](Tray.md) - System tray integration with notifications
- [Electron.Screen](Screen.md) - Position notifications based on screen layout
## Additional Resources
- [Electron Notification Documentation](https://electronjs.org/docs/api/notification) - Official Electron notification API

62
docs/API/Overview.md Normal file
View File

@@ -0,0 +1,62 @@
# API Reference Overview
The ElectronNET.Core API provides comprehensive access to Electron's native desktop functionality through a .NET interface. This section documents all the available API classes and their methods, events, and usage patterns.
## API Classes
### Core Application Management
- **[Electron.App](App.md)** - Control your application's event lifecycle, manage app metadata, and handle system-level operations
- **[Electron.WindowManager](WindowManager.md)** - Create and manage browser windows, control window behavior and appearance
- **[Electron.Menu](Menu.md)** - Create application menus, context menus, and menu items with full keyboard shortcut support
### User Interface & Interaction
- **[Electron.Dialog](Dialog.md)** - Display native system dialogs for opening/saving files, showing messages and alerts
- **[Electron.Notification](Notification.md)** - Show native desktop notifications with custom content and actions
- **[Electron.Tray](Tray.md)** - Create system tray icons with context menus and tooltip support
- **[Electron.Dock](Dock.md)** - macOS dock integration for bounce effects and badge counts
### System Integration
- **[Electron.Shell](Shell.md)** - Desktop integration for opening files, URLs, and accessing system paths
- **[Electron.Clipboard](Clipboard.md)** - Read from and write to the system clipboard with multiple data formats
- **[Electron.Screen](Screen.md)** - Access display and screen information for responsive layouts
- **[Electron.NativeTheme](NativeTheme.md)** - Detect and respond to system theme changes (light/dark mode)
### Communication & Automation
- **[Electron.IpcMain](IpcMain.md)** - Inter-process communication between main process and renderer processes
- **[Electron.HostHook](HostHook.md)** - Custom host hook functionality for advanced integration scenarios
- **[Electron.GlobalShortcut](GlobalShortcut.md)** - Register global keyboard shortcuts that work even when app is not focused
- **[Electron.AutoUpdater](AutoUpdater.md)** - Handle application updates and installation processes
### System Monitoring
- **[Electron.PowerMonitor](PowerMonitor.md)** - Monitor system power events like sleep, wake, and battery status
## API Relationships
### Window and Dialog Integration
- Use `BrowserWindow` instances as parent windows for dialogs
- Dialogs automatically become modal when parent window is provided
- Window events coordinate with application lifecycle events
### IPC Communication
- `IpcMain` handles communication from renderer processes
- Use with `Electron.WindowManager` for window-specific messaging
- Coordinate with `Electron.App` events for application-wide communication
### System Integration
- `Shell` operations work with file paths from `Dialog` operations
- `Screen` information helps create properly sized windows
- `Notification` and `Tray` provide complementary user interaction methods
## 🚀 Next Steps
- **[Electron.App](App.md)** - Start with application lifecycle management
- **[Electron.WindowManager](WindowManager.md)** - Learn window creation and management
- **[Electron.Dialog](Dialog.md)** - Add file operations and user interactions
- **[Electron.Menu](Menu.md)** - Implement application menus and shortcuts
## 📚 Additional Resources
- **[Electron Documentation](https://electronjs.org/docs)** - Official Electron API reference
- **[Getting Started](../GettingStarted/ASP.Net.md)** - Development setup guides
- **[Migration Guide](../Core/Migration-Guide.md)** - Moving from previous versions

188
docs/API/PowerMonitor.md Normal file
View File

@@ -0,0 +1,188 @@
# Electron.PowerMonitor
Monitor system power events like sleep, wake, and battery status.
## Overview
The `Electron.PowerMonitor` API provides access to system power events and state changes. This includes monitoring when the system is going to sleep, waking up, or changing power sources.
## Events
#### ⚡ `OnAC`
Emitted when the system changes to AC power.
#### ⚡ `OnBattery`
Emitted when system changes to battery power.
#### ⚡ `OnLockScreen`
Emitted when the system is about to lock the screen.
#### ⚡ `OnResume`
Emitted when system is resuming.
#### ⚡ `OnShutdown`
Emitted when the system is about to reboot or shut down.
#### ⚡ `OnSuspend`
Emitted when the system is suspending.
#### ⚡ `OnUnLockScreen`
Emitted when the system is about to unlock the screen.
## Usage Examples
### Basic Power Event Monitoring
```csharp
// Monitor system sleep/wake
Electron.PowerMonitor.OnSuspend += () =>
{
Console.WriteLine("System going to sleep");
// Save application state
SaveApplicationState();
};
Electron.PowerMonitor.OnResume += () =>
{
Console.WriteLine("System waking up");
// Restore application state
RestoreApplicationState();
};
```
### Screen Lock/Unlock Monitoring
```csharp
// Handle screen lock events
Electron.PowerMonitor.OnLockScreen += () =>
{
Console.WriteLine("Screen locking");
// Pause real-time operations
PauseRealTimeOperations();
};
Electron.PowerMonitor.OnUnLockScreen += () =>
{
Console.WriteLine("Screen unlocking");
// Resume real-time operations
ResumeRealTimeOperations();
};
```
### Power Source Changes
```csharp
// Monitor power source changes
Electron.PowerMonitor.OnAC += () =>
{
Console.WriteLine("Switched to AC power");
// Adjust power-intensive operations
EnablePowerIntensiveFeatures();
};
Electron.PowerMonitor.OnBattery += () =>
{
Console.WriteLine("Switched to battery power");
// Reduce power consumption
EnablePowerSavingMode();
};
```
### System Shutdown Handling
```csharp
// Handle system shutdown
Electron.PowerMonitor.OnShutdown += () =>
{
Console.WriteLine("System shutting down");
// Save critical data and exit gracefully
SaveAndExit();
};
```
### Application State Management
```csharp
private bool isSuspended = false;
public void InitializePowerMonitoring()
{
// Track suspension state
Electron.PowerMonitor.OnSuspend += () =>
{
isSuspended = true;
OnSystemSleep();
};
Electron.PowerMonitor.OnResume += () =>
{
isSuspended = false;
OnSystemWake();
};
// Handle screen lock for security
Electron.PowerMonitor.OnLockScreen += () =>
{
OnScreenLocked();
};
}
private void OnSystemSleep()
{
// Pause network operations
PauseNetworkOperations();
// Save unsaved work
AutoSaveDocuments();
// Reduce resource usage
MinimizeResourceUsage();
}
private void OnSystemWake()
{
// Resume network operations
ResumeNetworkOperations();
// Check for updates
CheckForUpdates();
// Restore full functionality
RestoreFullFunctionality();
}
private void OnScreenLocked()
{
// Hide sensitive information
HideSensitiveData();
// Pause real-time features
PauseRealTimeFeatures();
}
```
### Battery Status Monitoring
```csharp
// Monitor battery status changes
Electron.PowerMonitor.OnAC += () =>
{
Console.WriteLine("Plugged in - full performance mode");
EnableFullPerformanceMode();
};
Electron.PowerMonitor.OnBattery += () =>
{
Console.WriteLine("On battery - power saving mode");
EnablePowerSavingMode();
};
```
## Related APIs
- [Electron.App](App.md) - Application lifecycle events
- [Electron.Notification](Notification.md) - Notify users about power events
## Additional Resources
- [Electron PowerMonitor Documentation](https://electronjs.org/docs/api/power-monitor) - Official Electron power monitor API

174
docs/API/Screen.md Normal file
View File

@@ -0,0 +1,174 @@
# Electron.Screen
Access display and screen information for responsive layouts.
## Overview
The `Electron.Screen` API provides access to screen and display information, including screen size, display metrics, cursor position, and multi-monitor configurations. This is essential for creating responsive applications that adapt to different screen configurations.
## Methods
#### 🧊 `Task<Display[]> GetAllDisplaysAsync()`
Gets information about all available displays.
**Returns:**
An array of displays that are currently available.
#### 🧊 `Task<Point> GetCursorScreenPointAsync()`
Gets the current position of the mouse cursor on screen.
**Returns:**
The current absolute position of the mouse pointer.
#### 🧊 `Task<Display> GetDisplayMatchingAsync(Rectangle rectangle)`
Gets the display that most closely intersects the provided bounds.
**Parameters:**
- `rectangle` - The rectangle to find the matching display for
**Returns:**
The display that most closely intersects the provided bounds.
#### 🧊 `Task<Display> GetDisplayNearestPointAsync(Point point)`
Gets the display that is closest to the specified point.
**Parameters:**
- `point` - The point to find the nearest display for
**Returns:**
The display nearest the specified point.
#### 🧊 `Task<int> GetMenuBarHeightAsync()`
macOS: The height of the menu bar in pixels.
**Returns:**
The height of the menu bar in pixels.
#### 🧊 `Task<Display> GetPrimaryDisplayAsync()`
Gets information about the primary display (main screen).
**Returns:**
The primary display.
## Events
#### ⚡ `OnDisplayAdded`
Emitted when a new Display has been added.
#### ⚡ `OnDisplayMetricsChanged`
Emitted when one or more metrics change in a display. The changedMetrics is an array of strings that describe the changes. Possible changes are bounds, workArea, scaleFactor and rotation.
#### ⚡ `OnDisplayRemoved`
Emitted when oldDisplay has been removed.
## Usage Examples
### Display Information
```csharp
// Get primary display
var primaryDisplay = await Electron.Screen.GetPrimaryDisplayAsync();
Console.WriteLine($"Primary display: {primaryDisplay.Size.Width}x{primaryDisplay.Size.Height}");
// Get all displays
var displays = await Electron.Screen.GetAllDisplaysAsync();
Console.WriteLine($"Available displays: {displays.Length}");
// Get display near cursor
var cursorPoint = await Electron.Screen.GetCursorScreenPointAsync();
var nearestDisplay = await Electron.Screen.GetDisplayNearestPointAsync(cursorPoint);
Console.WriteLine($"Nearest display scale factor: {nearestDisplay.ScaleFactor}");
```
### Multi-Monitor Setup
```csharp
// Get all displays for multi-monitor setup
var displays = await Electron.Screen.GetAllDisplaysAsync();
foreach (var display in displays)
{
Console.WriteLine($"Display {display.Id}:");
Console.WriteLine($" Size: {display.Size.Width}x{display.Size.Height}");
Console.WriteLine($" Position: {display.Bounds.X},{display.Bounds.Y}");
Console.WriteLine($" Scale Factor: {display.ScaleFactor}");
Console.WriteLine($" Work Area: {display.WorkArea.Width}x{display.WorkArea.Height}");
}
```
### Responsive Window Placement
```csharp
// Create window on appropriate display
var displays = await Electron.Screen.GetAllDisplaysAsync();
var targetDisplay = displays.FirstOrDefault(d => d.Bounds.X > 0) ?? displays.First();
var windowOptions = new BrowserWindowOptions
{
Width = Math.Min(1200, targetDisplay.WorkArea.Width),
Height = Math.Min(800, targetDisplay.WorkArea.Height),
X = targetDisplay.WorkArea.X + (targetDisplay.WorkArea.Width - 1200) / 2,
Y = targetDisplay.WorkArea.Y + (targetDisplay.WorkArea.Height - 800) / 2
};
var window = await Electron.WindowManager.CreateWindowAsync(windowOptions);
```
### Display Change Monitoring
```csharp
// Monitor display changes
Electron.Screen.OnDisplayAdded += (display) =>
{
Console.WriteLine($"Display added: {display.Id}");
UpdateWindowPositions();
};
Electron.Screen.OnDisplayRemoved += (display) =>
{
Console.WriteLine($"Display removed: {display.Id}");
UpdateWindowPositions();
};
Electron.Screen.OnDisplayMetricsChanged += (display, metrics) =>
{
Console.WriteLine($"Display {display.Id} metrics changed: {string.Join(", ", metrics)}");
UpdateWindowPositions();
};
void UpdateWindowPositions()
{
// Recalculate window positions based on current displays
}
```
### macOS Menu Bar Height
```csharp
// Account for menu bar height on macOS
if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
{
var menuBarHeight = await Electron.Screen.GetMenuBarHeightAsync();
var windowOptions = new BrowserWindowOptions
{
Y = menuBarHeight, // Position below menu bar
TitleBarStyle = TitleBarStyle.Hidden // Hide title bar for custom look
};
}
```
## Related APIs
- [Electron.WindowManager](WindowManager.md) - Position windows based on screen information
- [Electron.App](App.md) - Handle display-related application events
## Additional Resources
- [Electron Screen Documentation](https://electronjs.org/docs/api/screen) - Official Electron screen API

175
docs/API/Shell.md Normal file
View File

@@ -0,0 +1,175 @@
# Electron.Shell
Desktop integration for opening files, URLs, and accessing system paths.
## Overview
The `Electron.Shell` API provides system integration functionality for opening files and URLs with their default applications, managing trash/recycle bin, and creating/reading shortcut links.
## Methods
#### 🧊 `void Beep()`
Play the beep sound.
#### 🧊 `Task<string> OpenExternalAsync(string url)`
Open the given external protocol URL in the desktop's default manner (e.g., mailto: URLs in the user's default mail agent).
**Parameters:**
- `url` - Max 2081 characters on windows
**Returns:**
The error message corresponding to the failure if a failure occurred, otherwise empty string.
#### 🧊 `Task<string> OpenExternalAsync(string url, OpenExternalOptions options)`
Open the given external protocol URL with additional options.
**Parameters:**
- `url` - Max 2081 characters on windows
- `options` - Controls the behavior of OpenExternal
**Returns:**
The error message corresponding to the failure if a failure occurred, otherwise empty string.
#### 🧊 `Task<string> OpenPathAsync(string path)`
Open the given file in the desktop's default manner.
**Parameters:**
- `path` - The path to the directory or file
**Returns:**
The error message corresponding to the failure if a failure occurred, otherwise empty string.
#### 🧊 `Task<ShortcutDetails> ReadShortcutLinkAsync(string shortcutPath)`
Resolves the shortcut link at shortcutPath. An exception will be thrown when any error happens.
**Parameters:**
- `shortcutPath` - The path to the shortcut
**Returns:**
ShortcutDetails of the shortcut.
#### 🧊 `Task ShowItemInFolderAsync(string fullPath)`
Show the given file in a file manager. If possible, select the file.
**Parameters:**
- `fullPath` - The full path to the directory or file
#### 🧊 `Task<bool> TrashItemAsync(string fullPath)`
Move the given file to trash and returns a bool status for the operation.
**Parameters:**
- `fullPath` - The full path to the directory or file
**Returns:**
Whether the item was successfully moved to the trash.
#### 🧊 `Task<bool> WriteShortcutLinkAsync(string shortcutPath, ShortcutLinkOperation operation, ShortcutDetails options)`
Creates or updates a shortcut link at shortcutPath.
**Parameters:**
- `shortcutPath` - The path to the shortcut
- `operation` - Default is ShortcutLinkOperation.Create
- `options` - Structure of a shortcut
**Returns:**
Whether the shortcut was created successfully.
## Usage Examples
### File Operations
```csharp
// Open file with default application
var error = await Electron.Shell.OpenPathAsync(filePath);
if (string.IsNullOrEmpty(error))
{
Console.WriteLine("File opened successfully");
}
else
{
Console.WriteLine($"Failed to open file: {error}");
}
// Show file in file manager
await Electron.Shell.ShowItemInFolderAsync(filePath);
// Move file to trash
var trashed = await Electron.Shell.TrashItemAsync(filePath);
Console.WriteLine($"File trashed: {trashed}");
```
### URL Operations
```csharp
// Open URL in default browser
var error = await Electron.Shell.OpenExternalAsync("https://electron.net");
if (!string.IsNullOrEmpty(error))
{
Console.WriteLine($"Failed to open URL: {error}");
}
// Open email client
await Electron.Shell.OpenExternalAsync("mailto:user@example.com");
// Open with options
var error = await Electron.Shell.OpenExternalAsync("https://example.com", new OpenExternalOptions
{
Activate = true
});
```
### System Integration
```csharp
// Play system beep
Electron.Shell.Beep();
// Create desktop shortcut
var success = await Electron.Shell.WriteShortcutLinkAsync(
@"C:\Users\Public\Desktop\MyApp.lnk",
ShortcutLinkOperation.Create,
new ShortcutDetails
{
Target = "C:\\Program Files\\MyApp\\MyApp.exe",
Description = "My Application",
WorkingDirectory = "C:\\Program Files\\MyApp"
}
);
// Read shortcut information
var details = await Electron.Shell.ReadShortcutLinkAsync(@"C:\Users\Public\Desktop\MyApp.lnk");
Console.WriteLine($"Target: {details.Target}");
```
### Integration with Dialog API
```csharp
// Use with file dialog results
var files = await Electron.Dialog.ShowOpenDialogAsync(window, options);
if (files.Length > 0)
{
var selectedFile = files[0];
// Open the selected file
await Electron.Shell.OpenPathAsync(selectedFile);
// Show in file manager
await Electron.Shell.ShowItemInFolderAsync(selectedFile);
}
```
## Related APIs
- [Electron.Dialog](Dialog.md) - Select files to open with Shell
- [Electron.App](App.md) - Application lifecycle events
- [Electron.Clipboard](Clipboard.md) - Copy file paths for Shell operations
## Additional Resources
- [Electron Shell Documentation](https://electronjs.org/docs/api/shell) - Official Electron shell API

232
docs/API/Tray.md Normal file
View File

@@ -0,0 +1,232 @@
# Electron.Tray
Add icons and context menus to the system's notification area.
## Overview
The `Electron.Tray` API provides the ability to add icons and context menus to the system's notification area (system tray). This allows applications to provide quick access to common functions and maintain a presence in the system even when windows are closed.
## Properties
#### 📋 `IReadOnlyCollection<MenuItem> MenuItems`
Gets a read-only collection of all current tray menu items.
## Methods
#### 🧊 `void Destroy()`
Destroys the tray icon immediately.
#### 🧊 `void DisplayBalloon(DisplayBalloonOptions options)`
Windows: Displays a tray balloon notification.
**Parameters:**
- `options` - Balloon notification options
#### 🧊 `Task<bool> IsDestroyedAsync()`
Check if the tray icon has been destroyed.
**Returns:**
Whether the tray icon is destroyed.
#### 🧊 `void SetImage(string image)`
Sets the image associated with this tray icon.
**Parameters:**
- `image` - New image for the tray icon
#### 🧊 `void SetPressedImage(string image)`
Sets the image associated with this tray icon when pressed on macOS.
**Parameters:**
- `image` - Image for pressed state
#### 🧊 `void SetTitle(string title)`
macOS: Sets the title displayed aside of the tray icon in the status bar.
**Parameters:**
- `title` - Title text
#### 🧊 `void SetToolTip(string toolTip)`
Sets the hover text for this tray icon.
**Parameters:**
- `toolTip` - Tooltip text
#### 🧊 `void Show(string image)`
Shows the tray icon without a context menu.
**Parameters:**
- `image` - The image to use for the tray icon
#### 🧊 `void Show(string image, MenuItem menuItem)`
Shows the tray icon with a single menu item.
**Parameters:**
- `image` - The image to use for the tray icon
- `menuItem` - Single menu item for the tray context menu
#### 🧊 `void Show(string image, MenuItem[] menuItems)`
Shows the tray icon with multiple menu items.
**Parameters:**
- `image` - The image to use for the tray icon
- `menuItems` - Array of menu items for the tray context menu
## Events
#### ⚡ `OnBalloonClick`
Windows: Emitted when the tray balloon is clicked.
#### ⚡ `OnBalloonClosed`
Windows: Emitted when the tray balloon is closed because of timeout or user manually closes it.
#### ⚡ `OnBalloonShow`
Windows: Emitted when the tray balloon shows.
#### ⚡ `OnClick`
Emitted when the tray icon is clicked.
#### ⚡ `OnDoubleClick`
macOS, Windows: Emitted when the tray icon is double clicked.
#### ⚡ `OnRightClick`
macOS, Windows: Emitted when the tray icon is right clicked.
## Usage Examples
### Basic Tray Icon
```csharp
// Simple tray icon
await Electron.Tray.Show("assets/tray-icon.png");
// Tray icon with single menu item
await Electron.Tray.Show("assets/tray-icon.png", new MenuItem
{
Label = "Show Window",
Click = () => ShowMainWindow()
});
```
### Tray with Context Menu
```csharp
// Tray with multiple menu items
var trayMenuItems = new[]
{
new MenuItem { Label = "Show Window", Click = () => ShowMainWindow() },
new MenuItem { Label = "Settings", Click = () => OpenSettings() },
new MenuItem { Type = MenuType.Separator },
new MenuItem { Label = "Exit", Click = () => Electron.App.Quit() }
};
await Electron.Tray.Show("assets/tray-icon.png", trayMenuItems);
```
### Dynamic Tray Updates
```csharp
// Update tray tooltip based on status
await Electron.Tray.SetToolTip("MyApp - Connected");
// Change tray icon based on state
if (isConnected)
{
await Electron.Tray.SetImage("assets/connected.png");
}
else
{
await Electron.Tray.SetImage("assets/disconnected.png");
}
```
### Tray Event Handling
```csharp
// Handle tray clicks
Electron.Tray.OnClick += (clickArgs, bounds) =>
{
if (clickArgs.AltKey || clickArgs.ShiftKey)
{
// Alt+Click or Shift+Click - show context menu
Electron.Menu.ContextMenuPopup(Electron.WindowManager.BrowserWindows.First());
}
else
{
// Regular click - toggle main window
ToggleMainWindow();
}
};
Electron.Tray.OnRightClick += (clickArgs, bounds) =>
{
// Show context menu on right click
Electron.Menu.ContextMenuPopup(Electron.WindowManager.BrowserWindows.First());
};
```
### Windows Balloon Notifications
```csharp
// Show Windows balloon notification
await Electron.Tray.DisplayBalloon(new DisplayBalloonOptions
{
Title = "Background Task Complete",
Content = "Your file has been processed successfully.",
Icon = "assets/notification-icon.ico"
});
// Handle balloon events
Electron.Tray.OnBalloonClick += () =>
{
ShowMainWindow();
Electron.WindowManager.BrowserWindows.First().Focus();
};
```
### macOS Tray Features
```csharp
// macOS specific tray features
if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
{
await Electron.Tray.SetTitle("MyApp");
// Use template image for dark mode support
await Electron.Tray.SetImage("assets/tray-template.png");
await Electron.Tray.SetPressedImage("assets/tray-pressed-template.png");
}
```
### Application Integration
```csharp
// Integrate with application lifecycle
Electron.App.WindowAllClosed += () =>
{
// Keep app running in tray when windows are closed
if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
{
Electron.App.Hide();
}
};
// Handle tray double-click
Electron.Tray.OnDoubleClick += (clickArgs, bounds) =>
{
ShowMainWindow();
Electron.WindowManager.BrowserWindows.First().Focus();
};
```
## Related APIs
- [Electron.Menu](Menu.md) - Context menus for tray icons
- [Electron.Notification](Notification.md) - Desktop notifications
- [Electron.App](App.md) - Application lifecycle events
- [Electron.WindowManager](WindowManager.md) - Windows to show/hide from tray
## Additional Resources
- [Electron Tray Documentation](https://electronjs.org/docs/api/tray) - Official Electron tray API

292
docs/API/WebContents.md Normal file
View File

@@ -0,0 +1,292 @@
# Electron.WebContents
Render and control web pages.
## Overview
The `Electron.WebContents` API provides control over web page content within Electron windows. It handles page loading, navigation, JavaScript execution, and web page lifecycle events.
## Properties
#### 📋 `int Id`
Gets the unique identifier for this web contents.
#### 📋 `Session Session`
Manage browser sessions, cookies, cache, proxy settings, etc.
## Methods
#### 🧊 `void ExecuteJavaScriptAsync(string code, bool userGesture = false)`
Evaluates script code in page.
In the browser window some HTML APIs like `requestFullScreen` can only be invoked by a gesture from the user. Setting `userGesture` to `true` will remove this limitation.
Code execution will be suspended until web page stop loading.
**Parameters:**
- `code` - The code to execute
- `userGesture` - if set to `true` simulate a user gesture
**Returns:**
The result of the executed code.
#### 🧊 `Task<PrinterInfo[]> GetPrintersAsync()`
Get system printers.
**Returns:**
Array of available printers.
#### 🧊 `Task<string> GetUrl()`
Get the URL of the loaded page.
It's useful if a web-server redirects you and you need to know where it redirects. For instance, It's useful in case of Implicit Authorization.
**Returns:**
URL of the loaded page.
#### 🧊 `void InsertCSS(bool isBrowserWindow, string path)`
Inserts CSS into the web page.
See: https://www.electronjs.org/docs/api/web-contents#contentsinsertcsscss-options
Works for both BrowserWindows and BrowserViews.
**Parameters:**
- `isBrowserWindow` - Whether the webContents belong to a BrowserWindow or not (the other option is a BrowserView)
- `path` - Absolute path to the CSS file location
#### 🧊 `Task LoadURLAsync(string url)`
Loads the url in the window. The url must contain the protocol prefix.
The async method will resolve when the page has finished loading, and rejects if the page fails to load.
A noop rejection handler is already attached, which avoids unhandled rejection errors.
Loads the `url` in the window. The `url` must contain the protocol prefix, e.g. the `http://` or `file://`. If the load should bypass http cache then use the `pragma` header to achieve it.
**Parameters:**
- `url` - URL to load
#### 🧊 `Task LoadURLAsync(string url, LoadURLOptions options)`
Loads the url with additional options.
The async method will resolve when the page has finished loading, and rejects if the page fails to load.
A noop rejection handler is already attached, which avoids unhandled rejection errors.
Loads the `url` in the window. The `url` must contain the protocol prefix, e.g. the `http://` or `file://`. If the load should bypass http cache then use the `pragma` header to achieve it.
**Parameters:**
- `url` - URL to load
- `options` - Loading options
#### 🧊 `void OpenDevTools()`
Opens the devtools.
#### 🧊 `void OpenDevTools(OpenDevToolsOptions openDevToolsOptions)`
Opens the devtools with options.
**Parameters:**
- `openDevToolsOptions` - Developer tools options
#### 🧊 `Task<bool> PrintAsync(PrintOptions options = null)`
Prints window's web page.
**Parameters:**
- `options` - Print options
**Returns:**
Whether the print operation succeeded.
#### 🧊 `Task<bool> PrintToPDFAsync(string path, PrintToPDFOptions options = null)`
Prints window's web page as PDF with Chromium's preview printing custom settings.The landscape will be ignored if @page CSS at-rule is used in the web page. By default, an empty options will be regarded as: Use page-break-before: always; CSS style to force to print to a new page.
**Parameters:**
- `path` - Output file path
- `options` - PDF generation options
**Returns:**
Whether the PDF generation succeeded.
## Events
#### ⚡ `InputEvent`
Emitted when an input event is sent to the WebContents.
#### ⚡ `OnCrashed`
Emitted when the renderer process crashes or is killed.
#### ⚡ `OnDidFailLoad`
Emitted when the load failed.
#### ⚡ `OnDidFinishLoad`
Emitted when the navigation is done, i.e. the spinner of the tab has stopped spinning, and the onload event was dispatched.
#### ⚡ `OnDidNavigate`
Emitted when a main frame navigation is done.
#### ⚡ `OnDidRedirectNavigation`
Emitted after a server side redirect occurs during navigation.
#### ⚡ `OnDidStartNavigation`
Emitted when any frame (including main) starts navigating.
#### ⚡ `OnDomReady`
Emitted when the document in the top-level frame is loaded.
#### ⚡ `OnWillRedirect`
Emitted when a server side redirect occurs during navigation.
## Usage Examples
### Page Loading
```csharp
// Load URL with options
await webContents.LoadURLAsync("https://example.com", new LoadURLOptions
{
UserAgent = "MyApp/1.0",
ExtraHeaders = "Authorization: Bearer token123"
});
// Load local file
await webContents.LoadURLAsync("file://" + Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "app/index.html"));
// Get current URL
var currentUrl = await webContents.GetUrl();
Console.WriteLine($"Current URL: {currentUrl}");
```
### JavaScript Execution
```csharp
// Execute simple JavaScript
var result = await webContents.ExecuteJavaScriptAsync("document.title");
Console.WriteLine($"Page title: {result}");
// Execute with user gesture simulation
await webContents.ExecuteJavaScriptAsync("document.requestFullscreen()", true);
// Execute complex code
var userAgent = await webContents.ExecuteJavaScriptAsync("navigator.userAgent");
Console.WriteLine($"User agent: {userAgent}");
```
### Developer Tools
```csharp
// Open dev tools
webContents.OpenDevTools();
// Open with specific options
webContents.OpenDevTools(new OpenDevToolsOptions
{
Mode = DevToolsMode.Detached,
Activate = true
});
```
### CSS Injection
```csharp
// Inject CSS file
webContents.InsertCSS(true, "styles/custom-theme.css");
// Inject CSS for BrowserView
webContents.InsertCSS(false, "styles/browser-view.css");
```
### Printing Operations
```csharp
// Print web page
var printSuccess = await webContents.PrintAsync(new PrintOptions
{
Silent = false,
PrintBackground = true,
DeviceName = "My Printer"
});
if (printSuccess)
{
Console.WriteLine("Print job sent successfully");
}
```
### PDF Generation
```csharp
// Generate PDF
var pdfSuccess = await webContents.PrintToPDFAsync("document.pdf", new PrintToPDFOptions
{
MarginsType = PrintToPDFMarginsType.None,
PageSize = PrintToPDFPageSize.A4,
PrintBackground = true,
Landscape = false
});
if (pdfSuccess)
{
Console.WriteLine("PDF generated successfully");
}
```
### Navigation Monitoring
```csharp
// Monitor navigation events
webContents.OnDidStartNavigation += (url) =>
{
Console.WriteLine($"Starting navigation to: {url}");
};
webContents.OnDidNavigate += (navInfo) =>
{
Console.WriteLine($"Navigated to: {navInfo.Url}");
};
webContents.OnDidFinishLoad += () =>
{
Console.WriteLine("Page finished loading");
};
webContents.OnDidFailLoad += (failInfo) =>
{
Console.WriteLine($"Page failed to load: {failInfo.ErrorCode} - {failInfo.ErrorDescription}");
};
```
### Content Interaction
```csharp
// Wait for DOM ready
webContents.OnDomReady += () =>
{
Console.WriteLine("DOM is ready");
// Safe to execute DOM-related JavaScript now
};
// Handle page crashes
webContents.OnCrashed += (killed) =>
{
Console.WriteLine($"Renderer crashed, killed: {killed}");
// Optionally reload the page
};
```
## Related APIs
- [Electron.WindowManager](WindowManager.md) - Windows containing web contents
- [Electron.Session](Session.md) - Session management for web contents
- [Electron.IpcMain](IpcMain.md) - Communication with web contents
## Additional Resources
- [Electron WebContents Documentation](https://electronjs.org/docs/api/web-contents) - Official Electron web contents API
- [Web Content Management](../Core/What's-New.md) - Understanding web content handling
- [Security Considerations](../Using/Configuration.md) - Secure web content integration

208
docs/API/WindowManager.md Normal file
View File

@@ -0,0 +1,208 @@
# Electron.WindowManager
Create and manage browser windows, control window behavior and appearance.
## Overview
The `Electron.WindowManager` API provides comprehensive control over browser windows in your Electron application. It handles window creation, management, and coordination with the application lifecycle.
## Properties
#### 📋 `IReadOnlyCollection<BrowserView> BrowserViews`
Gets a read-only collection of all currently open browser views.
#### 📋 `IReadOnlyCollection<BrowserWindow> BrowserWindows`
Gets a read-only collection of all currently open browser windows.
#### 📋 `bool IsQuitOnWindowAllClosed`
Controls whether the application quits when all windows are closed. Default is true.
## Methods
#### 🧊 `Task<BrowserView> CreateBrowserViewAsync()`
Creates a new browser view with default options.
**Returns:**
The created BrowserView instance.
#### 🧊 `Task<BrowserView> CreateBrowserViewAsync(BrowserViewConstructorOptions options)`
Creates a new browser view with custom options.
**Parameters:**
- `options` - Browser view configuration options
**Returns:**
The created BrowserView instance.
#### 🧊 `Task<BrowserWindow> CreateWindowAsync(string loadUrl = "http://localhost")`
Creates a new browser window with default options.
**Parameters:**
- `loadUrl` - URL to load in the window. Defaults to "http://localhost"
**Returns:**
The created BrowserWindow instance.
#### 🧊 `Task<BrowserWindow> CreateWindowAsync(BrowserWindowOptions options, string loadUrl = "http://localhost")`
Creates a new browser window with custom options.
**Parameters:**
- `options` - Window configuration options
- `loadUrl` - URL to load in the window. Defaults to "http://localhost"
**Returns:**
The created BrowserWindow instance.
## Usage Examples
### Basic Window Creation
```csharp
// Create window with default options
var mainWindow = await Electron.WindowManager.CreateWindowAsync();
// Create window with custom options
var settingsWindow = await Electron.WindowManager.CreateWindowAsync(new BrowserWindowOptions
{
Width = 800,
Height = 600,
Show = false,
Title = "Settings",
WebPreferences = new WebPreferences
{
NodeIntegration = false,
ContextIsolation = true
}
}, "https://localhost:5001/settings");
```
### Window Management
```csharp
// Get all windows
var windows = Electron.WindowManager.BrowserWindows;
Console.WriteLine($"Open windows: {windows.Count}");
// Configure quit behavior
Electron.WindowManager.IsQuitOnWindowAllClosed = false; // Keep app running when windows close
// Handle window lifecycle
Electron.App.WindowAllClosed += () =>
{
Console.WriteLine("All windows closed");
if (Electron.WindowManager.IsQuitOnWindowAllClosed)
{
Electron.App.Quit();
}
};
```
### Browser View Integration
```csharp
// Create browser view
var browserView = await Electron.WindowManager.CreateBrowserViewAsync(new BrowserViewConstructorOptions
{
WebPreferences = new WebPreferences
{
NodeIntegration = false,
ContextIsolation = true
}
});
// Add to window
await mainWindow.SetBrowserViewAsync(browserView);
await browserView.WebContents.LoadURLAsync("https://example.com");
// Set view bounds
await mainWindow.SetBoundsAsync(browserView, new Rectangle
{
X = 0,
Y = 100,
Width = 800,
Height = 400
});
```
### Window Options Configuration
```csharp
// Comprehensive window options
var options = new BrowserWindowOptions
{
Width = 1200,
Height = 800,
MinWidth = 600,
MinHeight = 400,
MaxWidth = 1920,
MaxHeight = 1080,
X = 100,
Y = 100,
Center = true,
Frame = true,
Title = "My Application",
Icon = "assets/app-icon.png",
Show = false,
AlwaysOnTop = false,
SkipTaskbar = false,
Kiosk = false,
TitleBarStyle = TitleBarStyle.Default,
BackgroundColor = "#FFFFFF",
DarkTheme = false,
Transparent = false,
WebPreferences = new WebPreferences
{
NodeIntegration = false,
ContextIsolation = true,
EnableWebSQL = false,
Partition = "persist:electron",
ZoomFactor = 1.0f,
DevTools = true
}
};
```
### Multi-Window Applications
```csharp
// Create main window
var mainWindow = await Electron.WindowManager.CreateWindowAsync(new BrowserWindowOptions
{
Width = 1200,
Height = 800,
Show = false
});
// Create secondary window
var secondaryWindow = await Electron.WindowManager.CreateWindowAsync(new BrowserWindowOptions
{
Width = 600,
Height = 400,
Parent = mainWindow,
Modal = true,
Show = false
});
// Load different content
await mainWindow.WebContents.LoadURLAsync("https://localhost:5001");
await secondaryWindow.WebContents.LoadURLAsync("https://localhost:5001/settings");
// Show windows when ready
mainWindow.OnReadyToShow += () => mainWindow.Show();
secondaryWindow.OnReadyToShow += () => secondaryWindow.Show();
```
## Related APIs
- [Electron.App](App.md) - Application lifecycle and window events
- [Electron.Dialog](Dialog.md) - Parent windows for modal dialogs
- [Electron.Menu](Menu.md) - Window-specific menus
- [Electron.WebContents](WebContents.md) - Window content management
## Additional Resources
- [Electron Window Management Documentation](https://electronjs.org/docs/api/browser-window) - Official Electron window API

51
docs/About.md Normal file
View File

@@ -0,0 +1,51 @@
# About this Project
Electron.NET has been developed by a small number of people in the hope that it may be useful for others.
Support for this project in all forms is very welcome, no matter whether in form of code contributions or donations.
## 💬 Community
[![Gitter](https://badges.gitter.im/ElectronNET/community.svg)](https://gitter.im/ElectronNET/community?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge)
Besides the chat on Gitter and the issues [discussed here](https://github.com/ElectronNET/Electron.NET/issues) you can also use [StackOverflow](https://stackoverflow.com/questions/tagged/electron.net) with the tag `electron.net`.
## 🙋‍♀️🙋‍♂ Contributing
Feel free to submit a pull request if you find any bugs (to see a list of active issues, visit the [Issues section](https://github.com/ElectronNET/Electron.NET/issues).
Please make sure all commits are properly documented.
## 🙏 Donate
We do this open source work in our free time. If you'd like us to invest more time on it, please [donate](https://donorbox.org/electron-net). Donation can be used to increase some issue priority. Thank you!
[![donate](https://img.shields.io/badge/Donate-Donorbox-green.svg)](https://donorbox.org/electron-net)
Alternatively, consider using a GitHub sponsorship for the core maintainers:
- [Gregor Biswanger](https://github.com/sponsors/GregorBiswanger)
- [Florian Rappl](https://github.com/sponsors/FlorianRappl)
Any support appreciated! 🍻
## 👨‍💻 Authors
* **[Gregor Biswanger](https://github.com/GregorBiswanger)** - (Microsoft MVP, Intel Black Belt and Intel Software Innovator) is a freelance lecturer, consultant, trainer, author and speaker. He is a consultant for large and medium-sized companies, organizations and agencies for software architecture, web- and cross-platform development. You can find Gregor often on the road attending or speaking at international conferences. - [Cross-Platform-Blog](http://www.cross-platform-blog.com) - Twitter [@BFreakout](https://www.twitter.com/BFreakout)
&nbsp;
* **[Dr. Florian Rappl](https://github.com/FlorianRappl)** - Software Developer - from Munich, Germany. Microsoft MVP & Web Geek. - [The Art of Micro Frontends](https://microfrontends.art) - [Homepage](https://florian-rappl.de) - Twitter [@florianrappl](https://twitter.com/florianrappl)
&nbsp;
* [**softworkz**](https://github.com/softworkz) - full range developer - likes to start where others gave up - MS MVP alumni and Munich citizen as well. Has not been involved in the evolution of Electron.NET but rather dropped off the update and overhaul for ElectronNET.Core in a kind-of drive-by action.
&nbsp;
* **[Robert Muehsig](https://github.com/robertmuehsig)** - Software Developer - from Dresden, Germany, now living & working in Switzerland. Microsoft MVP & Web Geek. - [codeinside Blog](https://blog.codeinside.eu) - Twitter [@robert0muehsig](https://twitter.com/robert0muehsig)
See also the list of [contributors](https://github.com/ElectronNET/Electron.NET/graphs/contributors) who participated in this project.
## 🎉 License
MIT-licensed. See [LICENSE](https://github.com/ElectronNET/Electron.NET?tab=MIT-1-ov-file#readme) for details.

View File

@@ -0,0 +1,90 @@
# Advanced Migration Topics
This guide covers advanced scenarios and edge cases that may require additional configuration when migrating to ElectronNET.Core.
## Custom ASP.NET Port Configuration
### Port Configuration Changes
**Previous Approach:**
Specifying the WebPort in `electron.manifest.json` is no longer supported because the ASP.NET-first launch mode makes this timing-dependent.
**New Approach:**
Configure custom ASP.NET ports through MSBuild metadata:
```xml
<ItemGroup>
<AssemblyMetadata Include="AspNetHttpPort" Value="4000" />
</ItemGroup>
```
## Custom ElectronHostHook Configuration
> [!NOTE]
> These changes are only required in case you are using a custom ElectronHostHook implementation!
> If you have an ElectronHostHook folder in your project but you did not customize that code and aren't using its demo features (Excel and ZIP), you can also just remove that folder from your project.
### TypeScript and Node.js Updates
**Update package.json:**
This shows the relevant changes only: All shown versions are the new required minimum versions.
```json
{
"devDependencies": {
"@types/node": "^22.18",
"typescript": "^5.9.3"
},
"dependencies": {
"socket.io": "^4.8.1",
}
}
```
**Update Project File:**
The below modifications will allow you to use the latest TypeScript compiler in your ASP.Net project.
```xml
<PackageReference Include="Microsoft.TypeScript.MSBuild" Version="5.9.3" />
<PropertyGroup>
<TypeScriptModuleKind>commonjs</TypeScriptModuleKind>
<TypeScriptUseNodeJS>true</TypeScriptUseNodeJS>
<TypeScriptTSConfig>ElectronHostHook/tsconfig.json</TypeScriptTSConfig>
</PropertyGroup>
<ItemGroup>
<Compile Remove="publish\**" />
<Content Remove="publish\**" />
<EmbeddedResource Remove="publish\**" />
<None Remove="publish\**" />
<TypeScriptCompile Remove="**\node_modules\**" />
</ItemGroup>
```
### Integration Benefits
- **Modern TypeScript** - Latest language features and better type checking
- **Updated Node.js Types** - Compatibility with Node.js 22.x APIs
- **ESLint Integration** - Better code quality and consistency
- **MSBuild Compilation** - Integrated with Visual Studio build process
## Troubleshooting Advanced Scenarios
### Multi-Project Solutions
When using ElectronNET.Core in multi-project solutions:
1. **Install ElectronNET.Core.Api** in class library projects
2. **Install ElectronNET.Core and ElectronNET.Core.AspNet** only in the startup project
3. **Share configuration** through project references or shared files
## Next Steps
- **[Migration Guide](Migration-Guide.md)** - Complete migration process
- **[What's New?](What's-New.md)** - Overview of all ElectronNET.Core features
- **[Getting Started](../GettingStarted/ASP.Net.md)** - Development workflows

View File

@@ -0,0 +1,170 @@
# Migration Guide
Migrating from previous versions of Electron.NET to ElectronNET.Core is straightforward but requires several important changes. This guide walks you through the process step by step.
## 📋 Prerequisites
Before starting the migration:
- **Backup your project** - Ensure you have a working backup
- **Update development tools** - Install Node.js 22.x and .NET 8.0+
- **Review current setup** - Note your current Electron and ASP.NET versions
## 🚀 Migration Steps
### Step 1: Update NuGet Packages
**Uninstall old packages:**
```powershell
dotnet remove package ElectronNET.API
```
**Install new packages:**
```powershell
dotnet add package ElectronNET.Core
dotnet add package ElectronNET.Core.AspNet # For ASP.NET projects
```
> **Note**: The API package is automatically included as a dependency of `ElectronNET.Core`. See [Package Description](../RelInfo/Package-Description.md) for details about the package structure.
### Step 2: Configure Project Settings
**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.
**Migrate Existing Configuration:**
If you have an existing `electron.manifest.json` file:
1. **Open the generated `electron-builder.json`** file in your project
2. **Locate the 'build' section** in your old `electron.manifest.json`
3. **Copy the contents** of the build section (not the "build" key itself) into the new `electron-builder.json`
4. **Use Visual Studio Project Designer** to configure Electron settings through the UI
5. **Delete the old `electron.manifest.json`** file
**Alternative: Manual Configuration**
You can also manually edit `electron-builder.json`:
```json
{
"linux": {
"target": [
"tar.xz"
]
},
"win": {
"target": [
{
"target": "portable",
"arch": "x64"
}
]
}
}
```
## 🎯 Testing Migration
After completing the migration steps:
1. **Build your project** to ensure no compilation errors
2. **Test debugging** using the new ASP.NET-first approach
3. **Verify packaging** works with the new configuration
4. **Check cross-platform builds** if targeting multiple platforms
## 🚨 Common Migration Issues
### Build Errors
- **Node.js version**: Verify Node.js 22.x is installed and in PATH
- **Package conflicts**: Clean NuGet cache if needed
### Runtime Errors
- **Missing electron-builder.json**: Trigger rebuild or manual NuGet restore
- **Process termination**: Use .NET-first startup mode for better cleanup
## 🚀 Next Steps
- **[What's New?](What's-New.md)** - Complete overview of ElectronNET.Core features
- **[Advanced Migration Topics](Advanced-Migration-Topics.md)** - Handle complex scenarios
- **[Getting Started](../GettingStarted/ASP.Net.md)** - Learn about new development workflows
## 💡 Migration Benefits
**Simplified Configuration** - No more CLI tools or JSON files
**Better Debugging** - Native Visual Studio experience with Hot Reload
**Modern Architecture** - .NET-first process lifecycle
**Cross-Platform Ready** - Build Linux apps from Windows
**Future-Proof** - Flexible Electron version selection
### Step 3: Update Startup Code
**Update UseElectron() calls** to include the new callback parameter. This callback executes at the right moment to initialize your Electron UI.
#### Modern ASP.NET Core (WebApplication)
```csharp
using ElectronNET.API;
using ElectronNET.API.Entities;
public static void Main(string[] args)
{
var builder = WebApplication.CreateBuilder(args);
builder.UseElectron(args, ElectronAppReady);
var app = builder.Build();
app.Run();
}
public static async Task ElectronAppReady()
{
var browserWindow = await Electron.WindowManager.CreateWindowAsync(
new BrowserWindowOptions { Show = false });
browserWindow.OnReadyToShow += () => browserWindow.Show();
}
```
#### Traditional ASP.NET Core (IWebHostBuilder)
```csharp
using ElectronNET.API;
using ElectronNET.API.Entities;
public static void Main(string[] args)
{
WebHost.CreateDefaultBuilder(args)
.UseElectron(args, ElectronAppReady)
.UseStartup<Startup>()
.Build()
.Run();
}
public static async Task ElectronAppReady()
{
var browserWindow = await Electron.WindowManager.CreateWindowAsync(
new BrowserWindowOptions { Show = false });
browserWindow.OnReadyToShow += () => browserWindow.Show();
}
```
### Step 4: Update Development Tools
See [System Requirements](../GettingStarted/System-Requirements.md).
### Step 5: Update Debugging Setup
**Watch Feature Removal:**
The old 'watch' feature is no longer supported. Instead, use the new ASP.NET-first debugging with Hot Reload:
- **Old approach**: Manual process attachment and slow refresh
- **New approach**: Native Visual Studio debugging with Hot Reload
- **Benefits**: Faster development cycle, better debugging experience
**Update Launch Settings:**
Replace old watch configurations with new debugging profiles. See [Debugging](../GettingStarted/Debugging.md) for detailed setup instructions.

View File

@@ -20,13 +20,14 @@ The new package architecture reflects a clearer separation of concerns:
- **ElectronNET.Core.Api** - Pure API definitions for Electron integration
- **ElectronNET.Core.AspNet** - ASP.NET-specific runtime components
This modular approach allows projects to include only what they need while maintaining the flexibility to scale from simple console applications to complex web applications.
This modular approach allows projects to include only what they need while maintaining the flexibility to scale from simple console applications to complex web applications.
More about the available nuget packages: [Package Description](../RelInfo/Package-Description.md).
## Beyond ASP.NET: Console Application Support
### A Fundamental Shift in Accessibility
### A Shift in Accessibility
One of the most significant breakthroughs in ElectronNET.Core is the removal of the ASP.NET requirement. Developers can now build Electron applications using simple console applications, dramatically expanding the use cases and removing a major barrier to adoption.
A major new opportunity in ElectronNET.Core is the removal of the ASP.NET requirement. Developers can now build Electron solutions using simple DotNet console applications, expanding the use cases and removing a major barrier to adoption for a number of use cases.
### Flexible Content Sources
@@ -43,7 +44,7 @@ This capability transforms ElectronNET from a web-focused framework into a versa
### Debugging Reimagined
The debugging experience has been completely transformed. The new ASP.NET-first launch mode means developers can now debug their .NET code directly, with full access to familiar debugging tools and Hot Reload capabilities. No more attaching to processes or working around limited debugging scenariosthe development workflow now matches standard ASP.NET development patterns.
The debugging experience has been completely transformed. The new DotNet-first launch mode means developers can now debug their .NET code directly, with full access to familiar debugging tools and Hot Reload capabilities. No more attaching to processes or working around limited debugging scenariosthe development workflow now matches standard .NET development patterns.
### Cross-Platform Development Without Compromises
@@ -71,7 +72,8 @@ The underlying process architecture has been fundamentally redesigned. Instead o
- Enhanced error handling and recovery
- Cleaner separation between web and native concerns
This architecture supports eight different launch scenarios, covering every combination of packaged/unpackaged deployment, console/ASP.NET hosting, and dotnet-first/electron-first initialization.
This architecture supports eight different launch scenarios, covering every combination of packaged/unpackaged deployment, console/ASP.NET hosting, and dotnet-first/electron-first initialization. The Electron-first launch method is still available or course.
For more details, see: [Startup Methods](../GettingStarted/Startup-Methods.md).
### Unpackaged Development Mode
@@ -103,7 +105,9 @@ The migration path is designed to be straightforward:
1. Update package references to the new structure
2. Remove the old manifest file
3. Configure project properties through Visual Studio
4. Adopt new debugging workflows at your own pace
4. Adopt new debugging workflows at your own pace
Further reading: [Migration Guide](Migration-Guide.md).
## Future Horizons

25
docs/Docs.shproj Normal file
View File

@@ -0,0 +1,25 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup Label="Globals">
<ProjectGuid>06caadc7-de5b-47b4-ab2a-e9501459a2d1</ProjectGuid>
</PropertyGroup>
<ItemGroup>
<Compile Remove="About\Azure\**" />
<Compile Remove="About\BuildBot\**" />
<Compile Remove="images\AzureDevOps\**" />
<Compile Remove="images\visualization\**" />
<Compile Remove="schema_printing\**" />
<EmbeddedResource Remove="About\Azure\**" />
<EmbeddedResource Remove="About\BuildBot\**" />
<EmbeddedResource Remove="images\AzureDevOps\**" />
<EmbeddedResource Remove="images\visualization\**" />
<EmbeddedResource Remove="schema_printing\**" />
<None Remove="About\Azure\**" />
<None Remove="About\BuildBot\**" />
<None Remove="images\AzureDevOps\**" />
<None Remove="images\visualization\**" />
<None Remove="schema_printing\**" />
</ItemGroup>
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<Import Project=".docproj\DocProj.props" />
<Import Project=".docproj\DocProj.targets" />
</Project>

View File

@@ -0,0 +1,129 @@
# ASP.NET Core Setup
ASP.NET Core remains the recommended approach for complex web applications with ElectronNET.Core, providing all the benefits of the ASP.NET ecosystem along with enhanced Electron integration.
## 🛠 System Requirements
See [System Requirements](../GettingStarted/System-Requirements.md).
## 🚀 Quick Start
### 1. Create ASP.NET Core Project
#### Visual Studio
Create a new ASP.NET Core Web App in Visual Studio by selecting **New Project** and choosing one of the ASP.NET Core project templates.
#### From the command line
```bash
dotnet new webapp -n MyElectronWebApp
cd MyElectronWebApp
```
### 2. Install NuGet Packages
#### Visual Studio
Right-click the solution and select **Manage Nuget Packages**.
Finr and install `ElectronNET.Core` as well as `ElectronNET.Core.AspNet`.
#### From the command line
```powershell
dotnet add package ElectronNET.Core
dotnet add package ElectronNET.Core.AspNet
```
> [!Note]
> The API package is automatically included as a dependency of `ElectronNET.Core`.
### 3. Configure Program.cs
Update your `Program.cs` to enable Electron.NET:
```csharp
using ElectronNET.API;
using ElectronNET.API.Entities;
public class Program
{
public static void Main(string[] args)
{
var builder = WebApplication.CreateBuilder(args);
builder.Services.AddRazorPages();
// Add this line to enable Electron.NET:
builder.UseElectron(args, ElectronAppReady);
var app = builder.Build();
if (!app.Environment.IsDevelopment())
{
app.UseExceptionHandler("/Error");
}
app.UseStaticFiles();
app.UseRouting();
app.UseAuthorization();
app.MapRazorPages();
app.Run();
}
public static async Task ElectronAppReady()
{
var browserWindow = await Electron.WindowManager.CreateWindowAsync(new BrowserWindowOptions { Show = false });
browserWindow.OnReadyToShow += () => browserWindow.Show();
}
}
```
#### ASP.NET Port
If you want to launch a specific URL, you can retrieve the actual ASP.NET port from the new `ElectronNetRuntime` static class, for example:
```csharp
await browserWindow.WebContents
.LoadURLAsync($"http://localhost:{ElectronNetRuntime.AspNetWebPort}/mypage.html");
```
### 4. Alternative: IWebHostBuilder Setup
For projects using the traditional `Startup.cs` pattern, please see "Traditional ASP.NET Core" in the [Migration Guide](../Core/Migration-Guide.md).
### 5. Dependency Injection
ElectronNET.API can be added to your DI container within the `Startup` class. All of the modules available in Electron will be added as Singletons.
```csharp
using ElectronNET.API;
public void ConfigureServices(IServiceCollection services)
{
services.AddElectron();
}
```
## 🚀 Next Steps
- **[Debugging](../Using/Debugging.md)** - Learn about ASP.NET debugging features
- **[Package Building](../Using/Package-Building.md)** - Create distributable packages
- **[Startup Methods](../Using/Startup-Methods.md)** - Understanding launch scenarios
## 💡 Benefits of ASP.NET + Electron
**Full Web Stack** - Use MVC, Razor Pages, Blazor, and all ASP.NET features
**Hot Reload** - Edit ASP.NET code and see changes instantly
**Rich Ecosystem** - Access to thousands of ASP.NET packages
**Modern Development** - Latest C# features and ASP.NET patterns
**Scalable Architecture** - Build complex, maintainable applications

View File

@@ -0,0 +1,166 @@
# Console Application Setup
A major benefit in ElectronNET.Core is the ability to build Electron applications using simple console applications instead of requiring ASP.NET Core. This removes a significant barrier and enables many more use cases.
## 🎯 What You Can Build
Console applications with ElectronNET.Core support multiple content scenarios:
- **File System HTML/JS** - Serve static web content directly from the file system
- **Remote Server Integration** - Connect to existing web servers or APIs
- **Lightweight Architecture** - Avoid ASP.NET overhead when not needed
- **Simplified Deployment** - Package and distribute with minimal dependencies
## 📋 Prerequisites
See [System Requirements](../GettingStarted/System-Requirements.md).
## 🚀 Quick Start
### 1. Create Console Application
#### Visual Studio
Create a new console application in Visual Studio by selecting **New Project** and choosing one of the project templates for console apps.
#### From the command line
```bash
dotnet new console -n MyElectronApp
cd MyElectronApp
```
### 2. Install NuGet Packages
```powershell
dotnet add package ElectronNET.Core
```
> [!Note]
> The API package is automatically included as a dependency of `ElectronNET.Core`.
### 3. Configure Project File
Add the Electron.NET configuration to your `.csproj` file:
```xml
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="ElectronNET.Core" Version="1.0.0" />
</ItemGroup>
```
> [!WARNING]
> Specifying `OutputType` property is crucial in order to get the ability of WSL debugging. Especially it is not included in ASP.NET projects.
> When you migrate from ASP.NET to a console application, be sure to add this to the project file.
### 4. Implement Basic Structure
Here's a complete console application example:
```csharp
using System;
using System.Threading.Tasks;
using ElectronNET.API.Entities;
namespace MyElectronApp
public class Program
{
public static async Task Main(string[] args)
{
var runtimeController = ElectronNetRuntime.RuntimeController;
try
{
// Start Electron runtime
await runtimeController.Start();
await runtimeController.WaitReadyTask;
// Initialize your Electron app
await InitializeApp();
// Wait for shutdown
await runtimeController.WaitStoppedTask.ConfigureAwait(false);
}
catch (Exception ex)
{
Console.WriteLine($"Error: {ex.Message}");
await runtimeController.Stop().ConfigureAwait(false);
await runtimeController.WaitStoppedTask.WaitAsync(TimeSpan.FromSeconds(2)).ConfigureAwait(false);
}
}
private static async Task InitializeApp()
{
// Create main window
var browserWindow = await Electron.WindowManager.CreateWindowAsync(
new BrowserWindowOptions
{
Show = false,
WebPreferences = new WebPreferences
{
// Add these two when using file:// URLs
WebSecurity = false,
AllowRunningInsecureContent = true,
NodeIntegration = false,
ContextIsolation = true
}
});
// Load your content (file system, remote URL, etc.)
await browserWindow.WebContents.LoadURLAsync("https://example.com");
// Show window when ready
browserWindow.OnReadyToShow += () => browserWindow.Show();
}
}
```
## 📁 Content Sources
### File System Content
Serve HTML/JS files from your project:
```csharp
// In your project root, create wwwroot/index.html
var fileInfo = new FileInfo(Environment.ProcessPath);
var exeFolder = fileInfo.DirectoryName;
var htmlPath = Path.Combine(exeFolder, "wwwroot/index.html");
var url = new Uri(htmlPath, UriKind.Absolute);
await browserWindow.WebContents.LoadFileAsync(url.ToString());
```
### Remote Content
Load content from any web server:
```csharp
await browserWindow.WebContents.LoadURLAsync("https://your-server.com/app");
```
## 🚀 Next Steps
- **[Debugging](../Using/Debugging.md)** - Learn about debugging console applications
- **[Package Building](../Using/Package-Building.md)** - Create distributable packages
- **[Migration Guide](../Core/Migration-Guide.md)** - Moving from ASP.NET projects
## 💡 Benefits of Console Apps
**Simpler Architecture** - No ASP.NET complexity when not needed
**Flexible Content** - Use any HTML/JS source
**Faster Development** - Less overhead for simple applications
**Easy Deployment** - Minimal dependencies
**Better Performance** - Lighter weight than full web applications

View File

@@ -0,0 +1,53 @@
## 🛠 System Requirements
### Required Software
- **.NET 8.0** or later
- **Node.js 22.x** or later (see below)
- **Visual Studio 2022** (recommended) or other .NET IDE
### Supported Operating Systems
- **Windows 10/11** (x64, ARM64)
- **macOS 11+** (Intel, Apple Silicon)
- **Linux** (most distributions with glibc 2.31+)
> [!Note]
> For Linux development on Windows, install [WSL2](https://docs.microsoft.com/windows/wsl/install) to build and debug Linux packages.
> Do not forget to install NodeJS 22.x (LTS) on WSL.
> Visual Studio will automatically install .NET when debugging on WSL. In all other cases you will need to install a matching .NET SDK on WSL as well.
### NodeJS Installation
ElectronNET.Core requires Node.js 22.x. Update your installation:
**Windows:**
1. Download from [nodejs.org](https://nodejs.org)
2. Run the installer
3. Verify: `node --version` should show v22.x.x
**Linux:**
```bash
# Using Node Version Manager (recommended)
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.0/install.sh | bash
source ~/.bashrc
nvm install 22
nvm use 22
# Or using package manager
sudo apt update
sudo apt install nodejs=22.*
```
## 🚀 Next Steps
- **[Debugging](../Using/Debugging.md)** - Learn about ASP.NET debugging features
- **[Package Building](../Using/Package-Building.md)** - Create distributable packages
- **[Startup Methods](../Using/Startup-Methods.md)** - Understanding launch scenarios

59
docs/Home.md Normal file
View File

@@ -0,0 +1,59 @@
# Electron.NET Wiki Home
Welcome to the **Electron.NET Core** documentation! This wiki covers everything you need to know about building cross-platform desktop applications with ASP.NET Core and Electron.NET.
## 🚀 What is Electron.NET Core?
Electron.NET Core is a complete modernization of Electron.NET that eliminates the CLI tool dependency and integrates deeply with Visual Studio's MSBuild system. It transforms the development experience by providing:
- **Native Visual Studio Integration** - No more CLI tools or JSON configuration files
- **Console Application Support** - Build Electron apps with simple console applications, not just ASP.NET
- **Cross-Platform Development** - Build and debug Linux applications from Windows via WSL
- **Enhanced Debugging** - ASP.NET-first debugging with Hot Reload support
- **Flexible Architecture** - Choose any Electron version and target multiple platforms
## 📚 Documentation Sections
### [Core Documentation](Core/What's-New.md)
- **[What's New?](Core/What's-New.md)** - Complete overview of ElectronNET.Core features and improvements
- **[Migration Guide](Core/Migration-Guide.md)** - Step-by-step migration from previous versions
- **[Advanced Migration Topics](Core/Advanced-Migration-Topics.md)** - Technical details for complex scenarios
### [Getting Started](GettingStarted/ASP.Net.md)
- **[ASP.NET Applications](GettingStarted/ASP.Net.md)** - Build Electron apps with ASP.NET Core
- **[Console Applications](GettingStarted/Console-App.md)** - Use console apps for file system or remote content
- **[Startup Methods](GettingStarted/Startup-Methods.md)** - Understanding different launch scenarios
- **[Debugging](GettingStarted/Debugging.md)** - Debug Electron apps effectively in Visual Studio
- **[Package Building](GettingStarted/Package-Building.md)** - Create distributable packages
### [Release Information](RelInfo/Package-Description.md)
- **[Package Description](RelInfo/Package-Description.md)** - Understanding the three NuGet packages
- **[Changelog](../Changelog.md)** - Complete list of changes and improvements
## 🛠 System Requirements
See [System Requirements](GettingStarted/System-Requirements.md).
## 💡 Key Benefits
**No CLI Tools Required** - Everything works through Visual Studio
**Console App Support** - Use any HTML/JS source, not just ASP.NET
**True Cross-Platform** - Build Linux apps from Windows
**Modern Debugging** - Hot Reload and ASP.NET-first debugging
**Flexible Packaging** - Choose any Electron version
**MSBuild Integration** - Leverages .NET's build system
## 🚦 Getting Started
New to ElectronNET.Core? Start here:
1. **[ASP.NET Setup](GettingStarted/ASP.Net.md)** - Traditional web application approach
2. **[Console App Setup](GettingStarted/Console-App.md)** - Lightweight console application approach
3. **[Migration Guide](Core/Migration-Guide.md)** - Moving from previous versions
## 🤝 Contributing
Found an issue or want to improve the documentation? Contributions are welcome!
The wiki is auto-generated from the `/docs` folder in the [GitHub repository](https://github.com/ElectronNET/Electron.NET).

View File

@@ -0,0 +1,116 @@
# Package Description
ElectronNET.Core consists of three specialized NuGet packages designed for different development scenarios and project architectures.
## 📦 Package Overview
### ElectronNET.Core (Main Package)
**Primary package for Electron.NET applications**
- **Build system integration** - MSBuild targets and tasks for Electron
- **Project system extensions** - Visual Studio designer integration
- **Runtime orchestration** - Process lifecycle management
- **Automatic configuration** - Generates electron-builder.json and package.json
- **Includes ElectronNET.Core.Api** as a dependency
**When to use:**
- Main application projects (startup projects)
- Projects that need full Electron.NET functionality
- Applications requiring build-time Electron configuration
### ElectronNET.Core.Api (API Package)
**Pure API definitions without build integration**
- **Electron API wrappers** - Complete Electron API surface
- **Type definitions** - Full TypeScript-style IntelliSense
- **No build dependencies** - Clean API-only package
- **Multi-platform support** - Windows, macOS, Linux
**When to use:**
- Class library projects that interact with Electron APIs
- Projects that only need API access without build integration
- Multi-project solutions where only the startup project needs build integration
### ElectronNET.Core.AspNet (ASP.NET Integration)
**ASP.NET-specific runtime components**
- **ASP.NET middleware** - UseElectron() extension methods
- **WebHost integration** - Seamless ASP.NET + Electron hosting
- **Hot Reload support** - Enhanced debugging experience
- **Web-specific optimizations** - ASP.NET tailored performance
**When to use:**
- ASP.NET Core projects building Electron applications
- Applications requiring web server functionality
- Projects using MVC, Razor Pages, or Blazor
## 🏗 Architecture Benefits
### Separation of Concerns
- **Build logic separate from API** - Clean dependency management
- **Optional ASP.NET integration** - Use only what you need
- **Multi-project friendly** - Share APIs across projects without build conflicts
### Project Scenarios
**Single Project (ASP.NET):**
```xml
<ItemGroup>
<PackageReference Include="ElectronNET.Core" Version="1.0.0" />
<PackageReference Include="ElectronNET.Core.AspNet" Version="1.0.0" />
</ItemGroup>
```
**Single Project (Console):**
```xml
<ItemGroup>
<PackageReference Include="ElectronNET.Core" Version="1.0.0" />
</ItemGroup>
```
**Multi-Project Solution (ASP.NET):**
```xml
<!-- Startup project -->
<ItemGroup>
<PackageReference Include="ElectronNET.Core" Version="1.0.0" />
<PackageReference Include="ElectronNET.Core.AspNet" Version="1.0.0" />
</ItemGroup>
<!-- Class library projects -->
<ItemGroup>
<PackageReference Include="ElectronNET.Core.Api" Version="1.0.0" />
</ItemGroup>
```
**Multi-Project Solution (Console):**
```xml
<!-- Startup project -->
<ItemGroup>
<PackageReference Include="ElectronNET.Core" Version="1.0.0" />
</ItemGroup>
<!-- Class library projects -->
<ItemGroup>
<PackageReference Include="ElectronNET.Core.Api" Version="1.0.0" />
</ItemGroup>
```
## 🔗 Dependency Chain
```
ElectronNET.Core.AspNet → ElectronNET.Core.Api
ElectronNET.Core → ElectronNET.Core.Api
```
- **ElectronNET.Core.AspNet** depends on ElectronNET.Core.Api
- **ElectronNET.Core** depends on ElectronNET.Core.Api
- **ElectronNET.Core.Api** has no dependencies
## 💡 Recommendations
**Start with ElectronNET.Core** for new projects
**Add ElectronNET.Core.AspNet** only for ASP.NET applications
**Use ElectronNET.Core.Api** for class libraries and API-only scenarios
**Multi-project solutions** benefit from the modular architecture

View File

@@ -0,0 +1,94 @@
# Project Configuration
## 🔧 Visual Studio App Designer
Electron.NET provides close integration via the Visual Studio Project System and MSBuild. After adding the ElectronNET.Core package, you will see this in the project configuration page after double-click on the 'Properties' folder or right-click on the project and choosing 'Properties':
![App Designer1](../images/app_designer1.png)
![App Designer2](../images/app_designer2.png)
## Project File Settings
The same settings can be configured manually by editing the MSBuild properties in your `.csproj` file.
These are the current default values when you don't make any changes:
```xml
<PropertyGroup Label="ElectronNetCommon">
<ElectronVersion>30.4.0</ElectronVersion>
<ElectronBuilderVersion>26.0</ElectronBuilderVersion>
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
<ElectronSingleInstance>true</ElectronSingleInstance>
<ElectronSplashScreen></ElectronSplashScreen>
<ElectronIcon></ElectronIcon>
<PackageId>$(MSBuildProjectName.Replace(".", "-").ToLower())</PackageId>
<ElectronBuilderJson>electron-builder.json</ElectronBuilderJson>
<Title>$(MSBuildProjectName)</Title>
</PropertyGroup>
```
### Relation to package.json
ElectronNET.Core does not work with an `electron-manifest.json` file anymore.
Since electron builder still expects a `package.json` file to exist, ElectronNET.Core is creating this under the hood automatically during build. For reference, here's the package.json template file that is being used, so you can see how the MSBuild properties are being mapped to `package.json` data:
```json
{
"name": "$(PackageId)",
"productName": "$(ElectronTitle)",
"build": {
"appId": "$(PackageId)",
"linux": {
"desktop": {
"entry": { "Name": "$(Title)" }
},
"executableName": "$(PackageId)"
},
"deb": {
"desktop": {
"entry": { "Name": "$(Title)" }
}
}
},
"description": "$(Description)",
"version": "$(Version)",
"main": "main.js",
"author": {
"name": "$(Company)"
},
"license": "$(License)",
"executable": "$(TargetName)",
"singleInstance": "$(ElectronSingleInstance)",
"homepage": "$(ProjectUrl)",
"splashscreen": {
"imageFile": "$(ElectronSplashScreen)"
}
}
```
### 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:
```csharp
WebPreferences wp = new WebPreferences();
wp.NodeIntegration = false;
BrowserWindowOptions browserWindowOptions = new BrowserWindowOptions
{
WebPreferences = wp
};
```
## 🚀 Next Steps
- **[Startup Methods](Startup-Methods.md)** - Understanding launch scenarios
- **[Debugging](../Using/Debugging.md)** - Learn about ASP.NET debugging features
- **[Package Building](Package-Building.md)** - Create distributable packages

242
docs/Using/Debugging.md Normal file
View File

@@ -0,0 +1,242 @@
# Debugging
ElectronNET.Core transforms the debugging experience by providing native Visual Studio integration with multiple debugging modes. No more complex setup or manual process attachment—debugging now works as expected for .NET developers.
## 🎯 Debugging Modes
ElectronNET.Core supports three main debugging approaches, all configured through Visual Studio's launch profiles:
### 1. ASP.NET-First Debugging (Recommended)
Debug your .NET code directly with full Hot Reload support:
```json
{
"profiles": {
"ASP.Net (unpackaged)": {
"commandName": "Project",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"applicationUrl": "http://localhost:8001/"
}
}
}
```
**Benefits:**
- ✅ Full C# debugging with breakpoints
- ✅ Hot Reload for ASP.NET code
- ✅ Edit-and-continue functionality
- ✅ Native Visual Studio debugging experience
### 2. Electron-First Debugging
Debug the Electron process when you need to inspect native Electron APIs:
```json
{
"profiles": {
"Electron (unpackaged)": {
"commandName": "Executable",
"executablePath": "node",
"commandLineArgs": "node_modules/electron/cli.js main.js -unpackedelectron",
"workingDirectory": "$(TargetDir).electron",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
}
}
}
```
**Benefits:**
- ✅ Debug Electron main process
- ✅ Inspect native Electron APIs
- ✅ Node.js debugging capabilities
### 3. Cross-Platform WSL Debugging
Debug Linux builds directly from Windows Visual Studio:
```json
{
"profiles": {
"WSL": {
"commandName": "WSL2",
"launchUrl": "http://localhost:8001/",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development",
"ASPNETCORE_URLS": "http://localhost:8001/"
},
"distributionName": ""
}
}
}
```
**Benefits:**
- ✅ Debug Linux applications from Windows
- ✅ Test Linux-specific behavior
- ✅ Validate cross-platform compatibility
## 🔧 Setup Instructions
### 1. Configure Launch Settings
Add the debugging profiles to `Properties/launchSettings.json`:
```json
{
"profiles": {
"ASP.Net (unpackaged)": {
"commandName": "Project",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"applicationUrl": "http://localhost:8001/"
},
"Electron (unpackaged)": {
"commandName": "Executable",
"executablePath": "node",
"commandLineArgs": "node_modules/electron/cli.js main.js -unpackedelectron",
"workingDirectory": "$(TargetDir).electron",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"WSL": {
"commandName": "WSL2",
"launchUrl": "http://localhost:8001/",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development",
"ASPNETCORE_URLS": "http://localhost:8001/"
},
"distributionName": ""
}
}
}
```
### 2. Switch Runtime Identifiers
When switching between Windows and WSL debugging:
1. **Right-click your project** in Solution Explorer
2. Select **Properties**
3. Adjust the Runtime Identifier
Without Visual Studio:
1. **Edit** the .csproj file
2. **Update the RuntimeIdentifier**:
```xml
<!-- For Windows debugging -->
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
<!-- For WSL/Linux debugging -->
<RuntimeIdentifier>linux-x64</RuntimeIdentifier>
```
### 3. Enable WSL Debugging
For WSL debugging, ensure:
- **WSL2 is installed** and configured
- **Linux distribution** is set in the launch profile
- **Project targets Linux RID** for WSL debugging
## 🚀 Debugging Workflow
### ASP.NET-First Debugging (Default)
1. **Select "ASP.Net (unpackaged)"** profile in Visual Studio
2. **Press F5** to start debugging
3. **Set breakpoints** in your C# code
4. **Use Hot Reload** to edit ASP.NET code during runtime
5. **Stop debugging** when finished
### Electron Process Debugging
1. **Select "Electron (unpackaged)"** profile
2. **Press F5** to start debugging
3. **Attach to Electron process** if needed
4. **Debug Node.js and Electron APIs**
### Cross-Platform Debugging
1. **Set RuntimeIdentifier** to `linux-x64`
2. **Select "WSL"** profile
3. **Press F5** to debug in WSL
4. **Test Linux-specific behavior**
## 🔍 Debugging Tips
### Hot Reload
- **Works with ASP.NET-first debugging**
- **Edit Razor views, controllers, and pages**
- **See changes instantly** without restart
- **Preserves application state**
### Breakpoint Debugging
```csharp
// Set breakpoints here
public async Task<IActionResult> Index()
{
var data = await GetData(); // ← Breakpoint
return View(data);
}
```
### Process Management
- **ASP.NET-first mode** automatically manages Electron process lifecycle
- **Proper cleanup** on debugging session end
- **No manual process killing** required
## 🛠 Troubleshooting
### Common Issues
**"Electron process not found"**
- Ensure Node.js 22.x is installed
- Check that packages are restored (`dotnet restore`)
- Verify RuntimeIdentifier matches your target platform
**"WSL debugging fails"**
- Install and configure WSL2
- Ensure Linux distribution is properly set up
- Check that project targets correct RID
**"Hot Reload not working"**
- Use ASP.NET-first debugging profile
- Ensure ASPNETCORE_ENVIRONMENT=Development
- Check for compilation errors
## 🎨 Visual Debugging
*Placeholder for image showing Visual Studio debugging interface with Electron.NET*
The debugging interface provides familiar Visual Studio tools:
- **Locals and Watch windows** for variable inspection
- **Call Stack** for method call tracing
- **Immediate Window** for runtime evaluation
- **Hot Reload** indicator for edit-and-continue
## 🚀 Next Steps
- **[Startup Methods](Startup-Methods.md)** - Understanding different launch scenarios
- **[Package Building](Package-Building.md)** - Debug packaged applications
- **[Migration Guide](../Core/Migration-Guide.md)** - Moving from old debugging workflows
## 💡 Benefits
**Native Visual Studio Experience** - No complex setup or manual attachment
**Hot Reload Support** - Edit ASP.NET code during debugging
**Cross-Platform Debugging** - Debug Linux apps from Windows
**Multiple Debugging Modes** - Choose the right approach for your needs
**Process Lifecycle Management** - Automatic cleanup and proper termination

View File

@@ -0,0 +1,145 @@
# Package Building
ElectronNET.Core integrates with Visual Studio's publishing system to create distributable Electron packages using electron-builder. The process leverages .NET's build system while automatically generating the necessary Electron configuration files.
## 🎯 Publishing Overview
The publishing process differs slightly between ASP.NET and console applications:
- **ASP.NET Apps** - Use folder publishing with SelfContained=true
- **Console Apps** - Use folder publishing with SelfContained=false
## 🚀 Publishing Process
### Step 1: Create Publish Profiles
Add publish profiles to `Properties/PublishProfiles/`:
#### ASP.NET Application Profile (Windows)
**win-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>net8.0</TargetFramework>
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
<SelfContained>true</SelfContained>
<PublishSingleFile>false</PublishSingleFile>
</PropertyGroup>
</Project>
```
#### ASP.NET Application Profile (Linux)
**linux-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>net8.0</TargetFramework>
<RuntimeIdentifier>linux-x64</RuntimeIdentifier>
<SelfContained>true</SelfContained>
<PublishSingleFile>false</PublishSingleFile>
</PropertyGroup>
</Project>
```
#### Console Application Profile (Windows)
**win-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>net8.0</TargetFramework>
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
<SelfContained>false</SelfContained>
<PublishSingleFile>false</PublishSingleFile>
<PublishReadyToRun>false</PublishReadyToRun>
</PropertyGroup>
</Project>
```
#### Console Application Profile (Linux)
**linux-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>net8.0</TargetFramework>
<RuntimeIdentifier>linux-x64</RuntimeIdentifier>
<SelfContained>false</SelfContained>
<PublishSingleFile>false</PublishSingleFile>
</PropertyGroup>
</Project>
```
### Step 2: Configure Electron Builder
ElectronNET.Core automatically adds a default `electron-builder.json` file under `Properties\electron-builder.json`.
Please see here for details of the available configuration options: https://www.electron.build/.
### Step 3: Publish from Visual Studio
1. **Right-click your project** in Solution Explorer
2. **Select "Publish"**
4. **Select your publish profile** (Windows/Linux)
5. **Click "Publish"**
The publish process will:
- Build your .NET application
- Copy all files as needed
- Install npm dependencies
- Run electron-builder
> [!NOTE]
> When running publish for a Linux configuration on Windows, Electron.NET will automatically use WSL for the platform-specific steps.
**After publishing**, the final results will be in
`publish\Release\netx.0\xxx-xxx\`
## MacOS
> [!NOTE]
> 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.
## 🚀 Next Steps
- **[Startup Methods](Startup-Methods.md)** - Understanding different launch modes for packaged apps
- **[Debugging](Debugging.md)** - Debug packaged applications
- **[Migration Guide](../Core/Migration-Guide.md)** - Update existing projects for new publishing
## 💡 Benefits
**Native VS Integration** - Use familiar publish workflows
**Cross-Platform Building** - Build Linux packages from Windows
**Automatic Configuration** - No manual electron-builder setup
**Multiple Package Types** - NSIS, AppImage, DMG, etc.
**CI/CD Ready** - Easy integration with build pipelines

View File

@@ -0,0 +1,246 @@
# Startup Methods
ElectronNET.Core supports multiple startup methods to handle different development and deployment scenarios. The framework automatically detects the appropriate mode based on command-line flags and environment.
## 🎯 Startup Scenarios
The framework supports **8 different launch scenarios** covering every combination of:
- **Packaged vs Unpackaged** deployment
- **Console vs ASP.NET** application types
- **Dotnet-first vs Electron-first** initialization
## 🚀 Command-Line Flags
### Unpackaged Debugging Modes
#### **`-unpackedelectron`** - Electron-first debugging
```bash
# Launch Electron first, which then starts .NET
node node_modules/electron/cli.js main.js -unpackedelectron
```
#### **`-unpackeddotnet`** - .NET-first debugging
```bash
# Launch .NET first, which then starts Electron
dotnet run -unpackeddotnet
```
### Packaged Deployment Modes
#### **`-dotnetpacked`** - .NET-first packaged execution
```bash
# Run packaged app with .NET starting first
MyApp.exe -dotnetpacked
```
#### **No flags** - Electron-first packaged execution (default)
```bash
# Run packaged app with Electron starting first
MyApp.exe
```
## 📋 Startup Method Details
### 1. Unpackaged + Electron-First (Development)
- **Use Case**: Debug Electron main process and Node.js code
- **Command**: `-unpackedelectron` flag
- **Process Flow**:
1. Electron starts first
2. Electron launches .NET process
3. .NET connects back to Electron
4. Application runs with Electron in control
### 2. Unpackaged + .NET-First (Development)
- **Use Case**: Debug ASP.NET/C# code with Hot Reload
- **Command**: `-unpackeddotnet` flag
- **Process Flow**:
1. .NET application starts first
2. .NET launches Electron process
3. Electron connects back to .NET
4. Application runs with .NET in control
### 3. Packaged + .NET-First (Production)
- **Use Case**: Deployed application with .NET controlling lifecycle
- **Command**: `-dotnetpacked` flag
- **Process Flow**:
1. .NET executable starts first
2. .NET launches Electron from packaged files
3. Electron loads from app.asar or extracted files
4. .NET maintains process control
### 4. Packaged + Electron-First (Production)
- **Use Case**: Traditional Electron app behavior
- **Command**: No special flags
- **Process Flow**:
1. Electron executable starts first
2. Electron launches .NET from packaged files
3. .NET runs from Electron's process context
4. Electron maintains UI control
## 🔧 Configuration Examples
### ASP.NET Application Startup
```csharp
// Program.cs
var builder = WebApplication.CreateBuilder(args);
// Configure for different startup modes
builder.WebHost.UseElectron(args, async () =>
{
var browserWindow = await Electron.WindowManager.CreateWindowAsync(
new BrowserWindowOptions { Show = false });
await browserWindow.WebContents.LoadURLAsync("http://localhost:8001");
browserWindow.OnReadyToShow += () => browserWindow.Show();
});
var app = builder.Build();
app.Run();
```
### Console Application Startup
```csharp
// Program.cs
public static async Task Main(string[] args)
{
var runtimeController = ElectronNetRuntime.RuntimeController;
await runtimeController.Start();
await runtimeController.WaitReadyTask;
await InitializeApplication();
await runtimeController.WaitStoppedTask;
}
```
## 🎨 Visual Process Flow
![Startup Modes](../images/startup_modes.png)
The image above illustrates how each combination of deployment type, application type, and initialization order affects the process lifecycle.
## 🚀 Development Workflows
### Debugging Workflow
**ASP.NET-First Debugging** (Recommended)
```json
// launchSettings.json
{
"ASP.Net (unpackaged)": {
"commandName": "Project",
"commandLineArgs": "-unpackeddotnet"
}
}
```
**Electron-First Debugging**
```json
// launchSettings.json
{
"Electron (unpackaged)": {
"commandName": "Executable",
"executablePath": "node",
"commandLineArgs": "node_modules/electron/cli.js main.js -unpackedelectron"
}
}
```
### Production Deployment
**Dotnet-First Deployment**
```bash
# Build and package
dotnet publish -c Release -r win-x64
cd publish\Release\net8.0\win-x64
npm install
npx electron-builder
# Run with dotnet-first
MyApp.exe -dotnetpacked
```
**Electron-First Deployment** (Default)
```bash
# Run packaged application (no special flags needed)
MyApp.exe
```
## 🔍 Process Lifecycle Management
### Automatic Cleanup
ElectronNET.Core automatically manages process lifecycle:
- **Graceful shutdown** when main window is closed
- **Proper cleanup** of child processes
- **Error handling** for process failures
- **Cross-platform compatibility** for process management
### Manual Control
Access runtime controller for advanced scenarios:
```csharp
var runtime = ElectronNetRuntime.RuntimeController;
// Wait for Electron to be ready
await runtime.WaitReadyTask;
// Stop Electron runtime
await runtime.Stop();
await runtime.WaitStoppedTask;
```
## 🛠 Troubleshooting
### Common Startup Issues
**"Electron process not found"**
- Ensure Node.js 22.x is installed
- Check that .NET build succeeded
- Verify RuntimeIdentifier is set correctly
**"Port conflicts"**
- Use different ports for different startup modes
- Check that no other instances are running
- Verify firewall settings
**"Process won't terminate"**
- Use dotnet-first mode for better cleanup
- Check for unhandled exceptions
- Verify all windows are properly closed
## 💡 Best Practices
### Choose the Right Mode
- **Development**: Use .NET-first for C# debugging, Electron-first for Node.js debugging
- **Production**: Use .NET-first for better process control, Electron-first for traditional behavior
- **Cross-platform**: Use .NET-first for consistent behavior across platforms
### Environment Configuration
```xml
<!-- .csproj -->
<PropertyGroup>
<ElectronNETCoreEnvironment>Production</ElectronNETCoreEnvironment>
</PropertyGroup>
```
## 🚀 Next Steps
- **[Debugging](Debugging.md)** - Debug different startup modes
- **[Package Building](Package-Building.md)** - Package for different deployment scenarios
- **[Migration Guide](../Core/Migration-Guide.md)** - Update existing apps for new startup methods
## 🎯 Summary
The flexible startup system ensures ElectronNET.Core works optimally in every scenario while providing the control and debugging experience .NET developers expect. Choose the appropriate mode based on your development workflow and deployment requirements.

2
docs/_Footer.md Normal file
View File

@@ -0,0 +1,2 @@
Want to contribute to this documentation? Please fork and create a PR! The Wiki is autogenerated from the /docs content in the repository.

50
docs/_Sidebar.md Normal file
View File

@@ -0,0 +1,50 @@
<!-- First line gets deleted -->
# Wiki
- [Home](Home.md)
- [About this Project](About.md)
# Electron.NET Core
- [What's new?](Core/What's-New.md)
- [Migration Guide](Core/Migration-Guide.md)
- [Advanced Migration](Core/Advanced-Migration-Topics.md)
# Getting Started
- [System Requirements](GettingStarted/System-Requirements.md)
- [With ASP.Net](GettingStarted/ASP.Net.md)
- [With a Console App](GettingStarted/Console-App.md)
# Using Electron.NET
- [Configuration](Using/Configuration.md)
- [Startup-Methods](Using/Startup-Methods.md)
- [Debugging](Using/Debugging.md)
- [Package Building](Using/Package-Building.md)
# API Reference
- [API Overview](API/Overview.md)
- [Electron.App](API/App.md)
- [Electron.Dialog](API/Dialog.md)
- [Electron.Menu](API/Menu.md)
- [Electron.WindowManager](API/WindowManager.md)
- [Electron.Shell](API/Shell.md)
- [Electron.Screen](API/Screen.md)
- [Electron.Notification](API/Notification.md)
- [Electron.Tray](API/Tray.md)
- [Electron.Clipboard](API/Clipboard.md)
- [Electron.Dock](API/Dock.md)
- [Electron.HostHook](API/HostHook.md)
- [Electron.IpcMain](API/IpcMain.md)
- [Electron.GlobalShortcut](API/GlobalShortcut.md)
- [Electron.AutoUpdater](API/AutoUpdater.md)
- [Electron.NativeTheme](API/NativeTheme.md)
- [Electron.PowerMonitor](API/PowerMonitor.md)
# Release Information
- [Package Description](RelInfo/Package-Description.md)
- [Changelog](RelInfo/Changelog.md)

Binary file not shown.

After

Width:  |  Height:  |  Size: 29 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

7857
docs/md-styles.css Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -10,7 +10,7 @@
<p>Use the demo snippets in an Electron app of your own. The <a href="https://github.com/electron/electron-quick-start">Electron Quick Start<span class="u-visible-to-screen-reader">(opens in new window)</span></a> app is a bare-bones setup that pairs with these demos. Follow the instructions here to get it going.
To activate Electron.NET include the <a href="https://www.nuget.org/packages/ElectronNET.API/" target="_blank">ElectronNET.API NuGet package</a> in your ASP.NET Core app.
<p>
<code class="language-bash">PM> Install-Package ElectronNET.API</code>
<code class="language-bash">dotnet add package ElectronNET.API</code>
</p>
Then include the UseElectron WebHostBuilder-Extension into the Program.cs-file of your ASP.NET Core project.

View File

@@ -54,9 +54,19 @@ EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Test Apps", "Test Apps", "{EDCBFC49-2AEE-4BAF-9368-4409298C52FC}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Build", "Build", "{985D39A7-5216-4945-8167-2FD0CB387BD8}"
ProjectSection(SolutionItems) = preProject
..\.github\workflows\ci.yml = ..\.github\workflows\ci.yml
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "_build", "..\nuke\_build.csproj", "{015CB06B-6CAE-209F-E050-21C3ACA5FE9F}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "!Docs", "!Docs", "{D36CDFFD-3438-42E4-A7FF-88BA19AC4964}"
ProjectSection(SolutionItems) = preProject
..\.github\workflows\publish-wiki.yml = ..\.github\workflows\publish-wiki.yml
EndProjectSection
EndProject
Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "Docs", "..\docs\Docs.shproj", "{06CAADC7-DE5B-47B4-AB2A-E9501459A2D1}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -93,6 +103,8 @@ Global
{EE38A326-5DE8-AF09-9EB9-DF0878938783}.Release|Any CPU.Build.0 = Release|Any CPU
{015CB06B-6CAE-209F-E050-21C3ACA5FE9F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{015CB06B-6CAE-209F-E050-21C3ACA5FE9F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{06CAADC7-DE5B-47B4-AB2A-E9501459A2D1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{06CAADC7-DE5B-47B4-AB2A-E9501459A2D1}.Release|Any CPU.ActiveCfg = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@@ -106,6 +118,7 @@ Global
{DD10D21A-D131-1D9C-33F9-406046E0C5B0} = {1BB6F634-2831-4496-83A6-BC6761DCEC8D}
{EE38A326-5DE8-AF09-9EB9-DF0878938783} = {EDCBFC49-2AEE-4BAF-9368-4409298C52FC}
{015CB06B-6CAE-209F-E050-21C3ACA5FE9F} = {985D39A7-5216-4945-8167-2FD0CB387BD8}
{06CAADC7-DE5B-47B4-AB2A-E9501459A2D1} = {D36CDFFD-3438-42E4-A7FF-88BA19AC4964}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {81A62E71-9E04-4EFE-AD5C-23165375F8EF}

View File