diff --git a/ElectronNET.API/App.cs b/ElectronNET.API/App.cs
index 274786c..80b3d41 100644
--- a/ElectronNET.API/App.cs
+++ b/ElectronNET.API/App.cs
@@ -7,6 +7,11 @@ using System.Runtime.InteropServices;
using System.Threading;
using System.Threading.Tasks;
using ElectronNET.API.Extensions;
+using System.Runtime.Versioning;
+
+//TODO: Implement app.showEmojiPanel and app.isEmojiPanelSupported: https://www.electronjs.org/docs/api/app#appshowemojipanel-macos-windows
+//TODO: Implement app.moveToApplicationsFolder: https://www.electronjs.org/docs/api/app#appmovetoapplicationsfolderoptions-macos
+//TODO: Implement apprunningUnderRosettaTranslation: https://www.electronjs.org/docs/api/app#apprunningunderrosettatranslation-macos-readonly
namespace ElectronNET.API
{
@@ -337,6 +342,8 @@ namespace ElectronNET.API
/// screen readers, are enabled or disabled. See https://www.chromium.org/developers/design-documents/accessibility for more details.
///
/// when Chrome's accessibility support is enabled, otherwise.
+ [SupportedOSPlatform("macos")]
+ [SupportedOSPlatform("windows")]
public event Action AccessibilitySupportChanged
{
add
@@ -411,6 +418,7 @@ namespace ElectronNET.API
///
/// On Windows, you have to parse the arguments using App.CommandLine to get the filepath.
///
+ [SupportedOSPlatform("macos")]
public event Action OpenFile
{
add
@@ -442,6 +450,7 @@ namespace ElectronNET.API
/// 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.
///
+ [SupportedOSPlatform("macos")]
public event Action OpenUrl
{
add
@@ -599,6 +608,7 @@ namespace ElectronNET.API
///
/// You should seek to use the option as sparingly as possible.
///
+ [SupportedOSPlatform("macos")]
public void Focus(FocusOptions focusOptions)
{
BridgeConnector.Emit("appFocus", JObject.FromObject(focusOptions, _jsonSerializer));
@@ -607,6 +617,7 @@ namespace ElectronNET.API
///
/// Hides all application windows without minimizing them.
///
+ [SupportedOSPlatform("macos")]
public void Hide()
{
BridgeConnector.Emit("appHide");
@@ -615,6 +626,7 @@ namespace ElectronNET.API
///
/// Shows application windows after they were hidden. Does not automatically focus them.
///
+ [SupportedOSPlatform("macos")]
public void Show()
{
BridgeConnector.Emit("appShow");
@@ -688,6 +700,8 @@ namespace ElectronNET.API
/// list from the task bar, and on macOS you can visit it from dock menu.
///
/// Path to add.
+ [SupportedOSPlatform("macos")]
+ [SupportedOSPlatform("windows")]
public void AddRecentDocument(string path)
{
BridgeConnector.Emit("appAddRecentDocument", path);
@@ -696,6 +710,8 @@ namespace ElectronNET.API
///
/// Clears the recent documents list.
///
+ [SupportedOSPlatform("macos")]
+ [SupportedOSPlatform("windows")]
public void ClearRecentDocuments()
{
BridgeConnector.Emit("appClearRecentDocuments");
@@ -726,6 +742,8 @@ namespace ElectronNET.API
/// call this method with electron as the parameter.
/// The cancellation token.
/// Whether the call succeeded.
+ [SupportedOSPlatform("macos")]
+ [SupportedOSPlatform("windows")]
public async Task SetAsDefaultProtocolClientAsync(string protocol, CancellationToken cancellationToken = default)
{
return await SetAsDefaultProtocolClientAsync(protocol, null, null, cancellationToken);
@@ -757,6 +775,8 @@ namespace ElectronNET.API
/// The path to the Electron executable. Defaults to process.execPath
/// The cancellation token.
/// Whether the call succeeded.
+ [SupportedOSPlatform("macos")]
+ [SupportedOSPlatform("windows")]
public async Task SetAsDefaultProtocolClientAsync(string protocol, string path, CancellationToken cancellationToken = default)
{
return await SetAsDefaultProtocolClientAsync(protocol, path, null, cancellationToken);
@@ -789,6 +809,8 @@ namespace ElectronNET.API
/// Arguments passed to the executable. Defaults to an empty array.
/// The cancellation token.
/// Whether the call succeeded.
+ [SupportedOSPlatform("macos")]
+ [SupportedOSPlatform("windows")]
public Task SetAsDefaultProtocolClientAsync(string protocol, string path, string[] args, CancellationToken cancellationToken = default) => BridgeConnector.OnResult("appSetAsDefaultProtocolClient", "appSetAsDefaultProtocolClientCompleted", cancellationToken, protocol, path, args);
///
@@ -798,6 +820,8 @@ namespace ElectronNET.API
/// The name of your protocol, without ://.
/// The cancellation token.
/// Whether the call succeeded.
+ [SupportedOSPlatform("macos")]
+ [SupportedOSPlatform("windows")]
public async Task RemoveAsDefaultProtocolClientAsync(string protocol, CancellationToken cancellationToken = default)
{
return await RemoveAsDefaultProtocolClientAsync(protocol, null, null, cancellationToken);
@@ -811,6 +835,8 @@ namespace ElectronNET.API
/// Defaults to process.execPath.
/// The cancellation token.
/// Whether the call succeeded.
+ [SupportedOSPlatform("macos")]
+ [SupportedOSPlatform("windows")]
public async Task RemoveAsDefaultProtocolClientAsync(string protocol, string path, CancellationToken cancellationToken = default)
{
return await RemoveAsDefaultProtocolClientAsync(protocol, path, null, cancellationToken);
@@ -825,6 +851,8 @@ namespace ElectronNET.API
/// Defaults to an empty array.
/// The cancellation token.
/// Whether the call succeeded.
+ [SupportedOSPlatform("macos")]
+ [SupportedOSPlatform("windows")]
public Task RemoveAsDefaultProtocolClientAsync(string protocol, string path, string[] args, CancellationToken cancellationToken = default) => BridgeConnector.OnResult("appRemoveAsDefaultProtocolClient", "appRemoveAsDefaultProtocolClientCompleted", cancellationToken, protocol, path, args);
@@ -841,6 +869,8 @@ namespace ElectronNET.API
/// The name of your protocol, without ://.
/// The cancellation token.
/// Whether the current executable is the default handler for a protocol (aka URI scheme).
+ [SupportedOSPlatform("macos")]
+ [SupportedOSPlatform("windows")]
public async Task IsDefaultProtocolClientAsync(string protocol, CancellationToken cancellationToken = default)
{
return await IsDefaultProtocolClientAsync(protocol, null, null, cancellationToken);
@@ -860,6 +890,8 @@ namespace ElectronNET.API
/// Defaults to process.execPath.
/// The cancellation token.
/// Whether the current executable is the default handler for a protocol (aka URI scheme).
+ [SupportedOSPlatform("macos")]
+ [SupportedOSPlatform("windows")]
public async Task IsDefaultProtocolClientAsync(string protocol, string path, CancellationToken cancellationToken = default)
{
return await IsDefaultProtocolClientAsync(protocol, path, null, cancellationToken);
@@ -880,6 +912,8 @@ namespace ElectronNET.API
/// Defaults to an empty array.
/// The cancellation token.
/// Whether the current executable is the default handler for a protocol (aka URI scheme).
+ [SupportedOSPlatform("macos")]
+ [SupportedOSPlatform("windows")]
public Task IsDefaultProtocolClientAsync(string protocol, string path, string[] args, CancellationToken cancellationToken = default) => BridgeConnector.OnResult("appIsDefaultProtocolClient", "appIsDefaultProtocolClientCompleted", cancellationToken, protocol, path, args);
@@ -891,6 +925,7 @@ namespace ElectronNET.API
/// Array of objects.
/// The cancellation token.
/// Whether the call succeeded.
+ [SupportedOSPlatform("windows")]
public Task SetUserTasksAsync(UserTask[] userTasks, CancellationToken cancellationToken = default) => BridgeConnector.OnResult("appSetUserTasks", "appSetUserTasksCompleted", cancellationToken, JArray.FromObject(userTasks, _jsonSerializer));
///
@@ -898,6 +933,7 @@ namespace ElectronNET.API
///
/// The cancellation token.
/// Jump List settings.
+ [SupportedOSPlatform("windows")]
public Task GetJumpListSettingsAsync(CancellationToken cancellationToken = default) => BridgeConnector.OnResult("appGetJumpListSettings", "appGetJumpListSettingsCompleted", cancellationToken);
///
@@ -916,6 +952,7 @@ namespace ElectronNET.API
/// omitted from the Jump List. The list of removed items can be obtained using .
///
/// Array of objects.
+ [SupportedOSPlatform("windows")]
public void SetJumpList(JumpListCategory[] categories)
{
BridgeConnector.Emit("appSetJumpList", JArray.FromObject(categories, _jsonSerializer));
@@ -991,6 +1028,7 @@ namespace ElectronNET.API
///
/// Uniquely identifies the activity. Maps to NSUserActivity.activityType.
/// App-specific state to store for use by another device.
+ [SupportedOSPlatform("macos")]
public void SetUserActivity(string type, object userInfo)
{
SetUserActivity(type, userInfo, null);
@@ -1008,6 +1046,7 @@ namespace ElectronNET.API
///
/// The webpage to load in a browser if no suitable app is installed on the resuming device. The scheme must be http or https.
///
+ [SupportedOSPlatform("macos")]
public void SetUserActivity(string type, object userInfo, string webpageUrl)
{
BridgeConnector.Emit("appSetUserActivity", type, userInfo, webpageUrl);
@@ -1017,12 +1056,14 @@ namespace ElectronNET.API
/// The type of the currently running activity.
///
/// The cancellation token.
+ [SupportedOSPlatform("macos")]
public Task GetCurrentActivityTypeAsync(CancellationToken cancellationToken = default) => BridgeConnector.OnResult("appGetCurrentActivityType", "appGetCurrentActivityTypeCompleted", cancellationToken);
///
/// Invalidates the current Handoff user activity.
///
+ [SupportedOSPlatform("macos")]
public void InvalidateCurrentActivity()
{
BridgeConnector.Emit("appInvalidateCurrentActivity");
@@ -1031,6 +1072,7 @@ namespace ElectronNET.API
///
/// Marks the current Handoff user activity as inactive without invalidating it.
///
+ [SupportedOSPlatform("macos")]
public void ResignCurrentActivity()
{
BridgeConnector.Emit("appResignCurrentActivity");
@@ -1040,6 +1082,7 @@ namespace ElectronNET.API
/// Changes the Application User Model ID to id.
///
/// Model Id.
+ [SupportedOSPlatform("windows")]
public void SetAppUserModelId(string id)
{
BridgeConnector.Emit("appSetAppUserModelId", id);
@@ -1054,6 +1097,7 @@ namespace ElectronNET.API
///
/// The cancellation token.
/// Result of import. Value of 0 indicates success.
+ [SupportedOSPlatform("linux")]
public Task ImportCertificateAsync(ImportCertificateOptions options, CancellationToken cancellationToken = default) => BridgeConnector.OnResult("appImportCertificate", "appImportCertificateCompleted", cancellationToken, JObject.FromObject(options, _jsonSerializer));
///
@@ -1084,12 +1128,16 @@ namespace ElectronNET.API
/// Counter badge.
/// The cancellation token.
/// Whether the call succeeded.
+ [SupportedOSPlatform("linux")]
+ [SupportedOSPlatform("macos")]
public Task SetBadgeCountAsync(int count, CancellationToken cancellationToken = default) => BridgeConnector.OnResult("appSetBadgeCount", "appSetBadgeCountCompleted", cancellationToken, count);
///
/// The current value displayed in the counter badge.
///
/// The cancellation token.
+ [SupportedOSPlatform("linux")]
+ [SupportedOSPlatform("macos")]
public Task GetBadgeCountAsync(CancellationToken cancellationToken = default) => BridgeConnector.OnResult("appGetBadgeCount", "appGetBadgeCountCompleted", cancellationToken);
///
@@ -1101,12 +1149,15 @@ namespace ElectronNET.API
/// Whether the current desktop environment is Unity launcher.
///
/// The cancellation token.
+ [SupportedOSPlatform("linux")]
public Task IsUnityRunningAsync(CancellationToken cancellationToken = default) => BridgeConnector.OnResult("appIsUnityRunning", "appIsUnityRunningCompleted", cancellationToken);
///
/// If you provided path and args options to then you need to pass the same
/// arguments here for to be set correctly.
///
+ [SupportedOSPlatform("windows")]
+ [SupportedOSPlatform("macos")]
public async Task GetLoginItemSettingsAsync(CancellationToken cancellationToken = default)
{
return await GetLoginItemSettingsAsync(null, cancellationToken);
@@ -1118,6 +1169,8 @@ namespace ElectronNET.API
///
///
/// The cancellation token.
+ [SupportedOSPlatform("windows")]
+ [SupportedOSPlatform("macos")]
public Task GetLoginItemSettingsAsync(LoginItemSettingsOptions options, CancellationToken cancellationToken = default) =>
options is null ? BridgeConnector.OnResult("appGetLoginItemSettings", "appGetLoginItemSettingsCompleted", cancellationToken)
: BridgeConnector.OnResult("appGetLoginItemSettings", "appGetLoginItemSettingsCompleted", cancellationToken, JObject.FromObject(options, _jsonSerializer));
@@ -1128,6 +1181,8 @@ namespace ElectronNET.API
/// you'll want to set the launch path to Update.exe, and pass arguments that specify your application name.
///
///
+ [SupportedOSPlatform("windows")]
+ [SupportedOSPlatform("macos")]
public void SetLoginItemSettings(LoginSettings loginSettings)
{
BridgeConnector.Emit("appSetLoginItemSettings", JObject.FromObject(loginSettings, _jsonSerializer));
@@ -1139,6 +1194,8 @@ namespace ElectronNET.API
/// See Chromium's accessibility docs for more details.
///
/// if Chrome’s accessibility support is enabled, otherwise.
+ [SupportedOSPlatform("windows")]
+ [SupportedOSPlatform("macos")]
public Task IsAccessibilitySupportEnabledAsync(CancellationToken cancellationToken = default) => BridgeConnector.OnResult("appIsAccessibilitySupportEnabled", "appIsAccessibilitySupportEnabledCompleted", cancellationToken);
@@ -1152,6 +1209,8 @@ namespace ElectronNET.API
/// Note: Rendering accessibility tree can significantly affect the performance of your app. It should not be enabled by default.
///
/// Enable or disable accessibility tree rendering.
+ [SupportedOSPlatform("windows")]
+ [SupportedOSPlatform("macos")]
public void SetAccessibilitySupportEnabled(bool enabled)
{
BridgeConnector.Emit("appSetAboutPanelOptions", enabled);
diff --git a/ElectronNET.API/BrowserWindow.cs b/ElectronNET.API/BrowserWindow.cs
index 0b8222c..9a15ddb 100644
--- a/ElectronNET.API/BrowserWindow.cs
+++ b/ElectronNET.API/BrowserWindow.cs
@@ -7,8 +7,11 @@ using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
+using System.Runtime.Versioning;
using System.Threading.Tasks;
+//TODO: Add setTrafficLightPosition and getTrafficLightPosition: https://www.electronjs.org/docs/api/browser-window#winsettrafficlightpositionposition-macos
+
namespace ElectronNET.API
{
///
@@ -146,6 +149,7 @@ namespace ElectronNET.API
///
/// Emitted when window session is going to end due to force shutdown or machine restart or session log off.
///
+ [SupportedOSPlatform("windows")]
public event Action OnSessionEnd
{
add
@@ -465,6 +469,8 @@ namespace ElectronNET.API
///
/// Emitted when the window is being resized.
///
+ [SupportedOSPlatform("macos")]
+ [SupportedOSPlatform("windows")]
public event Action OnResize
{
add
@@ -496,6 +502,8 @@ namespace ElectronNET.API
///
/// Note: On macOS this event is just an alias of moved.
///
+ [SupportedOSPlatform("macos")]
+ [SupportedOSPlatform("windows")]
public event Action OnMove
{
add
@@ -523,8 +531,10 @@ namespace ElectronNET.API
private event Action _move;
///
- /// macOS: Emitted once when the window is moved to a new position.
+ /// Emitted once when the window is moved to a new position.
///
+ [SupportedOSPlatform("macos")]
+ [SupportedOSPlatform("windows")]
public event Action OnMoved
{
add
@@ -676,6 +686,8 @@ namespace ElectronNET.API
/// and the APPCOMMAND_ prefix is stripped off.e.g.APPCOMMAND_BROWSER_BACKWARD
/// is emitted as browser-backward.
///
+ [SupportedOSPlatform("macos")]
+ [SupportedOSPlatform("windows")]
public event Action OnAppCommand
{
add
@@ -705,6 +717,7 @@ namespace ElectronNET.API
///
/// Emitted when scroll wheel event phase has begun.
///
+ [SupportedOSPlatform("macos")]
public event Action OnScrollTouchBegin
{
add
@@ -734,6 +747,7 @@ namespace ElectronNET.API
///
/// Emitted when scroll wheel event phase has ended.
///
+ [SupportedOSPlatform("macos")]
public event Action OnScrollTouchEnd
{
add
@@ -763,6 +777,7 @@ namespace ElectronNET.API
///
/// Emitted when scroll wheel event phase filed upon reaching the edge of element.
///
+ [SupportedOSPlatform("macos")]
public event Action OnScrollTouchEdge
{
add
@@ -792,6 +807,7 @@ namespace ElectronNET.API
///
/// Emitted on 3-finger swipe. Possible directions are up, right, down, left.
///
+ [SupportedOSPlatform("macos")]
public event Action OnSwipe
{
add
@@ -821,6 +837,7 @@ namespace ElectronNET.API
///
/// Emitted when the window opens a sheet.
///
+ [SupportedOSPlatform("macos")]
public event Action OnSheetBegin
{
add
@@ -850,6 +867,7 @@ namespace ElectronNET.API
///
/// Emitted when the window has closed a sheet.
///
+ [SupportedOSPlatform("macos")]
public event Action OnSheetEnd
{
add
@@ -879,6 +897,7 @@ namespace ElectronNET.API
///
/// Emitted when the native new tab button is clicked.
///
+ [SupportedOSPlatform("macos")]
public event Action OnNewWindowForTab
{
add
@@ -1080,17 +1099,41 @@ namespace ElectronNET.API
///
/// The aspect ratio to maintain for some portion of the content view.
/// The extra size not to be included while maintaining the aspect ratio.
+ public void SetAspectRatio(int aspectRatio)
+ {
+ BridgeConnector.Emit("browserWindowSetAspectRatio", Id, aspectRatio, new Size() { Height = 0, Width = 0 });
+ }
+
+ ///
+ /// This will make a window maintain an aspect ratio. The extra size allows a developer to have space,
+ /// specified in pixels, not included within the aspect ratio calculations. This API already takes into
+ /// account the difference between a window’s size and its content size.
+ ///
+ /// Consider a normal window with an HD video player and associated controls.Perhaps there are 15 pixels
+ /// of controls on the left edge, 25 pixels of controls on the right edge and 50 pixels of controls below
+ /// the player. In order to maintain a 16:9 aspect ratio (standard aspect ratio for HD @1920x1080) within
+ /// the player itself we would call this function with arguments of 16/9 and[40, 50]. The second argument
+ /// doesn’t care where the extra width and height are within the content view–only that they exist. Just
+ /// sum any extra width and height areas you have within the overall content view.
+ ///
+ /// The aspect ratio to maintain for some portion of the content view.
+ /// The extra size not to be included while maintaining the aspect ratio.
+ [SupportedOSPlatform("macos")]
public void SetAspectRatio(int aspectRatio, Size extraSize)
{
BridgeConnector.Emit("browserWindowSetAspectRatio", Id, aspectRatio, extraSize);
}
+
+
+
///
/// Uses Quick Look to preview a file at a given path.
///
/// The absolute path to the file to preview with QuickLook. This is important as
/// Quick Look uses the file name and file extension on the path to determine the content type of the
/// file to open.
+ [SupportedOSPlatform("macos")]
public void PreviewFile(string path)
{
BridgeConnector.Emit("browserWindowPreviewFile", Id, path);
@@ -1104,6 +1147,7 @@ namespace ElectronNET.API
/// file to open.
/// The name of the file to display on the Quick Look modal view. This is
/// purely visual and does not affect the content type of the file. Defaults to path.
+ [SupportedOSPlatform("macos")]
public void PreviewFile(string path, string displayname)
{
BridgeConnector.Emit("browserWindowPreviewFile", Id, path, displayname);
@@ -1112,6 +1156,7 @@ namespace ElectronNET.API
///
/// Closes the currently open Quick Look panel.
///
+ [SupportedOSPlatform("macos")]
public void CloseFilePreview()
{
BridgeConnector.Emit("browserWindowCloseFilePreview", Id);
@@ -1131,6 +1176,7 @@ namespace ElectronNET.API
///
///
///
+ [SupportedOSPlatform("macos")]
public void SetBounds(Rectangle bounds, bool animate)
{
BridgeConnector.Emit("browserWindowSetBounds", Id, bounds, animate);
@@ -1159,6 +1205,7 @@ namespace ElectronNET.API
///
///
///
+ [SupportedOSPlatform("macos")]
public void SetContentBounds(Rectangle bounds, bool animate)
{
BridgeConnector.Emit("browserWindowSetContentBounds", Id, bounds, animate);
@@ -1189,6 +1236,7 @@ namespace ElectronNET.API
///
///
///
+ [SupportedOSPlatform("macos")]
public void SetSize(int width, int height, bool animate)
{
BridgeConnector.Emit("browserWindowSetSize", Id, width, height, animate);
@@ -1219,6 +1267,7 @@ namespace ElectronNET.API
///
///
///
+ [SupportedOSPlatform("macos")]
public void SetContentSize(int width, int height, bool animate)
{
BridgeConnector.Emit("browserWindowSetContentSize", Id, width, height, animate);
@@ -1293,6 +1342,8 @@ namespace ElectronNET.API
/// Sets whether the window can be moved by user. On Linux does nothing.
///
///
+ [SupportedOSPlatform("windows")]
+ [SupportedOSPlatform("macos")]
public void SetMovable(bool movable)
{
BridgeConnector.Emit("browserWindowSetMovable", Id, movable);
@@ -1300,10 +1351,10 @@ namespace ElectronNET.API
///
/// Whether the window can be moved by user.
- ///
- /// On Linux always returns true.
///
/// On Linux always returns true.
+ [SupportedOSPlatform("windows")]
+ [SupportedOSPlatform("macos")]
public Task IsMovableAsync()
{
return BridgeConnector.OnResult("browserWindowIsMovable", "browserWindow-isMovable-completed" + Id, Id);
@@ -1313,6 +1364,8 @@ namespace ElectronNET.API
/// Sets whether the window can be manually minimized by user. On Linux does nothing.
///
///
+ [SupportedOSPlatform("windows")]
+ [SupportedOSPlatform("macos")]
public void SetMinimizable(bool minimizable)
{
BridgeConnector.Emit("browserWindowSetMinimizable", Id, minimizable);
@@ -1320,10 +1373,10 @@ namespace ElectronNET.API
///
/// Whether the window can be manually minimized by user.
- ///
- /// On Linux always returns true.
///
/// On Linux always returns true.
+ [SupportedOSPlatform("windows")]
+ [SupportedOSPlatform("macos")]
public Task IsMinimizableAsync()
{
return BridgeConnector.OnResult("browserWindowIsMinimizable", "browserWindow-isMinimizable-completed" + Id, Id);
@@ -1333,6 +1386,8 @@ namespace ElectronNET.API
/// Sets whether the window can be manually maximized by user. On Linux does nothing.
///
///
+ [SupportedOSPlatform("windows")]
+ [SupportedOSPlatform("macos")]
public void SetMaximizable(bool maximizable)
{
BridgeConnector.Emit("browserWindowSetMaximizable", Id, maximizable);
@@ -1340,10 +1395,10 @@ namespace ElectronNET.API
///
/// Whether the window can be manually maximized by user.
- ///
- /// On Linux always returns true.
///
/// On Linux always returns true.
+ [SupportedOSPlatform("windows")]
+ [SupportedOSPlatform("macos")]
public Task IsMaximizableAsync()
{
return BridgeConnector.OnResult("browserWindowIsMaximizable", "browserWindow-isMaximizable-completed" + Id, Id);
@@ -1371,6 +1426,8 @@ namespace ElectronNET.API
/// Sets whether the window can be manually closed by user. On Linux does nothing.
///
///
+ [SupportedOSPlatform("windows")]
+ [SupportedOSPlatform("macos")]
public void SetClosable(bool closable)
{
BridgeConnector.Emit("browserWindowSetClosable", Id, closable);
@@ -1378,10 +1435,10 @@ namespace ElectronNET.API
///
/// Whether the window can be manually closed by user.
- ///
- /// On Linux always returns true.
///
/// On Linux always returns true.
+ [SupportedOSPlatform("windows")]
+ [SupportedOSPlatform("macos")]
public Task IsClosableAsync()
{
return BridgeConnector.OnResult("browserWindowIsClosable", "browserWindow-isClosable-completed" + Id, Id);
@@ -1407,6 +1464,8 @@ namespace ElectronNET.API
/// Values include normal, floating, torn-off-menu, modal-panel, main-menu,
/// status, pop-up-menu and screen-saver. The default is floating.
/// See the macOS docs
+ [SupportedOSPlatform("windows")]
+ [SupportedOSPlatform("macos")]
public void SetAlwaysOnTop(bool flag, OnTopLevel level)
{
BridgeConnector.Emit("browserWindowSetAlwaysOnTop", Id, flag, level.GetDescription());
@@ -1423,6 +1482,7 @@ namespace ElectronNET.API
/// See the macOS docs
/// The number of layers higher to set this window relative to the given level.
/// The default is 0. Note that Apple discourages setting levels higher than 1 above screen-saver.
+ [SupportedOSPlatform("macos")]
public void SetAlwaysOnTop(bool flag, OnTopLevel level, int relativeLevel)
{
BridgeConnector.Emit("browserWindowSetAlwaysOnTop", Id, flag, level.GetDescription(), relativeLevel);
@@ -1468,6 +1528,7 @@ namespace ElectronNET.API
///
///
///
+ [SupportedOSPlatform("macos")]
public void SetPosition(int x, int y, bool animate)
{
// Workaround Windows 10 / Electron Bug
@@ -1482,7 +1543,7 @@ namespace ElectronNET.API
private bool isWindows10()
{
- return RuntimeInformation.OSDescription.Contains("Windows 10");
+ return OperatingSystem.IsWindowsVersionAtLeast(10);
}
///
@@ -1520,6 +1581,7 @@ namespace ElectronNET.API
/// but you may want to display them beneath a HTML-rendered toolbar.
///
///
+ [SupportedOSPlatform("macos")]
public void SetSheetOffset(float offsetY)
{
BridgeConnector.Emit("browserWindowSetSheetOffset", Id, offsetY);
@@ -1532,6 +1594,7 @@ namespace ElectronNET.API
///
///
///
+ [SupportedOSPlatform("macos")]
public void SetSheetOffset(float offsetY, float offsetX)
{
BridgeConnector.Emit("browserWindowSetSheetOffset", Id, offsetY, offsetX);
@@ -1587,6 +1650,7 @@ namespace ElectronNET.API
/// and the icon of the file will show in window’s title bar.
///
///
+ [SupportedOSPlatform("macos")]
public void SetRepresentedFilename(string filename)
{
BridgeConnector.Emit("browserWindowSetRepresentedFilename", Id, filename);
@@ -1596,6 +1660,7 @@ namespace ElectronNET.API
/// The pathname of the file the window represents.
///
///
+ [SupportedOSPlatform("macos")]
public Task GetRepresentedFilenameAsync()
{
return BridgeConnector.OnResult("browserWindowGetRepresentedFilename", "browserWindow-getRepresentedFilename-completed" + Id, Id);
@@ -1606,6 +1671,7 @@ namespace ElectronNET.API
/// and the icon in title bar will become gray when set to true.
///
///
+ [SupportedOSPlatform("macos")]
public void SetDocumentEdited(bool edited)
{
BridgeConnector.Emit("browserWindowSetDocumentEdited", Id, edited);
@@ -1615,6 +1681,7 @@ namespace ElectronNET.API
/// Whether the window’s document has been edited.
///
///
+ [SupportedOSPlatform("macos")]
public Task IsDocumentEditedAsync()
{
return BridgeConnector.OnResult("browserWindowIsDocumentEdited", "browserWindow-isDocumentEdited-completed" + Id, Id);
@@ -1679,6 +1746,8 @@ namespace ElectronNET.API
/// setting it to null will remove the menu bar.
///
///
+ [SupportedOSPlatform("windows")]
+ [SupportedOSPlatform("linux")]
public void SetMenu(MenuItem[] menuItems)
{
menuItems.AddMenuItemsId();
@@ -1696,6 +1765,8 @@ namespace ElectronNET.API
///
/// Remove the window's menu bar.
///
+ [SupportedOSPlatform("windows")]
+ [SupportedOSPlatform("linux")]
public void RemoveMenu()
{
BridgeConnector.Emit("browserWindowRemoveMenu", Id);
@@ -1729,6 +1800,7 @@ namespace ElectronNET.API
///
///
///
+ [SupportedOSPlatform("windows")]
public void SetProgressBar(double progress, ProgressBarOptions progressBarOptions)
{
BridgeConnector.Emit("browserWindowSetProgressBar", Id, progress, progressBarOptions);
@@ -1776,6 +1848,7 @@ namespace ElectronNET.API
///
///
/// Whether the buttons were added successfully.
+ [SupportedOSPlatform("windows")]
public Task SetThumbarButtonsAsync(ThumbarButton[] thumbarButtons)
{
var taskCompletionSource = new TaskCompletionSource(TaskCreationOptions.RunContinuationsAsynchronously);
@@ -1808,6 +1881,7 @@ namespace ElectronNET.API
/// an empty region: {x: 0, y: 0, width: 0, height: 0}.
///
///
+ [SupportedOSPlatform("windows")]
public void SetThumbnailClip(Rectangle rectangle)
{
BridgeConnector.Emit("browserWindowSetThumbnailClip", Id, rectangle);
@@ -1817,6 +1891,7 @@ namespace ElectronNET.API
/// Sets the toolTip that is displayed when hovering over the window thumbnail in the taskbar.
///
///
+ [SupportedOSPlatform("windows")]
public void SetThumbnailToolTip(string tooltip)
{
BridgeConnector.Emit("browserWindowSetThumbnailToolTip", Id, tooltip);
@@ -1829,6 +1904,7 @@ namespace ElectronNET.API
/// If one of those properties is not set, then neither will be used.
///
///
+ [SupportedOSPlatform("windows")]
public void SetAppDetails(AppDetailsOptions options)
{
BridgeConnector.Emit("browserWindowSetAppDetails", Id, options);
@@ -1837,6 +1913,7 @@ namespace ElectronNET.API
///
/// Same as webContents.showDefinitionForSelection().
///
+ [SupportedOSPlatform("macos")]
public void ShowDefinitionForSelection()
{
BridgeConnector.Emit("browserWindowShowDefinitionForSelection", Id);
@@ -1868,6 +1945,8 @@ namespace ElectronNET.API
/// users can still bring up the menu bar by pressing the single Alt key.
///
///
+ [SupportedOSPlatform("windows")]
+ [SupportedOSPlatform("linux")]
public void SetMenuBarVisibility(bool visible)
{
BridgeConnector.Emit("browserWindowSetMenuBarVisibility", Id, visible);
@@ -1877,6 +1956,8 @@ namespace ElectronNET.API
/// Whether the menu bar is visible.
///
///
+ [SupportedOSPlatform("windows")]
+ [SupportedOSPlatform("linux")]
public Task IsMenuBarVisibleAsync()
{
return BridgeConnector.OnResult("browserWindowIsMenuBarVisible", "browserWindow-isMenuBarVisible-completed" + Id, Id);
@@ -1923,6 +2004,8 @@ namespace ElectronNET.API
/// On Windows it calls SetWindowDisplayAffinity with WDA_MONITOR.
///
///
+ [SupportedOSPlatform("windows")]
+ [SupportedOSPlatform("macos")]
public void SetContentProtection(bool enable)
{
BridgeConnector.Emit("browserWindowSetContentProtection", Id, enable);
@@ -1932,6 +2015,8 @@ namespace ElectronNET.API
/// Changes whether the window can be focused.
///
///
+ [SupportedOSPlatform("windows")]
+ [SupportedOSPlatform("macos")]
public void SetFocusable(bool focusable)
{
BridgeConnector.Emit("browserWindowSetFocusable", Id, focusable);
@@ -1971,6 +2056,7 @@ namespace ElectronNET.API
/// Controls whether to hide cursor when typing.
///
///
+ [SupportedOSPlatform("macos")]
public void SetAutoHideCursor(bool autoHide)
{
BridgeConnector.Emit("browserWindowSetAutoHideCursor", Id, autoHide);
@@ -1983,6 +2069,7 @@ namespace ElectronNET.API
/// Can be appearance-based, light, dark, titlebar, selection,
/// menu, popover, sidebar, medium-light or ultra-dark.
/// See the macOS documentation for more details.
+ [SupportedOSPlatform("macos")]
public void SetVibrancy(Vibrancy type)
{
BridgeConnector.Emit("browserWindowSetVibrancy", Id, type.GetDescription());
diff --git a/ElectronNET.API/Clipboard.cs b/ElectronNET.API/Clipboard.cs
index b757bb0..f9e0fb4 100644
--- a/ElectronNET.API/Clipboard.cs
+++ b/ElectronNET.API/Clipboard.cs
@@ -2,6 +2,7 @@
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using Newtonsoft.Json.Serialization;
+using System.Runtime.Versioning;
using System.Threading.Tasks;
namespace ElectronNET.API
@@ -93,6 +94,8 @@ namespace ElectronNET.API
/// be empty strings when the bookmark is unavailable.
///
///
+ [SupportedOSPlatform("windows")]
+ [SupportedOSPlatform("macos")]
public Task ReadBookmarkAsync() => BridgeConnector.OnResult("clipboard-readBookmark", "clipboard-readBookmark-Completed");
///
@@ -105,6 +108,8 @@ namespace ElectronNET.API
///
///
///
+ [SupportedOSPlatform("windows")]
+ [SupportedOSPlatform("macos")]
public void WriteBookmark(string title, string url, string type = "")
{
BridgeConnector.Emit("clipboard-writeBookmark", title, url, type);
@@ -116,6 +121,7 @@ namespace ElectronNET.API
/// find pasteboard whenever the application is activated.
///
///
+ [SupportedOSPlatform("macos")]
public Task ReadFindTextAsync() => BridgeConnector.OnResult("clipboard-readFindText", "clipboard-readFindText-Completed");
///
@@ -123,6 +129,7 @@ namespace ElectronNET.API
/// synchronous IPC when called from the renderer process.
///
///
+ [SupportedOSPlatform("macos")]
public void WriteFindText(string text)
{
BridgeConnector.Emit("clipboard-writeFindText", text);
diff --git a/ElectronNET.API/Dialog.cs b/ElectronNET.API/Dialog.cs
index a8ecb82..6011e1d 100644
--- a/ElectronNET.API/Dialog.cs
+++ b/ElectronNET.API/Dialog.cs
@@ -4,6 +4,7 @@ using Newtonsoft.Json.Linq;
using Newtonsoft.Json.Serialization;
using System;
using System.Collections.Generic;
+using System.Runtime.Versioning;
using System.Threading.Tasks;
using System.Web;
@@ -191,6 +192,8 @@ namespace ElectronNET.API
///
///
///
+ [SupportedOSPlatform("windows")]
+ [SupportedOSPlatform("macos")]
public Task ShowCertificateTrustDialogAsync(CertificateTrustDialogOptions options)
{
return ShowCertificateTrustDialogAsync(null, options);
@@ -204,6 +207,8 @@ namespace ElectronNET.API
///
///
///
+ [SupportedOSPlatform("windows")]
+ [SupportedOSPlatform("macos")]
public Task ShowCertificateTrustDialogAsync(BrowserWindow browserWindow, CertificateTrustDialogOptions options)
{
var taskCompletionSource = new TaskCompletionSource