Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions src/ElectronNET.API/API/ApiBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -116,14 +116,19 @@ protected void CallMethod3(object val1, object val2, object val3, [CallerMemberN
}

protected Task<T> InvokeAsync<T>(object arg = null, [CallerMemberName] string callerName = null)
{
return this.InvokeAsyncWithTimeout<T>(InvocationTimeout, arg, callerName);
}

protected Task<T> InvokeAsyncWithTimeout<T>(int invocationTimeout, object arg = null, [CallerMemberName] string callerName = null)
{
Debug.Assert(callerName != null, nameof(callerName) + " != null");

lock (this.objLock)
{
return this.invocators.GetOrAdd(callerName, _ =>
{
var getter = new Invocator<T>(this, callerName, InvocationTimeout, arg);
var getter = new Invocator<T>(this, callerName, invocationTimeout, arg);

getter.Task<T>().ContinueWith(_ =>
{
Expand Down Expand Up @@ -301,7 +306,7 @@ public Invocator(ApiBase apiBase, string callerName, int timeoutMs, object arg =
_ = apiBase.Id >= 0 ? BridgeConnector.Socket.Emit(messageName, apiBase.Id) : BridgeConnector.Socket.Emit(messageName);
}

System.Threading.Tasks.Task.Delay(InvocationTimeout).ContinueWith(_ =>
System.Threading.Tasks.Task.Delay(timeoutMs).ContinueWith(_ =>
{
if (this.tcs != null)
{
Expand Down
4 changes: 2 additions & 2 deletions src/ElectronNET.API/API/App.cs
Original file line number Diff line number Diff line change
Expand Up @@ -539,7 +539,7 @@ public async Task<string> GetPathAsync(PathName pathName, CancellationToken canc
using (cancellationToken.Register(() => taskCompletionSource.TrySetCanceled()))
{
BridgeConnector.Socket.Once<string>("appGetPathCompleted", taskCompletionSource.SetResult);
BridgeConnector.Socket.Emit("appGetPath", pathName.GetDescription());
BridgeConnector.Socket.Emit("appGetPath", pathName);

return await taskCompletionSource.Task
.ConfigureAwait(false);
Expand All @@ -560,7 +560,7 @@ public async Task<string> GetPathAsync(PathName pathName, CancellationToken canc
/// </summary>
public void SetPath(PathName name, string path)
{
this.CallMethod2(name.GetDescription(), path);
this.CallMethod2(name, path);
}

/// <summary>
Expand Down
6 changes: 3 additions & 3 deletions src/ElectronNET.API/API/BrowserWindow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -681,7 +681,7 @@ public void SetAspectRatio(int aspectRatio, Size extraSize) =>
/// <param name="level">Values include normal, floating, torn-off-menu, modal-panel, main-menu,
/// status, pop-up-menu and screen-saver. The default is floating.
/// See the macOS docs</param>
public void SetAlwaysOnTop(bool flag, OnTopLevel level) => this.CallMethod2(flag, level.GetDescription());
public void SetAlwaysOnTop(bool flag, OnTopLevel level) => this.CallMethod2(flag, level);

/// <summary>
/// Sets whether the window should show always on top of other windows.
Expand All @@ -694,7 +694,7 @@ public void SetAspectRatio(int aspectRatio, Size extraSize) =>
/// See the macOS docs</param>
/// <param name="relativeLevel">The number of layers higher to set this window relative to the given level.
/// The default is 0. Note that Apple discourages setting levels higher than 1 above screen-saver.</param>
public void SetAlwaysOnTop(bool flag, OnTopLevel level, int relativeLevel) => this.CallMethod3(flag, level.GetDescription(), relativeLevel);
public void SetAlwaysOnTop(bool flag, OnTopLevel level, int relativeLevel) => this.CallMethod3(flag, level, relativeLevel);

/// <summary>
/// Whether the window is always on top of other windows.
Expand Down Expand Up @@ -1190,7 +1190,7 @@ public async Task<List<BrowserWindow>> GetChildWindowsAsync()
/// menu, popover, sidebar, medium-light or ultra-dark.
/// See the macOS documentation for more details.</param>
[SupportedOSPlatform("macOS")]
public void SetVibrancy(Vibrancy type) => this.CallMethod1(type.GetDescription());
public void SetVibrancy(Vibrancy type) => this.CallMethod1(type);

/// <summary>
/// Render and control web pages.
Expand Down
2 changes: 1 addition & 1 deletion src/ElectronNET.API/API/Dock.cs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public async Task<int> BounceAsync(DockBounceType type, CancellationToken cancel
using (cancellationToken.Register(() => tcs.TrySetCanceled()))
{
BridgeConnector.Socket.Once<int>("dock-bounce-completed", tcs.SetResult);
BridgeConnector.Socket.Emit("dock-bounce", type.GetDescription());
BridgeConnector.Socket.Emit("dock-bounce", type);

return await tcs.Task
.ConfigureAwait(false);
Expand Down
22 changes: 16 additions & 6 deletions src/ElectronNET.API/API/Entities/AboutPanelOptions.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
namespace ElectronNET.API.Entities
using System.Runtime.Versioning;

namespace ElectronNET.API.Entities
{
/// <summary>
/// About panel options.
/// </summary>
/// <remarks>Up-to-date with Electron API 39.2</remarks>
public class AboutPanelOptions
{
/// <summary>
Expand All @@ -21,28 +24,35 @@ public class AboutPanelOptions
public string Copyright { get; set; }

/// <summary>
/// The app's build version number.
/// The app's build version number (macOS).
/// </summary>
[SupportedOSPlatform("macos")]
public string Version { get; set; }

/// <summary>
/// Credit information.
/// Credit information (macOS, Windows).
/// </summary>
[SupportedOSPlatform("macos")]
[SupportedOSPlatform("windows")]
public string Credits { get; set; }

/// <summary>
/// List of app authors.
/// List of app authors (Linux).
/// </summary>
[SupportedOSPlatform("linux")]
public string[] Authors { get; set; }

/// <summary>
/// The app's website.
/// The app's website (Linux).
/// </summary>
[SupportedOSPlatform("linux")]
public string Website { get; set; }

/// <summary>
/// Path to the app's icon. On Linux, will be shown as 64x64 pixels while retaining aspect ratio.
/// Path to the app's icon in a JPEG or PNG file format. On Linux, will be shown as 64x64 pixels while retaining aspect ratio. On Windows, a 48x48 PNG will result in the best visual quality.
/// </summary>
[SupportedOSPlatform("linux")]
[SupportedOSPlatform("windows")]
public string IconPath { get; set; }
}
}
13 changes: 8 additions & 5 deletions src/ElectronNET.API/API/Entities/AddRepresentationOptions.cs
Original file line number Diff line number Diff line change
@@ -1,32 +1,35 @@
using System.Text.Json.Serialization;

namespace ElectronNET.API.Entities
{
/// <summary>
///
/// </summary>
/// <remarks>Up-to-date with Electron API 39.2</remarks>
public class AddRepresentationOptions
{
/// <summary>
/// Gets or sets the width
/// Gets or sets the width in pixels. Defaults to 0. Required if a bitmap buffer is specified as <see cref="Buffer"/>.
/// </summary>
public int? Width { get; set; }

/// <summary>
/// Gets or sets the height
/// Gets or sets the height in pixels. Defaults to 0. Required if a bitmap buffer is specified as <see cref="Buffer"/>.
/// </summary>
public int? Height { get; set; }

/// <summary>
/// Gets or sets the scalefactor
/// Gets or sets the image scale factor. Defaults to 1.0.
/// </summary>
public float ScaleFactor { get; set; } = 1.0f;

/// <summary>
/// Gets or sets the buffer
/// Gets or sets the buffer containing the raw image data.
/// </summary>
public byte[] Buffer { get; set; }

/// <summary>
/// Gets or sets the dataURL
/// Gets or sets the data URL containing a base 64 encoded PNG or JPEG image.
/// </summary>
public string DataUrl { get; set; }
}
Expand Down
16 changes: 10 additions & 6 deletions src/ElectronNET.API/API/Entities/AppDetailsOptions.cs
Original file line number Diff line number Diff line change
@@ -1,32 +1,36 @@
namespace ElectronNET.API.Entities
using System.Runtime.Versioning;

namespace ElectronNET.API.Entities
{
/// <summary>
///
/// </summary>
/// <remarks>Up-to-date with Electron API 39.2</remarks>
[SupportedOSPlatform("windows")]
public class AppDetailsOptions
{
/// <summary>
/// Windows App User Model ID. It has to be set, otherwise the other options will have no effect.
/// Window's App User Model ID. It has to be set, otherwise the other options will have no effect.
/// </summary>
public string AppId { get; set; }

/// <summary>
/// Window’s Relaunch Icon.
/// Window's relaunch icon resource path.
/// </summary>
public string AppIconPath { get; set; }

/// <summary>
/// Index of the icon in appIconPath. Ignored when appIconPath is not set. Default is 0.
/// Index of the icon in <see cref="AppIconPath"/>. Ignored when <see cref="AppIconPath"/> is not set. Default is 0.
/// </summary>
public int AppIconIndex { get; set; }

/// <summary>
/// Window’s Relaunch Command.
/// Window's relaunch command.
/// </summary>
public string RelaunchCommand { get; set; }

/// <summary>
/// Window’s Relaunch Display Name.
/// Window's relaunch display name.
/// </summary>
public string RelaunchDisplayName { get; set; }
}
Expand Down
1 change: 1 addition & 0 deletions src/ElectronNET.API/API/Entities/AutoResizeOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ namespace ElectronNET.API.Entities
/// <summary>
///
/// </summary>
/// <remarks>Up-to-date with Electron API 39.2</remarks>
public class AutoResizeOptions
{
/// <summary>
Expand Down
3 changes: 2 additions & 1 deletion src/ElectronNET.API/API/Entities/BitmapOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@
/// <summary>
///
/// </summary>
/// <remarks>Up-to-date with Electron API 39.2</remarks>
public class BitmapOptions
{
/// <summary>
/// Gets or sets the scale factor
/// The image scale factor. Defaults to 1.0.
/// </summary>
public float ScaleFactor { get; set; } = 1.0f;
}
Expand Down
1 change: 1 addition & 0 deletions src/ElectronNET.API/API/Entities/Blob.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
/// <summary>
///
/// </summary>
/// <remarks>Up-to-date with Electron API 39.2</remarks>
public class Blob : IPostData
{
/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,26 @@
/// <summary>
///
/// </summary>
/// <remarks>Up-to-date with Electron API 39.2</remarks>
public class BrowserViewConstructorOptions
{
/// <summary>
/// See BrowserWindow.
/// Gets or sets the web preferences for the view (see WebPreferences).
/// </summary>
public WebPreferences WebPreferences { get; set; }

/// <summary>
/// A proxy to set on creation in the format host:port.
/// Gets or sets a proxy to use on creation in the format host:port.
/// The proxy can be alternatively set using the BrowserView.WebContents.SetProxyAsync function.
/// </summary>
/// <remarks>This is custom shortcut. Not part of the Electron API.</remarks>
public string Proxy { get; set; }

/// <summary>
/// The credentials of the Proxy in the format username:password.
/// Gets or sets the credentials of the proxy in the format username:password.
/// These will only be used if the Proxy field is also set.
/// </summary>
/// <remarks>This is custom shortcut. Not part of the Electron API.</remarks>
public string ProxyCredentials { get; set; }
}
}
Loading