Skip to content

Commit c92a54f

Browse files
authored
Merge pull request #949 from softworkz/submit_model_update
Update all model classes to Electron API 39.2
2 parents 4de7760 + 3821ca6 commit c92a54f

File tree

123 files changed

+1551
-546
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

123 files changed

+1551
-546
lines changed

src/ElectronNET.API/API/ApiBase.cs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,14 +116,19 @@ protected void CallMethod3(object val1, object val2, object val3, [CallerMemberN
116116
}
117117

118118
protected Task<T> InvokeAsync<T>(object arg = null, [CallerMemberName] string callerName = null)
119+
{
120+
return this.InvokeAsyncWithTimeout<T>(InvocationTimeout, arg, callerName);
121+
}
122+
123+
protected Task<T> InvokeAsyncWithTimeout<T>(int invocationTimeout, object arg = null, [CallerMemberName] string callerName = null)
119124
{
120125
Debug.Assert(callerName != null, nameof(callerName) + " != null");
121126

122127
lock (this.objLock)
123128
{
124129
return this.invocators.GetOrAdd(callerName, _ =>
125130
{
126-
var getter = new Invocator<T>(this, callerName, InvocationTimeout, arg);
131+
var getter = new Invocator<T>(this, callerName, invocationTimeout, arg);
127132

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

304-
System.Threading.Tasks.Task.Delay(InvocationTimeout).ContinueWith(_ =>
309+
System.Threading.Tasks.Task.Delay(timeoutMs).ContinueWith(_ =>
305310
{
306311
if (this.tcs != null)
307312
{

src/ElectronNET.API/API/App.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -539,7 +539,7 @@ public async Task<string> GetPathAsync(PathName pathName, CancellationToken canc
539539
using (cancellationToken.Register(() => taskCompletionSource.TrySetCanceled()))
540540
{
541541
BridgeConnector.Socket.Once<string>("appGetPathCompleted", taskCompletionSource.SetResult);
542-
BridgeConnector.Socket.Emit("appGetPath", pathName.GetDescription());
542+
BridgeConnector.Socket.Emit("appGetPath", pathName);
543543

544544
return await taskCompletionSource.Task
545545
.ConfigureAwait(false);
@@ -560,7 +560,7 @@ public async Task<string> GetPathAsync(PathName pathName, CancellationToken canc
560560
/// </summary>
561561
public void SetPath(PathName name, string path)
562562
{
563-
this.CallMethod2(name.GetDescription(), path);
563+
this.CallMethod2(name, path);
564564
}
565565

566566
/// <summary>

src/ElectronNET.API/API/BrowserWindow.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -681,7 +681,7 @@ public void SetAspectRatio(int aspectRatio, Size extraSize) =>
681681
/// <param name="level">Values include normal, floating, torn-off-menu, modal-panel, main-menu,
682682
/// status, pop-up-menu and screen-saver. The default is floating.
683683
/// See the macOS docs</param>
684-
public void SetAlwaysOnTop(bool flag, OnTopLevel level) => this.CallMethod2(flag, level.GetDescription());
684+
public void SetAlwaysOnTop(bool flag, OnTopLevel level) => this.CallMethod2(flag, level);
685685

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

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

11951195
/// <summary>
11961196
/// Render and control web pages.

src/ElectronNET.API/API/Dock.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ public async Task<int> BounceAsync(DockBounceType type, CancellationToken cancel
5757
using (cancellationToken.Register(() => tcs.TrySetCanceled()))
5858
{
5959
BridgeConnector.Socket.Once<int>("dock-bounce-completed", tcs.SetResult);
60-
BridgeConnector.Socket.Emit("dock-bounce", type.GetDescription());
60+
BridgeConnector.Socket.Emit("dock-bounce", type);
6161

6262
return await tcs.Task
6363
.ConfigureAwait(false);

src/ElectronNET.API/API/Entities/AboutPanelOptions.cs

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
1-
namespace ElectronNET.API.Entities
1+
using System.Runtime.Versioning;
2+
3+
namespace ElectronNET.API.Entities
24
{
35
/// <summary>
46
/// About panel options.
57
/// </summary>
8+
/// <remarks>Up-to-date with Electron API 39.2</remarks>
69
public class AboutPanelOptions
710
{
811
/// <summary>
@@ -21,28 +24,35 @@ public class AboutPanelOptions
2124
public string Copyright { get; set; }
2225

2326
/// <summary>
24-
/// The app's build version number.
27+
/// The app's build version number (macOS).
2528
/// </summary>
29+
[SupportedOSPlatform("macos")]
2630
public string Version { get; set; }
2731

2832
/// <summary>
29-
/// Credit information.
33+
/// Credit information (macOS, Windows).
3034
/// </summary>
35+
[SupportedOSPlatform("macos")]
36+
[SupportedOSPlatform("windows")]
3137
public string Credits { get; set; }
3238

3339
/// <summary>
34-
/// List of app authors.
40+
/// List of app authors (Linux).
3541
/// </summary>
42+
[SupportedOSPlatform("linux")]
3643
public string[] Authors { get; set; }
3744

3845
/// <summary>
39-
/// The app's website.
46+
/// The app's website (Linux).
4047
/// </summary>
48+
[SupportedOSPlatform("linux")]
4149
public string Website { get; set; }
4250

4351
/// <summary>
44-
/// Path to the app's icon. On Linux, will be shown as 64x64 pixels while retaining aspect ratio.
52+
/// 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.
4553
/// </summary>
54+
[SupportedOSPlatform("linux")]
55+
[SupportedOSPlatform("windows")]
4656
public string IconPath { get; set; }
4757
}
4858
}

src/ElectronNET.API/API/Entities/AddRepresentationOptions.cs

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,35 @@
1+
using System.Text.Json.Serialization;
2+
13
namespace ElectronNET.API.Entities
24
{
35
/// <summary>
46
///
57
/// </summary>
8+
/// <remarks>Up-to-date with Electron API 39.2</remarks>
69
public class AddRepresentationOptions
710
{
811
/// <summary>
9-
/// Gets or sets the width
12+
/// Gets or sets the width in pixels. Defaults to 0. Required if a bitmap buffer is specified as <see cref="Buffer"/>.
1013
/// </summary>
1114
public int? Width { get; set; }
1215

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

1821
/// <summary>
19-
/// Gets or sets the scalefactor
22+
/// Gets or sets the image scale factor. Defaults to 1.0.
2023
/// </summary>
2124
public float ScaleFactor { get; set; } = 1.0f;
2225

2326
/// <summary>
24-
/// Gets or sets the buffer
27+
/// Gets or sets the buffer containing the raw image data.
2528
/// </summary>
2629
public byte[] Buffer { get; set; }
2730

2831
/// <summary>
29-
/// Gets or sets the dataURL
32+
/// Gets or sets the data URL containing a base 64 encoded PNG or JPEG image.
3033
/// </summary>
3134
public string DataUrl { get; set; }
3235
}

src/ElectronNET.API/API/Entities/AppDetailsOptions.cs

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,36 @@
1-
namespace ElectronNET.API.Entities
1+
using System.Runtime.Versioning;
2+
3+
namespace ElectronNET.API.Entities
24
{
35
/// <summary>
46
///
57
/// </summary>
8+
/// <remarks>Up-to-date with Electron API 39.2</remarks>
9+
[SupportedOSPlatform("windows")]
610
public class AppDetailsOptions
711
{
812
/// <summary>
9-
/// Windows App User Model ID. It has to be set, otherwise the other options will have no effect.
13+
/// Window's App User Model ID. It has to be set, otherwise the other options will have no effect.
1014
/// </summary>
1115
public string AppId { get; set; }
1216

1317
/// <summary>
14-
/// Window’s Relaunch Icon.
18+
/// Window's relaunch icon resource path.
1519
/// </summary>
1620
public string AppIconPath { get; set; }
1721

1822
/// <summary>
19-
/// Index of the icon in appIconPath. Ignored when appIconPath is not set. Default is 0.
23+
/// Index of the icon in <see cref="AppIconPath"/>. Ignored when <see cref="AppIconPath"/> is not set. Default is 0.
2024
/// </summary>
2125
public int AppIconIndex { get; set; }
2226

2327
/// <summary>
24-
/// Window’s Relaunch Command.
28+
/// Window's relaunch command.
2529
/// </summary>
2630
public string RelaunchCommand { get; set; }
2731

2832
/// <summary>
29-
/// Window’s Relaunch Display Name.
33+
/// Window's relaunch display name.
3034
/// </summary>
3135
public string RelaunchDisplayName { get; set; }
3236
}

src/ElectronNET.API/API/Entities/AutoResizeOptions.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ namespace ElectronNET.API.Entities
55
/// <summary>
66
///
77
/// </summary>
8+
/// <remarks>Up-to-date with Electron API 39.2</remarks>
89
public class AutoResizeOptions
910
{
1011
/// <summary>

src/ElectronNET.API/API/Entities/BitmapOptions.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,11 @@
33
/// <summary>
44
///
55
/// </summary>
6+
/// <remarks>Up-to-date with Electron API 39.2</remarks>
67
public class BitmapOptions
78
{
89
/// <summary>
9-
/// Gets or sets the scale factor
10+
/// The image scale factor. Defaults to 1.0.
1011
/// </summary>
1112
public float ScaleFactor { get; set; } = 1.0f;
1213
}

src/ElectronNET.API/API/Entities/Blob.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
/// <summary>
44
///
55
/// </summary>
6+
/// <remarks>Up-to-date with Electron API 39.2</remarks>
67
public class Blob : IPostData
78
{
89
/// <summary>

0 commit comments

Comments
 (0)