mirror of
https://github.com/ElectronNET/Electron.NET.git
synced 2026-02-12 13:44:34 +00:00
Compare commits
22 Commits
0.1.0
...
0.2.0-pre.
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
90c3eb2c88 | ||
|
|
dbf76a1d6d | ||
|
|
8e7892ebd4 | ||
|
|
30b547b8d3 | ||
|
|
30b4d92291 | ||
|
|
6c9027faf3 | ||
|
|
c712027ea3 | ||
|
|
7889057022 | ||
|
|
68c50f1c1e | ||
|
|
1006355bb7 | ||
|
|
12c5391164 | ||
|
|
8ba24c0f2f | ||
|
|
bb7ae8d711 | ||
|
|
385dcfbf52 | ||
|
|
515430ff96 | ||
|
|
a6d67a4dfe | ||
|
|
946b2af81a | ||
|
|
1e483e9cc4 | ||
|
|
5305e17ba9 | ||
|
|
442084a3e5 | ||
|
|
cd205edabb | ||
|
|
10bf461b51 |
85
.github/workflows/trailing-whitespace-check.yml
vendored
Normal file
85
.github/workflows/trailing-whitespace-check.yml
vendored
Normal file
@@ -0,0 +1,85 @@
|
||||
name: Trailing Whitespace Check
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
types: [opened, synchronize, reopened]
|
||||
|
||||
jobs:
|
||||
check-trailing-whitespace:
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Check for trailing whitespace
|
||||
run: |
|
||||
echo "Checking for trailing whitespace in changed files..."
|
||||
|
||||
# Get the base branch
|
||||
BASE_SHA="${{ github.event.pull_request.base.sha }}"
|
||||
HEAD_SHA="${{ github.event.pull_request.head.sha }}"
|
||||
|
||||
# Get list of changed files (excluding deleted files)
|
||||
CHANGED_FILES=$(git diff --name-only --diff-filter=d "$BASE_SHA" "$HEAD_SHA")
|
||||
|
||||
if [ -z "$CHANGED_FILES" ]; then
|
||||
echo "No files to check."
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# File patterns to check (text files)
|
||||
PATTERNS="\.cs$|\.csproj$|\.sln$|\.ts$|\.html$|\.css$|\.scss$"
|
||||
|
||||
# Directories and file patterns to exclude
|
||||
EXCLUDE_PATTERNS="(^|\/)(\.|node_modules|bin|obj|artifacts|packages|\.vs|\.nuke\/temp)($|\/)"
|
||||
|
||||
ERRORS_FOUND=0
|
||||
TEMP_FILE=$(mktemp)
|
||||
|
||||
while IFS= read -r file; do
|
||||
# Skip if file doesn't exist (shouldn't happen with --diff-filter=d, but just in case)
|
||||
if [ ! -f "$file" ]; then
|
||||
continue
|
||||
fi
|
||||
|
||||
# Check if file matches patterns to check
|
||||
if ! echo "$file" | grep -qE "$PATTERNS"; then
|
||||
continue
|
||||
fi
|
||||
|
||||
# Check if file should be excluded
|
||||
if echo "$file" | grep -qE "$EXCLUDE_PATTERNS"; then
|
||||
continue
|
||||
fi
|
||||
|
||||
# Find trailing whitespace lines, excluding XML doc placeholder lines that are exactly "/// " (one space)
|
||||
MATCHES=$(grep -n '[[:space:]]$' "$file" | grep -vE '^[0-9]+:[[:space:]]*/// $' || true)
|
||||
|
||||
if [ -n "$MATCHES" ]; then
|
||||
echo "❌ Trailing whitespace found in: $file"
|
||||
echo "$MATCHES" | head -10
|
||||
TOTAL=$(echo "$MATCHES" | wc -l)
|
||||
if [ "$TOTAL" -gt 10 ]; then
|
||||
echo " ... and $(($TOTAL - 10)) more lines"
|
||||
fi
|
||||
echo "1" >> "$TEMP_FILE"
|
||||
fi
|
||||
done <<< "$CHANGED_FILES"
|
||||
|
||||
ERRORS_FOUND=$(wc -l < "$TEMP_FILE" 2>/dev/null || echo "0")
|
||||
rm -f "$TEMP_FILE"
|
||||
|
||||
if [ "$ERRORS_FOUND" -gt 0 ]; then
|
||||
echo ""
|
||||
echo "❌ Found trailing whitespace in $ERRORS_FOUND file(s)."
|
||||
echo "Please remove trailing whitespace from the files listed above."
|
||||
exit 1
|
||||
else
|
||||
echo "✅ No trailing whitespace found in changed files."
|
||||
exit 0
|
||||
fi
|
||||
@@ -1,3 +1,9 @@
|
||||
# 0.2.0
|
||||
|
||||
## ElectronNET.Core
|
||||
|
||||
- Added `IsRunningBlazor` option to `BrowserWindowOptions` (#926)
|
||||
|
||||
# 0.1.0
|
||||
|
||||
## ElectronNET.Core
|
||||
|
||||
78
README.md
78
README.md
@@ -58,22 +58,22 @@ To do so, use the `UseElectron` extension method on a `WebApplicationBuilder`, a
|
||||
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 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 });
|
||||
public static async Task ElectronAppReady()
|
||||
{
|
||||
var browserWindow = await Electron.WindowManager.CreateWindowAsync(
|
||||
new BrowserWindowOptions { Show = false });
|
||||
|
||||
browserWindow.OnReadyToShow += () => browserWindow.Show();
|
||||
}
|
||||
browserWindow.OnReadyToShow += () => browserWindow.Show();
|
||||
}
|
||||
```
|
||||
|
||||
### Minimal API Example
|
||||
@@ -113,6 +113,56 @@ app.MapRazorPages();
|
||||
app.Run();
|
||||
```
|
||||
|
||||
### Blazor
|
||||
|
||||
For a project with Blazor you can use:
|
||||
|
||||
```cs
|
||||
using ElectronNET.API;
|
||||
using ElectronNET.API.Entities;
|
||||
|
||||
var builder = WebApplication.CreateBuilder(args);
|
||||
|
||||
builder.Services
|
||||
.AddRazorComponents()
|
||||
.AddInteractiveWebAssemblyComponents();
|
||||
|
||||
builder.Services.AddElectron(); // <-- might be useful to set up DI
|
||||
|
||||
builder.UseElectron(args, async () =>
|
||||
{
|
||||
var options = new BrowserWindowOptions {
|
||||
Show = false,
|
||||
AutoHideMenuBar = true,
|
||||
IsRunningBlazor = true, // <-- crucial
|
||||
};
|
||||
var browserWindow = await Electron.WindowManager.CreateWindowAsync(options);
|
||||
browserWindow.OnReadyToShow += () => browserWindow.Show();
|
||||
});
|
||||
|
||||
var app = builder.Build();
|
||||
|
||||
// Configure the HTTP request pipeline.
|
||||
if (app.Environment.IsDevelopment())
|
||||
{
|
||||
app.UseWebAssemblyDebugging();
|
||||
}
|
||||
else
|
||||
{
|
||||
app.UseExceptionHandler("/Error", createScopeForErrors: true);
|
||||
}
|
||||
|
||||
app.UseStaticFiles();
|
||||
app.UseAntiforgery();
|
||||
|
||||
app.MapRazorComponents<BlazorApp.Components.App>()
|
||||
.AddInteractiveWebAssemblyRenderMode();
|
||||
|
||||
app.Run();
|
||||
```
|
||||
|
||||
The `IsRunningBlazor` option makes sure to set up the renderer in a way that Blazor can just run without any interference. This includes things such as HMR for development.
|
||||
|
||||
## 🚀 Starting and Debugging the Application
|
||||
|
||||
Just press `F5` in Visual Studio or use dotnet for debugging.
|
||||
|
||||
@@ -54,7 +54,7 @@ Add the Electron.NET configuration to your `.csproj` file:
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="ElectronNET.Core" Version="0.1.0" />
|
||||
<PackageReference Include="ElectronNET.Core" Version="0.2.0" />
|
||||
</ItemGroup>
|
||||
```
|
||||
|
||||
|
||||
@@ -85,7 +85,7 @@ public sealed class ReleaseNotesParser
|
||||
|
||||
// Parse content.
|
||||
var notes = new List<string>();
|
||||
|
||||
|
||||
while (true)
|
||||
{
|
||||
// Sanity checks.
|
||||
|
||||
@@ -11,6 +11,8 @@
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.Build" Version="17.11.48" />
|
||||
<PackageReference Include="Microsoft.Build.Tasks.Core" Version="17.11.48" />
|
||||
<PackageReference Include="Nuke.Common" Version="9.0.4" />
|
||||
</ItemGroup>
|
||||
|
||||
|
||||
4
src/.editorconfig
Normal file
4
src/.editorconfig
Normal file
@@ -0,0 +1,4 @@
|
||||
[*.cs]
|
||||
|
||||
# CA1416: Validate platform compatibility
|
||||
dotnet_diagnostic.CA1416.severity = error
|
||||
@@ -1,4 +1,5 @@
|
||||
// ReSharper disable InconsistentNaming
|
||||
|
||||
namespace ElectronNET.API
|
||||
{
|
||||
using Common;
|
||||
@@ -17,6 +18,7 @@ namespace ElectronNET.API
|
||||
DashesLowerFirst,
|
||||
NoDashUpperFirst
|
||||
}
|
||||
|
||||
protected enum SocketTaskMessageNameTypes
|
||||
{
|
||||
DashesLowerFirst,
|
||||
@@ -29,15 +31,15 @@ namespace ElectronNET.API
|
||||
CamelCase,
|
||||
}
|
||||
|
||||
private const int PropertyTimeout = 1000;
|
||||
private const int InvocationTimeout = 1000;
|
||||
|
||||
private readonly string objectName;
|
||||
private readonly ConcurrentDictionary<string, PropertyGetter> propertyGetters;
|
||||
private readonly ConcurrentDictionary<string, string> propertyEventNames = new();
|
||||
private readonly ConcurrentDictionary<string, string> propertyMessageNames = new();
|
||||
private readonly ConcurrentDictionary<string, Invocator> invocators;
|
||||
private readonly ConcurrentDictionary<string, string> invocationEventNames = new();
|
||||
private readonly ConcurrentDictionary<string, string> invocationMessageNames = new();
|
||||
private readonly ConcurrentDictionary<string, string> methodMessageNames = new();
|
||||
private static readonly ConcurrentDictionary<string, EventContainer> eventContainers = new();
|
||||
private static readonly ConcurrentDictionary<string, ConcurrentDictionary<string, PropertyGetter>> AllPropertyGetters = new();
|
||||
private static readonly ConcurrentDictionary<string, ConcurrentDictionary<string, Invocator>> AllInvocators = new();
|
||||
|
||||
private readonly object objLock = new object();
|
||||
|
||||
@@ -58,7 +60,7 @@ namespace ElectronNET.API
|
||||
protected ApiBase()
|
||||
{
|
||||
this.objectName = this.GetType().Name.LowerFirst();
|
||||
propertyGetters = AllPropertyGetters.GetOrAdd(objectName, _ => new ConcurrentDictionary<string, PropertyGetter>());
|
||||
this.invocators = AllInvocators.GetOrAdd(this.objectName, _ => new ConcurrentDictionary<string, Invocator>());
|
||||
}
|
||||
|
||||
protected void CallMethod0([CallerMemberName] string callerName = null)
|
||||
@@ -113,21 +115,21 @@ namespace ElectronNET.API
|
||||
}
|
||||
}
|
||||
|
||||
protected Task<T> GetPropertyAsync<T>(object arg = null, [CallerMemberName] string callerName = null)
|
||||
protected Task<T> InvokeAsync<T>(object arg = null, [CallerMemberName] string callerName = null)
|
||||
{
|
||||
Debug.Assert(callerName != null, nameof(callerName) + " != null");
|
||||
|
||||
lock (this.objLock)
|
||||
{
|
||||
return this.propertyGetters.GetOrAdd(callerName, _ =>
|
||||
return this.invocators.GetOrAdd(callerName, _ =>
|
||||
{
|
||||
var getter = new PropertyGetter<T>(this, callerName, PropertyTimeout, arg);
|
||||
var getter = new Invocator<T>(this, callerName, InvocationTimeout, arg);
|
||||
|
||||
getter.Task<T>().ContinueWith(_ =>
|
||||
{
|
||||
lock (this.objLock)
|
||||
{
|
||||
return this.propertyGetters.TryRemove(callerName, out var _);
|
||||
return this.invocators.TryRemove(callerName, out var _);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -135,15 +137,15 @@ namespace ElectronNET.API
|
||||
}).Task<T>();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
protected void AddEvent(Action value, int? id = null, [CallerMemberName] string callerName = null)
|
||||
{
|
||||
Debug.Assert(callerName != null, nameof(callerName) + " != null");
|
||||
var eventName = EventName(callerName);
|
||||
|
||||
var eventKey = EventKey(eventName, id);
|
||||
var eventName = this.EventName(callerName);
|
||||
|
||||
lock (objLock)
|
||||
var eventKey = this.EventKey(eventName, id);
|
||||
|
||||
lock (this.objLock)
|
||||
{
|
||||
var container = eventContainers.GetOrAdd(eventKey, _ =>
|
||||
{
|
||||
@@ -156,14 +158,14 @@ namespace ElectronNET.API
|
||||
container.Register(value);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
protected void RemoveEvent(Action value, int? id = null, [CallerMemberName] string callerName = null)
|
||||
{
|
||||
Debug.Assert(callerName != null, nameof(callerName) + " != null");
|
||||
var eventName = EventName(callerName);
|
||||
var eventKey = EventKey(eventName, id);
|
||||
var eventName = this.EventName(callerName);
|
||||
var eventKey = this.EventKey(eventName, id);
|
||||
|
||||
lock (objLock)
|
||||
lock (this.objLock)
|
||||
{
|
||||
if (eventContainers.TryGetValue(eventKey, out var container) && !container.Unregister(value))
|
||||
{
|
||||
@@ -172,15 +174,15 @@ namespace ElectronNET.API
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
protected void AddEvent<T>(Action<T> value, int? id = null, [CallerMemberName] string callerName = null)
|
||||
{
|
||||
Debug.Assert(callerName != null, nameof(callerName) + " != null");
|
||||
|
||||
var eventName = EventName(callerName);
|
||||
var eventKey = EventKey(eventName, id);
|
||||
|
||||
lock (objLock)
|
||||
var eventName = this.EventName(callerName);
|
||||
var eventKey = this.EventKey(eventName, id);
|
||||
|
||||
lock (this.objLock)
|
||||
{
|
||||
var container = eventContainers.GetOrAdd(eventKey, _ =>
|
||||
{
|
||||
@@ -197,10 +199,10 @@ namespace ElectronNET.API
|
||||
protected void RemoveEvent<T>(Action<T> value, int? id = null, [CallerMemberName] string callerName = null)
|
||||
{
|
||||
Debug.Assert(callerName != null, nameof(callerName) + " != null");
|
||||
var eventName = EventName(callerName);
|
||||
var eventKey = EventKey(eventName, id);
|
||||
var eventName = this.EventName(callerName);
|
||||
var eventKey = this.EventKey(eventName, id);
|
||||
|
||||
lock (objLock)
|
||||
lock (this.objLock)
|
||||
{
|
||||
if (eventContainers.TryGetValue(eventKey, out var container) && !container.Unregister(value))
|
||||
{
|
||||
@@ -212,33 +214,33 @@ namespace ElectronNET.API
|
||||
|
||||
private string EventName(string callerName)
|
||||
{
|
||||
switch (SocketEventNameType)
|
||||
switch (this.SocketEventNameType)
|
||||
{
|
||||
case SocketEventNameTypes.DashedLower:
|
||||
return $"{objectName}-{callerName.ToDashedEventName()}";
|
||||
return $"{this.objectName}-{callerName.ToDashedEventName()}";
|
||||
case SocketEventNameTypes.CamelCase:
|
||||
return $"{objectName}-{callerName.ToCamelCaseEventName()}";
|
||||
return $"{this.objectName}-{callerName.ToCamelCaseEventName()}";
|
||||
default:
|
||||
throw new ArgumentOutOfRangeException();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private string EventKey(string eventName, int? id)
|
||||
{
|
||||
return string.Format(CultureInfo.InvariantCulture, "{0}{1:D}", eventName, id);
|
||||
}
|
||||
|
||||
internal abstract class PropertyGetter
|
||||
internal abstract class Invocator
|
||||
{
|
||||
public abstract Task<T> Task<T>();
|
||||
}
|
||||
|
||||
internal class PropertyGetter<T> : PropertyGetter
|
||||
internal class Invocator<T> : Invocator
|
||||
{
|
||||
private readonly Task<T> tcsTask;
|
||||
private TaskCompletionSource<T> tcs;
|
||||
|
||||
public PropertyGetter(ApiBase apiBase, string callerName, int timeoutMs, object arg = null)
|
||||
public Invocator(ApiBase apiBase, string callerName, int timeoutMs, object arg = null)
|
||||
{
|
||||
this.tcs = new TaskCompletionSource<T>(TaskCreationOptions.RunContinuationsAsynchronously);
|
||||
this.tcsTask = this.tcs.Task;
|
||||
@@ -249,22 +251,22 @@ namespace ElectronNET.API
|
||||
switch (apiBase.SocketTaskEventNameType)
|
||||
{
|
||||
case SocketTaskEventNameTypes.DashesLowerFirst:
|
||||
eventName = apiBase.propertyEventNames.GetOrAdd(callerName, s => $"{apiBase.objectName}-{s.StripAsync().LowerFirst()}-completed");
|
||||
eventName = apiBase.invocationEventNames.GetOrAdd(callerName, s => $"{apiBase.objectName}-{s.StripAsync().LowerFirst()}-completed");
|
||||
break;
|
||||
case SocketTaskEventNameTypes.NoDashUpperFirst:
|
||||
eventName = apiBase.propertyEventNames.GetOrAdd(callerName, s => $"{apiBase.objectName}{s.StripAsync()}Completed");
|
||||
eventName = apiBase.invocationEventNames.GetOrAdd(callerName, s => $"{apiBase.objectName}{s.StripAsync()}Completed");
|
||||
break;
|
||||
default:
|
||||
throw new ArgumentOutOfRangeException();
|
||||
}
|
||||
|
||||
|
||||
switch (apiBase.SocketTaskMessageNameType)
|
||||
{
|
||||
case SocketTaskMessageNameTypes.DashesLowerFirst:
|
||||
messageName = apiBase.propertyMessageNames.GetOrAdd(callerName, s => $"{apiBase.objectName}-{s.StripAsync().LowerFirst()}");
|
||||
messageName = apiBase.invocationMessageNames.GetOrAdd(callerName, s => $"{apiBase.objectName}-{s.StripAsync().LowerFirst()}");
|
||||
break;
|
||||
case SocketTaskMessageNameTypes.NoDashUpperFirst:
|
||||
messageName = apiBase.propertyMessageNames.GetOrAdd(callerName, s => apiBase.objectName + s.StripAsync());
|
||||
messageName = apiBase.invocationMessageNames.GetOrAdd(callerName, s => apiBase.objectName + s.StripAsync());
|
||||
break;
|
||||
default:
|
||||
throw new ArgumentOutOfRangeException();
|
||||
@@ -289,17 +291,17 @@ namespace ElectronNET.API
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
if (arg != null)
|
||||
{
|
||||
_ = apiBase.Id >= 0 ? BridgeConnector.Socket.Emit(messageName, apiBase.Id, arg) : BridgeConnector.Socket.Emit(messageName, arg);
|
||||
_ = apiBase.Id >= 0 ? BridgeConnector.Socket.Emit(messageName, apiBase.Id, arg) : BridgeConnector.Socket.Emit(messageName, arg);
|
||||
}
|
||||
else
|
||||
{
|
||||
_ = apiBase.Id >= 0 ? BridgeConnector.Socket.Emit(messageName, apiBase.Id) : BridgeConnector.Socket.Emit(messageName);
|
||||
_ = apiBase.Id >= 0 ? BridgeConnector.Socket.Emit(messageName, apiBase.Id) : BridgeConnector.Socket.Emit(messageName);
|
||||
}
|
||||
|
||||
System.Threading.Tasks.Task.Delay(PropertyTimeout).ContinueWith(_ =>
|
||||
System.Threading.Tasks.Task.Delay(InvocationTimeout).ContinueWith(_ =>
|
||||
{
|
||||
if (this.tcs != null)
|
||||
{
|
||||
@@ -321,7 +323,7 @@ namespace ElectronNET.API
|
||||
return this.tcsTask as Task<T1>;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[SuppressMessage("ReSharper", "InconsistentlySynchronizedField")]
|
||||
private class EventContainer
|
||||
{
|
||||
@@ -330,44 +332,44 @@ namespace ElectronNET.API
|
||||
|
||||
private Action<T> GetEventActionT<T>()
|
||||
{
|
||||
return (Action<T>)eventActionT;
|
||||
return (Action<T>)this.eventActionT;
|
||||
}
|
||||
|
||||
private void SetEventActionT<T>(Action<T> actionT)
|
||||
{
|
||||
eventActionT = actionT;
|
||||
this.eventActionT = actionT;
|
||||
}
|
||||
|
||||
public void OnEventAction() => eventAction?.Invoke();
|
||||
public void OnEventAction() => this.eventAction?.Invoke();
|
||||
|
||||
public void OnEventActionT<T>(T p) => GetEventActionT<T>()?.Invoke(p);
|
||||
public void OnEventActionT<T>(T p) => this.GetEventActionT<T>()?.Invoke(p);
|
||||
|
||||
public void Register(Action receiver)
|
||||
{
|
||||
eventAction += receiver;
|
||||
this.eventAction += receiver;
|
||||
}
|
||||
|
||||
public void Register<T>(Action<T> receiver)
|
||||
{
|
||||
var actionT = GetEventActionT<T>();
|
||||
var actionT = this.GetEventActionT<T>();
|
||||
actionT += receiver;
|
||||
SetEventActionT(actionT);
|
||||
this.SetEventActionT(actionT);
|
||||
}
|
||||
|
||||
public bool Unregister(Action receiver)
|
||||
{
|
||||
eventAction -= receiver;
|
||||
this.eventAction -= receiver;
|
||||
return this.eventAction != null;
|
||||
}
|
||||
|
||||
public bool Unregister<T>(Action<T> receiver)
|
||||
{
|
||||
var actionT = GetEventActionT<T>();
|
||||
var actionT = this.GetEventActionT<T>();
|
||||
actionT -= receiver;
|
||||
SetEventActionT(actionT);
|
||||
this.SetEventActionT(actionT);
|
||||
|
||||
return actionT != null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -58,7 +58,7 @@ namespace ElectronNET.API
|
||||
private event Action _windowAllClosed;
|
||||
|
||||
/// <summary>
|
||||
/// Emitted before the application starts closing its windows.
|
||||
/// Emitted before the application starts closing its windows.
|
||||
/// <para/>
|
||||
/// Note: If application quit was initiated by <see cref="AutoUpdater.QuitAndInstall"/> then <see cref="BeforeQuit"/>
|
||||
/// is emitted after emitting close event on all windows and closing them.
|
||||
@@ -366,7 +366,7 @@ namespace ElectronNET.API
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.GetPropertyAsync<string>();
|
||||
return this.InvokeAsync<string>();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -399,7 +399,6 @@ namespace ElectronNET.API
|
||||
private static object _syncRoot = new object();
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Try to close all windows. The <see cref="BeforeQuit"/> event will be emitted first. If all windows are successfully
|
||||
/// closed, the <see cref="WillQuit"/> event will be emitted and by default the application will terminate. This method
|
||||
@@ -501,7 +500,7 @@ namespace ElectronNET.API
|
||||
public async Task<string> GetAppPathAsync(CancellationToken cancellationToken = default)
|
||||
{
|
||||
cancellationToken.ThrowIfCancellationRequested();
|
||||
return await this.GetPropertyAsync<string>().ConfigureAwait(false);
|
||||
return await this.InvokeAsync<string>().ConfigureAwait(false);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -558,14 +557,14 @@ namespace ElectronNET.API
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The version of the loaded application. If no version is found in the application’s package.json file,
|
||||
/// The version of the loaded application. If no version is found in the application’s package.json file,
|
||||
/// the version of the current bundle or executable is returned.
|
||||
/// </summary>
|
||||
/// <returns>The version of the loaded application.</returns>
|
||||
public async Task<string> GetVersionAsync(CancellationToken cancellationToken = default)
|
||||
{
|
||||
cancellationToken.ThrowIfCancellationRequested();
|
||||
return await this.GetPropertyAsync<string>().ConfigureAwait(false);
|
||||
return await this.InvokeAsync<string>().ConfigureAwait(false);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -579,7 +578,7 @@ namespace ElectronNET.API
|
||||
public async Task<string> GetLocaleAsync(CancellationToken cancellationToken = default)
|
||||
{
|
||||
cancellationToken.ThrowIfCancellationRequested();
|
||||
return await this.GetPropertyAsync<string>().ConfigureAwait(false);
|
||||
return await this.InvokeAsync<string>().ConfigureAwait(false);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -850,7 +849,7 @@ namespace ElectronNET.API
|
||||
public async Task<JumpListSettings> GetJumpListSettingsAsync(CancellationToken cancellationToken = default)
|
||||
{
|
||||
cancellationToken.ThrowIfCancellationRequested();
|
||||
return await this.GetPropertyAsync<JumpListSettings>().ConfigureAwait(false);
|
||||
return await this.InvokeAsync<JumpListSettings>().ConfigureAwait(false);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -941,7 +940,7 @@ namespace ElectronNET.API
|
||||
public async Task<bool> HasSingleInstanceLockAsync(CancellationToken cancellationToken = default)
|
||||
{
|
||||
cancellationToken.ThrowIfCancellationRequested();
|
||||
return await this.GetPropertyAsync<bool>().ConfigureAwait(false);
|
||||
return await this.InvokeAsync<bool>().ConfigureAwait(false);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -980,7 +979,7 @@ namespace ElectronNET.API
|
||||
public async Task<string> GetCurrentActivityTypeAsync(CancellationToken cancellationToken = default)
|
||||
{
|
||||
cancellationToken.ThrowIfCancellationRequested();
|
||||
return await this.GetPropertyAsync<string>().ConfigureAwait(false);
|
||||
return await this.InvokeAsync<string>().ConfigureAwait(false);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -1043,7 +1042,7 @@ namespace ElectronNET.API
|
||||
public async Task<ProcessMetric[]> GetAppMetricsAsync(CancellationToken cancellationToken = default)
|
||||
{
|
||||
cancellationToken.ThrowIfCancellationRequested();
|
||||
return await this.GetPropertyAsync<ProcessMetric[]>().ConfigureAwait(false);
|
||||
return await this.InvokeAsync<ProcessMetric[]>().ConfigureAwait(false);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -1055,7 +1054,7 @@ namespace ElectronNET.API
|
||||
public async Task<GPUFeatureStatus> GetGpuFeatureStatusAsync(CancellationToken cancellationToken = default)
|
||||
{
|
||||
cancellationToken.ThrowIfCancellationRequested();
|
||||
return await this.GetPropertyAsync<GPUFeatureStatus>().ConfigureAwait(false);
|
||||
return await this.InvokeAsync<GPUFeatureStatus>().ConfigureAwait(false);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -1090,7 +1089,7 @@ namespace ElectronNET.API
|
||||
public async Task<int> GetBadgeCountAsync(CancellationToken cancellationToken = default)
|
||||
{
|
||||
cancellationToken.ThrowIfCancellationRequested();
|
||||
return await this.GetPropertyAsync<int>().ConfigureAwait(false);
|
||||
return await this.InvokeAsync<int>().ConfigureAwait(false);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -1105,7 +1104,7 @@ namespace ElectronNET.API
|
||||
public async Task<bool> IsUnityRunningAsync(CancellationToken cancellationToken = default)
|
||||
{
|
||||
cancellationToken.ThrowIfCancellationRequested();
|
||||
return await this.GetPropertyAsync<bool>().ConfigureAwait(false);
|
||||
return await this.InvokeAsync<bool>().ConfigureAwait(false);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -1166,7 +1165,7 @@ namespace ElectronNET.API
|
||||
public async Task<bool> IsAccessibilitySupportEnabledAsync(CancellationToken cancellationToken = default)
|
||||
{
|
||||
cancellationToken.ThrowIfCancellationRequested();
|
||||
return await this.GetPropertyAsync<bool>().ConfigureAwait(false);
|
||||
return await this.InvokeAsync<bool>().ConfigureAwait(false);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -1245,7 +1244,7 @@ namespace ElectronNET.API
|
||||
return Task.Run(() =>
|
||||
{
|
||||
var taskCompletionSource = new TaskCompletionSource<string>();
|
||||
|
||||
|
||||
BridgeConnector.Socket.Once<string>("appGetUserAgentFallbackCompleted", taskCompletionSource.SetResult);
|
||||
BridgeConnector.Socket.Emit("appGetUserAgentFallback");
|
||||
|
||||
@@ -1295,4 +1294,4 @@ namespace ElectronNET.API
|
||||
public async Task Once(string eventName, Action<object> action)
|
||||
=> await Events.Instance.Once(ModuleName, eventName, action).ConfigureAwait(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -10,7 +10,7 @@ namespace ElectronNET.API
|
||||
/// <summary>
|
||||
/// Enable apps to automatically update themselves. Based on electron-updater.
|
||||
/// </summary>
|
||||
public sealed class AutoUpdater: ApiBase
|
||||
public sealed class AutoUpdater : ApiBase
|
||||
{
|
||||
protected override SocketTaskEventNameTypes SocketTaskEventNameType => SocketTaskEventNameTypes.DashesLowerFirst;
|
||||
protected override SocketTaskMessageNameTypes SocketTaskMessageNameType => SocketTaskMessageNameTypes.DashesLowerFirst;
|
||||
@@ -23,7 +23,7 @@ namespace ElectronNET.API
|
||||
{
|
||||
get
|
||||
{
|
||||
return Task.Run(() => GetPropertyAsync<bool>()).Result;
|
||||
return Task.Run(() => this.InvokeAsync<bool>()).Result;
|
||||
}
|
||||
set
|
||||
{
|
||||
@@ -40,7 +40,7 @@ namespace ElectronNET.API
|
||||
{
|
||||
get
|
||||
{
|
||||
return Task.Run(() => GetPropertyAsync<bool>()).Result;
|
||||
return Task.Run(() => this.InvokeAsync<bool>()).Result;
|
||||
}
|
||||
set
|
||||
{
|
||||
@@ -49,7 +49,7 @@ namespace ElectronNET.API
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// *GitHub provider only.* Whether to allow update to pre-release versions.
|
||||
/// *GitHub provider only.* Whether to allow update to pre-release versions.
|
||||
/// Defaults to "true" if application version contains prerelease components (e.g. "0.12.1-alpha.1", here "alpha" is a prerelease component), otherwise "false".
|
||||
///
|
||||
/// If "true", downgrade will be allowed("allowDowngrade" will be set to "true").
|
||||
@@ -58,7 +58,7 @@ namespace ElectronNET.API
|
||||
{
|
||||
get
|
||||
{
|
||||
return Task.Run(() => GetPropertyAsync<bool>()).Result;
|
||||
return Task.Run(() => this.InvokeAsync<bool>()).Result;
|
||||
}
|
||||
set
|
||||
{
|
||||
@@ -67,14 +67,14 @@ namespace ElectronNET.API
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// *GitHub provider only.*
|
||||
/// *GitHub provider only.*
|
||||
/// Get all release notes (from current version to latest), not just the latest (Default is false).
|
||||
/// </summary>
|
||||
public bool FullChangelog
|
||||
{
|
||||
get
|
||||
{
|
||||
return Task.Run(() => GetPropertyAsync<bool>()).Result;
|
||||
return Task.Run(() => this.InvokeAsync<bool>()).Result;
|
||||
}
|
||||
set
|
||||
{
|
||||
@@ -91,7 +91,7 @@ namespace ElectronNET.API
|
||||
{
|
||||
get
|
||||
{
|
||||
return Task.Run(() => GetPropertyAsync<bool>()).Result;
|
||||
return Task.Run(() => this.InvokeAsync<bool>()).Result;
|
||||
}
|
||||
set
|
||||
{
|
||||
@@ -106,7 +106,7 @@ namespace ElectronNET.API
|
||||
{
|
||||
get
|
||||
{
|
||||
return Task.Run(() => GetPropertyAsync<string>()).Result;
|
||||
return Task.Run(() => this.InvokeAsync<string>()).Result;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -117,12 +117,12 @@ namespace ElectronNET.API
|
||||
{
|
||||
get
|
||||
{
|
||||
return Task.Run(() => GetPropertyAsync<SemVer>());
|
||||
return Task.Run(() => this.InvokeAsync<SemVer>());
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get the update channel. Not applicable for GitHub.
|
||||
/// Get the update channel. Not applicable for GitHub.
|
||||
/// Doesn’t return channel from the update configuration, only if was previously set.
|
||||
/// </summary>
|
||||
[Obsolete("Use the asynchronous version ChannelAsync instead")]
|
||||
@@ -135,19 +135,19 @@ namespace ElectronNET.API
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get the update channel. Not applicable for GitHub.
|
||||
/// Get the update channel. Not applicable for GitHub.
|
||||
/// Doesn’t return channel from the update configuration, only if was previously set.
|
||||
/// </summary>
|
||||
public Task<string> ChannelAsync
|
||||
{
|
||||
get
|
||||
{
|
||||
return Task.Run(() => GetPropertyAsync<string>());
|
||||
return Task.Run(() => this.InvokeAsync<string>());
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Set the update channel. Not applicable for GitHub.
|
||||
/// Set the update channel. Not applicable for GitHub.
|
||||
/// </summary>
|
||||
public string SetChannel
|
||||
{
|
||||
@@ -165,7 +165,7 @@ namespace ElectronNET.API
|
||||
{
|
||||
get
|
||||
{
|
||||
return Task.Run(() => GetPropertyAsync<Dictionary<string, string>>());
|
||||
return Task.Run(() => this.InvokeAsync<Dictionary<string, string>>());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -199,7 +199,7 @@ namespace ElectronNET.API
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Emitted when there is an available update.
|
||||
/// Emitted when there is an available update.
|
||||
/// The update is downloaded automatically if AutoDownload is true.
|
||||
/// </summary>
|
||||
public event Action<UpdateInfo> OnUpdateAvailable
|
||||
@@ -332,11 +332,11 @@ namespace ElectronNET.API
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Restarts the app and installs the update after it has been downloaded.
|
||||
/// It should only be called after `update-downloaded` has been emitted.
|
||||
///
|
||||
/// Note: QuitAndInstall() will close all application windows first and only emit `before-quit` event on `app` after that.
|
||||
/// This is different from the normal quit event sequence.
|
||||
/// Restarts the app and installs the update after it has been downloaded.
|
||||
/// It should only be called after `update-downloaded` has been emitted.
|
||||
///
|
||||
/// Note: QuitAndInstall() will close all application windows first and only emit `before-quit` event on `app` after that.
|
||||
/// This is different from the normal quit event sequence.
|
||||
/// </summary>
|
||||
/// <param name="isSilent">*windows-only* Runs the installer in silent mode. Defaults to `false`.</param>
|
||||
/// <param name="isForceRunAfter">Run the app after finish even on silent install. Not applicable for macOS. Ignored if `isSilent` is set to `false`.</param>
|
||||
@@ -374,9 +374,5 @@ namespace ElectronNET.API
|
||||
|
||||
return tcs.Task;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -8,10 +8,11 @@ namespace ElectronNET.API
|
||||
/// It is like a child window, except that it is positioned relative to its owning window.
|
||||
/// It is meant to be an alternative to the webview tag.
|
||||
/// </summary>
|
||||
public class BrowserView: ApiBase
|
||||
public class BrowserView : ApiBase
|
||||
{
|
||||
protected override SocketTaskEventNameTypes SocketTaskEventNameType => SocketTaskEventNameTypes.DashesLowerFirst;
|
||||
protected override SocketTaskMessageNameTypes SocketTaskMessageNameType => SocketTaskMessageNameTypes.DashesLowerFirst;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the identifier.
|
||||
/// </summary>
|
||||
@@ -30,7 +31,7 @@ namespace ElectronNET.API
|
||||
{
|
||||
get
|
||||
{
|
||||
return Task.Run(() => GetPropertyAsync<Rectangle>()).Result;
|
||||
return Task.Run(() => this.InvokeAsync<Rectangle>()).Result;
|
||||
}
|
||||
set
|
||||
{
|
||||
@@ -69,5 +70,4 @@ namespace ElectronNET.API
|
||||
BridgeConnector.Socket.Emit("browserView-setBackgroundColor", Id, color);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -27,7 +27,7 @@ public class BrowserWindow : ApiBase
|
||||
public override int Id { get; protected set; }
|
||||
|
||||
/// <summary>
|
||||
/// Emitted when the web page has been rendered (while not being shown) and
|
||||
/// Emitted when the web page has been rendered (while not being shown) and
|
||||
/// window can be displayed without a visual flash.
|
||||
/// </summary>
|
||||
public event Action OnReadyToShow
|
||||
@@ -55,8 +55,8 @@ public class BrowserWindow : ApiBase
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Emitted when the window is closed.
|
||||
/// After you have received this event you should remove the
|
||||
/// Emitted when the window is closed.
|
||||
/// After you have received this event you should remove the
|
||||
/// reference to the window and avoid using it any more.
|
||||
/// </summary>
|
||||
public event Action OnClosed
|
||||
@@ -230,12 +230,12 @@ public class BrowserWindow : ApiBase
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Emitted when an App Command is invoked. These are typically related to
|
||||
/// keyboard media keys or browser commands, as well as the “Back” button
|
||||
/// Emitted when an App Command is invoked. These are typically related to
|
||||
/// keyboard media keys or browser commands, as well as the “Back” button
|
||||
/// built into some mice on Windows.
|
||||
///
|
||||
/// Commands are lowercased, underscores are replaced with hyphens,
|
||||
/// and the APPCOMMAND_ prefix is stripped off.e.g.APPCOMMAND_BROWSER_BACKWARD
|
||||
/// Commands are lowercased, underscores are replaced with hyphens,
|
||||
/// and the APPCOMMAND_ prefix is stripped off.e.g.APPCOMMAND_BROWSER_BACKWARD
|
||||
/// is emitted as browser-backward.
|
||||
/// </summary>
|
||||
public event Action<string> OnAppCommand
|
||||
@@ -287,15 +287,15 @@ public class BrowserWindow : ApiBase
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Force closing the window, the unload and beforeunload event won’t be
|
||||
/// emitted for the web page, and close event will also not be emitted
|
||||
/// Force closing the window, the unload and beforeunload event won’t be
|
||||
/// emitted for the web page, and close event will also not be emitted
|
||||
/// for this window, but it guarantees the closed event will be emitted.
|
||||
/// </summary>
|
||||
public void Destroy() => this.CallMethod0();
|
||||
|
||||
/// <summary>
|
||||
/// Try to close the window. This has the same effect as a user manually
|
||||
/// clicking the close button of the window. The web page may cancel the close though.
|
||||
/// Try to close the window. This has the same effect as a user manually
|
||||
/// clicking the close button of the window. The web page may cancel the close though.
|
||||
/// </summary>
|
||||
public void Close() => this.CallMethod0();
|
||||
|
||||
@@ -313,13 +313,13 @@ public class BrowserWindow : ApiBase
|
||||
/// Whether the window is focused.
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public Task<bool> IsFocusedAsync() => this.GetPropertyAsync<bool>();
|
||||
public Task<bool> IsFocusedAsync() => this.InvokeAsync<bool>();
|
||||
|
||||
/// <summary>
|
||||
/// Whether the window is destroyed.
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public Task<bool> IsDestroyedAsync() => this.GetPropertyAsync<bool>();
|
||||
public Task<bool> IsDestroyedAsync() => this.InvokeAsync<bool>();
|
||||
|
||||
/// <summary>
|
||||
/// Shows and gives focus to the window.
|
||||
@@ -340,13 +340,13 @@ public class BrowserWindow : ApiBase
|
||||
/// Whether the window is visible to the user.
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public Task<bool> IsVisibleAsync() => this.GetPropertyAsync<bool>();
|
||||
public Task<bool> IsVisibleAsync() => this.InvokeAsync<bool>();
|
||||
|
||||
/// <summary>
|
||||
/// Whether current window is a modal window.
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public Task<bool> IsModalAsync() => this.GetPropertyAsync<bool>();
|
||||
public Task<bool> IsModalAsync() => this.InvokeAsync<bool>();
|
||||
|
||||
/// <summary>
|
||||
/// Maximizes the window. This will also show (but not focus) the window if it isn’t being displayed already.
|
||||
@@ -362,7 +362,7 @@ public class BrowserWindow : ApiBase
|
||||
/// Whether the window is maximized.
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public Task<bool> IsMaximizedAsync() => this.GetPropertyAsync<bool>();
|
||||
public Task<bool> IsMaximizedAsync() => this.InvokeAsync<bool>();
|
||||
|
||||
/// <summary>
|
||||
/// Minimizes the window. On some platforms the minimized window will be shown in the Dock.
|
||||
@@ -378,7 +378,7 @@ public class BrowserWindow : ApiBase
|
||||
/// Whether the window is minimized.
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public Task<bool> IsMinimizedAsync() => this.GetPropertyAsync<bool>();
|
||||
public Task<bool> IsMinimizedAsync() => this.InvokeAsync<bool>();
|
||||
|
||||
/// <summary>
|
||||
/// Sets whether the window should be in fullscreen mode.
|
||||
@@ -390,10 +390,10 @@ public class BrowserWindow : ApiBase
|
||||
/// Whether the window is in fullscreen mode.
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public Task<bool> IsFullScreenAsync() => this.GetPropertyAsync<bool>();
|
||||
public Task<bool> IsFullScreenAsync() => this.InvokeAsync<bool>();
|
||||
|
||||
/// <summary>
|
||||
/// This will make a window maintain an aspect ratio. The extra size allows a developer to have space,
|
||||
/// This will make a window maintain an aspect ratio. The extra size allows a developer to have space,
|
||||
/// specified in pixels, not included within the aspect ratio calculations. This API already takes into
|
||||
/// account the difference between a window’s size and its content size.
|
||||
///
|
||||
@@ -401,7 +401,7 @@ public class BrowserWindow : ApiBase
|
||||
/// of controls on the left edge, 25 pixels of controls on the right edge and 50 pixels of controls below
|
||||
/// 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
|
||||
/// 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.
|
||||
/// </summary>
|
||||
/// <param name="aspectRatio">The aspect ratio to maintain for some portion of the content view.</param>
|
||||
@@ -410,7 +410,7 @@ public class BrowserWindow : ApiBase
|
||||
this.CallMethod2(aspectRatio, extraSize);
|
||||
|
||||
/// <summary>
|
||||
/// This will make a window maintain an aspect ratio. The extra size allows a developer to have space,
|
||||
/// This will make a window maintain an aspect ratio. The extra size allows a developer to have space,
|
||||
/// specified in pixels, not included within the aspect ratio calculations. This API already takes into
|
||||
/// account the difference between a window’s size and its content size.
|
||||
///
|
||||
@@ -418,7 +418,7 @@ public class BrowserWindow : ApiBase
|
||||
/// of controls on the left edge, 25 pixels of controls on the right edge and 50 pixels of controls below
|
||||
/// 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
|
||||
/// 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.
|
||||
/// </summary>
|
||||
/// <param name="aspectRatio">The aspect ratio to maintain for some portion of the content view.</param>
|
||||
@@ -429,18 +429,18 @@ public class BrowserWindow : ApiBase
|
||||
/// <summary>
|
||||
/// Uses Quick Look to preview a file at a given path.
|
||||
/// </summary>
|
||||
/// <param name="path">The absolute path to the file to preview with QuickLook. This is important as
|
||||
/// Quick Look uses the file name and file extension on the path to determine the content type of the
|
||||
/// <param name="path">The absolute path to the file to preview with QuickLook. This is important as
|
||||
/// Quick Look uses the file name and file extension on the path to determine the content type of the
|
||||
/// file to open.</param>
|
||||
public void PreviewFile(string path) => this.CallMethod1(path);
|
||||
|
||||
/// <summary>
|
||||
/// Uses Quick Look to preview a file at a given path.
|
||||
/// </summary>
|
||||
/// <param name="path">The absolute path to the file to preview with QuickLook. This is important as
|
||||
/// Quick Look uses the file name and file extension on the path to determine the content type of the
|
||||
/// <param name="path">The absolute path to the file to preview with QuickLook. This is important as
|
||||
/// Quick Look uses the file name and file extension on the path to determine the content type of the
|
||||
/// file to open.</param>
|
||||
/// <param name="displayname">The name of the file to display on the Quick Look modal view. This is
|
||||
/// <param name="displayname">The name of the file to display on the Quick Look modal view. This is
|
||||
/// purely visual and does not affect the content type of the file. Defaults to path.</param>
|
||||
public void PreviewFile(string path, string displayname) => this.CallMethod2(path, displayname);
|
||||
|
||||
@@ -466,7 +466,7 @@ public class BrowserWindow : ApiBase
|
||||
/// Gets the bounds asynchronous.
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public Task<Rectangle> GetBoundsAsync() => this.GetPropertyAsync<Rectangle>();
|
||||
public Task<Rectangle> GetBoundsAsync() => this.InvokeAsync<Rectangle>();
|
||||
|
||||
/// <summary>
|
||||
/// Resizes and moves the window’s client area (e.g. the web page) to the supplied bounds.
|
||||
@@ -485,7 +485,7 @@ public class BrowserWindow : ApiBase
|
||||
/// Gets the content bounds asynchronous.
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public Task<Rectangle> GetContentBoundsAsync() => this.GetPropertyAsync<Rectangle>();
|
||||
public Task<Rectangle> GetContentBoundsAsync() => this.InvokeAsync<Rectangle>();
|
||||
|
||||
/// <summary>
|
||||
/// Resizes the window to width and height.
|
||||
@@ -506,7 +506,7 @@ public class BrowserWindow : ApiBase
|
||||
/// Contains the window’s width and height.
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public Task<int[]> GetSizeAsync() => this.GetPropertyAsync<int[]>();
|
||||
public Task<int[]> GetSizeAsync() => this.InvokeAsync<int[]>();
|
||||
|
||||
/// <summary>
|
||||
/// Resizes the window’s client area (e.g. the web page) to width and height.
|
||||
@@ -527,7 +527,7 @@ public class BrowserWindow : ApiBase
|
||||
/// Contains the window’s client area’s width and height.
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public Task<int[]> GetContentSizeAsync() => this.GetPropertyAsync<int[]>();
|
||||
public Task<int[]> GetContentSizeAsync() => this.InvokeAsync<int[]>();
|
||||
|
||||
/// <summary>
|
||||
/// Sets the minimum size of window to width and height.
|
||||
@@ -540,7 +540,7 @@ public class BrowserWindow : ApiBase
|
||||
/// Contains the window’s minimum width and height.
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public Task<int[]> GetMinimumSizeAsync() => this.GetPropertyAsync<int[]>();
|
||||
public Task<int[]> GetMinimumSizeAsync() => this.InvokeAsync<int[]>();
|
||||
|
||||
/// <summary>
|
||||
/// Sets the maximum size of window to width and height.
|
||||
@@ -553,7 +553,7 @@ public class BrowserWindow : ApiBase
|
||||
/// Contains the window’s maximum width and height.
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public Task<int[]> GetMaximumSizeAsync() => this.GetPropertyAsync<int[]>();
|
||||
public Task<int[]> GetMaximumSizeAsync() => this.InvokeAsync<int[]>();
|
||||
|
||||
/// <summary>
|
||||
/// Sets whether the window can be manually resized by user.
|
||||
@@ -565,7 +565,7 @@ public class BrowserWindow : ApiBase
|
||||
/// Whether the window can be manually resized by user.
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public Task<bool> IsResizableAsync() => this.GetPropertyAsync<bool>();
|
||||
public Task<bool> IsResizableAsync() => this.InvokeAsync<bool>();
|
||||
|
||||
/// <summary>
|
||||
/// Sets whether the window can be moved by user. On Linux does nothing.
|
||||
@@ -579,7 +579,7 @@ public class BrowserWindow : ApiBase
|
||||
/// On Linux always returns true.
|
||||
/// </summary>
|
||||
/// <returns>On Linux always returns true.</returns>
|
||||
public Task<bool> IsMovableAsync() => this.GetPropertyAsync<bool>();
|
||||
public Task<bool> IsMovableAsync() => this.InvokeAsync<bool>();
|
||||
|
||||
/// <summary>
|
||||
/// Sets whether the window can be manually minimized by user. On Linux does nothing.
|
||||
@@ -593,7 +593,7 @@ public class BrowserWindow : ApiBase
|
||||
/// On Linux always returns true.
|
||||
/// </summary>
|
||||
/// <returns>On Linux always returns true.</returns>
|
||||
public Task<bool> IsMinimizableAsync() => this.GetPropertyAsync<bool>();
|
||||
public Task<bool> IsMinimizableAsync() => this.InvokeAsync<bool>();
|
||||
|
||||
/// <summary>
|
||||
/// Sets whether the window can be manually maximized by user. On Linux does nothing.
|
||||
@@ -607,7 +607,7 @@ public class BrowserWindow : ApiBase
|
||||
/// On Linux always returns true.
|
||||
/// </summary>
|
||||
/// <returns>On Linux always returns true.</returns>
|
||||
public Task<bool> IsMaximizableAsync() => this.GetPropertyAsync<bool>();
|
||||
public Task<bool> IsMaximizableAsync() => this.InvokeAsync<bool>();
|
||||
|
||||
/// <summary>
|
||||
/// Sets whether the maximize/zoom window button toggles fullscreen mode or maximizes the window.
|
||||
@@ -619,7 +619,7 @@ public class BrowserWindow : ApiBase
|
||||
/// Whether the maximize/zoom window button toggles fullscreen mode or maximizes the window.
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public Task<bool> IsFullScreenableAsync() => this.GetPropertyAsync<bool>();
|
||||
public Task<bool> IsFullScreenableAsync() => this.InvokeAsync<bool>();
|
||||
|
||||
/// <summary>
|
||||
/// Sets whether the window can be manually closed by user. On Linux does nothing.
|
||||
@@ -633,37 +633,37 @@ public class BrowserWindow : ApiBase
|
||||
/// On Linux always returns true.
|
||||
/// </summary>
|
||||
/// <returns>On Linux always returns true.</returns>
|
||||
public Task<bool> IsClosableAsync() => this.GetPropertyAsync<bool>();
|
||||
public Task<bool> IsClosableAsync() => this.InvokeAsync<bool>();
|
||||
|
||||
/// <summary>
|
||||
/// Sets whether the window should show always on top of other windows.
|
||||
/// After setting this, the window is still a normal window, not a toolbox
|
||||
/// Sets whether the window should show always on top of other windows.
|
||||
/// After setting this, the window is still a normal window, not a toolbox
|
||||
/// window which can not be focused on.
|
||||
/// </summary>
|
||||
/// <param name="flag"></param>
|
||||
public void SetAlwaysOnTop(bool flag) => this.CallMethod1(flag);
|
||||
|
||||
/// <summary>
|
||||
/// Sets whether the window should show always on top of other windows.
|
||||
/// After setting this, the window is still a normal window, not a toolbox
|
||||
/// Sets whether the window should show always on top of other windows.
|
||||
/// After setting this, the window is still a normal window, not a toolbox
|
||||
/// window which can not be focused on.
|
||||
/// </summary>
|
||||
/// <param name="flag"></param>
|
||||
/// <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.
|
||||
/// <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());
|
||||
|
||||
/// <summary>
|
||||
/// Sets whether the window should show always on top of other windows.
|
||||
/// After setting this, the window is still a normal window, not a toolbox
|
||||
/// Sets whether the window should show always on top of other windows.
|
||||
/// After setting this, the window is still a normal window, not a toolbox
|
||||
/// window which can not be focused on.
|
||||
/// </summary>
|
||||
/// <param name="flag"></param>
|
||||
/// <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.
|
||||
/// <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>
|
||||
/// <param name="relativeLevel">The number of layers higher to set this window relative to the given level.
|
||||
/// <param name="relativeLevel">The number of layers higher to set this window relative to the given level.
|
||||
/// The default is 0. Note that Apple discourages setting levels higher than 1 above screen-saver.</param>
|
||||
public void SetAlwaysOnTop(bool flag, OnTopLevel level, int relativeLevel) => this.CallMethod3(flag, level.GetDescription(), relativeLevel);
|
||||
|
||||
@@ -671,7 +671,7 @@ public class BrowserWindow : ApiBase
|
||||
/// Whether the window is always on top of other windows.
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public Task<bool> IsAlwaysOnTopAsync() => this.GetPropertyAsync<bool>();
|
||||
public Task<bool> IsAlwaysOnTopAsync() => this.InvokeAsync<bool>();
|
||||
|
||||
/// <summary>
|
||||
/// Moves window to the center of the screen.
|
||||
@@ -721,7 +721,7 @@ public class BrowserWindow : ApiBase
|
||||
/// Contains the window’s current position.
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public Task<int[]> GetPositionAsync() => this.GetPropertyAsync<int[]>();
|
||||
public Task<int[]> GetPositionAsync() => this.InvokeAsync<int[]>();
|
||||
|
||||
/// <summary>
|
||||
/// Changes the title of native window to title.
|
||||
@@ -735,19 +735,19 @@ public class BrowserWindow : ApiBase
|
||||
/// Note: The title of web page can be different from the title of the native window.
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public Task<string> GetTitleAsync() => this.GetPropertyAsync<string>();
|
||||
public Task<string> GetTitleAsync() => this.InvokeAsync<string>();
|
||||
|
||||
/// <summary>
|
||||
/// Changes the attachment point for sheets on macOS.
|
||||
/// By default, sheets are attached just below the window frame,
|
||||
/// Changes the attachment point for sheets on macOS.
|
||||
/// By default, sheets are attached just below the window frame,
|
||||
/// but you may want to display them beneath a HTML-rendered toolbar.
|
||||
/// </summary>
|
||||
/// <param name="offsetY"></param>
|
||||
public void SetSheetOffset(float offsetY) => this.CallMethod1(offsetY);
|
||||
|
||||
/// <summary>
|
||||
/// Changes the attachment point for sheets on macOS.
|
||||
/// By default, sheets are attached just below the window frame,
|
||||
/// Changes the attachment point for sheets on macOS.
|
||||
/// By default, sheets are attached just below the window frame,
|
||||
/// but you may want to display them beneath a HTML-rendered toolbar.
|
||||
/// </summary>
|
||||
/// <param name="offsetY"></param>
|
||||
@@ -776,16 +776,16 @@ public class BrowserWindow : ApiBase
|
||||
/// Whether the window is in kiosk mode.
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public Task<bool> IsKioskAsync() => this.GetPropertyAsync<bool>();
|
||||
public Task<bool> IsKioskAsync() => this.InvokeAsync<bool>();
|
||||
|
||||
/// <summary>
|
||||
/// Returns the native type of the handle is HWND on Windows, NSView* on macOS, and Window (unsigned long) on Linux.
|
||||
/// </summary>
|
||||
/// <returns>string of the native handle obtained, HWND on Windows, NSView* on macOS, and Window (unsigned long) on Linux.</returns>
|
||||
public Task<string> GetNativeWindowHandle() => this.GetPropertyAsync<string>();
|
||||
public Task<string> GetNativeWindowHandle() => this.InvokeAsync<string>();
|
||||
|
||||
/// <summary>
|
||||
/// Sets the pathname of the file the window represents,
|
||||
/// Sets the pathname of the file the window represents,
|
||||
/// and the icon of the file will show in window’s title bar.
|
||||
/// </summary>
|
||||
/// <param name="filename"></param>
|
||||
@@ -795,10 +795,10 @@ public class BrowserWindow : ApiBase
|
||||
/// The pathname of the file the window represents.
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public Task<string> GetRepresentedFilenameAsync() => this.GetPropertyAsync<string>();
|
||||
public Task<string> GetRepresentedFilenameAsync() => this.InvokeAsync<string>();
|
||||
|
||||
/// <summary>
|
||||
/// Specifies whether the window’s document has been edited,
|
||||
/// Specifies whether the window’s document has been edited,
|
||||
/// and the icon in title bar will become gray when set to true.
|
||||
/// </summary>
|
||||
/// <param name="edited"></param>
|
||||
@@ -808,7 +808,7 @@ public class BrowserWindow : ApiBase
|
||||
/// Whether the window’s document has been edited.
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public Task<bool> IsDocumentEditedAsync() => this.GetPropertyAsync<bool>();
|
||||
public Task<bool> IsDocumentEditedAsync() => this.InvokeAsync<bool>();
|
||||
|
||||
/// <summary>
|
||||
/// Focuses the on web view.
|
||||
@@ -821,14 +821,14 @@ public class BrowserWindow : ApiBase
|
||||
public void BlurWebView() => this.CallMethod0();
|
||||
|
||||
/// <summary>
|
||||
/// The url can be a remote address (e.g. http://) or
|
||||
/// The url can be a remote address (e.g. http://) or
|
||||
/// a path to a local HTML file using the file:// protocol.
|
||||
/// </summary>
|
||||
/// <param name="url"></param>
|
||||
public void LoadURL(string url) => this.CallMethod1(url);
|
||||
|
||||
/// <summary>
|
||||
/// The url can be a remote address (e.g. http://) or
|
||||
/// The url can be a remote address (e.g. http://) or
|
||||
/// a path to a local HTML file using the file:// protocol.
|
||||
/// </summary>
|
||||
/// <param name="url"></param>
|
||||
@@ -857,7 +857,7 @@ public class BrowserWindow : ApiBase
|
||||
private List<MenuItem> _items = new List<MenuItem>();
|
||||
|
||||
/// <summary>
|
||||
/// Sets the menu as the window’s menu bar,
|
||||
/// Sets the menu as the window’s menu bar,
|
||||
/// setting it to null will remove the menu bar.
|
||||
/// </summary>
|
||||
/// <param name="menuItems"></param>
|
||||
@@ -920,7 +920,7 @@ public class BrowserWindow : ApiBase
|
||||
/// On Windows and Linux always returns true.
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public Task<bool> HasShadowAsync() => this.GetPropertyAsync<bool>();
|
||||
public Task<bool> HasShadowAsync() => this.InvokeAsync<bool>();
|
||||
|
||||
/// <summary>
|
||||
/// Gets the thumbar buttons.
|
||||
@@ -939,11 +939,11 @@ public class BrowserWindow : ApiBase
|
||||
private List<ThumbarButton> _thumbarButtons = new List<ThumbarButton>();
|
||||
|
||||
/// <summary>
|
||||
/// Add a thumbnail toolbar with a specified set of buttons to the thumbnail
|
||||
/// image of a window in a taskbar button layout. Returns a Boolean object
|
||||
/// Add a thumbnail toolbar with a specified set of buttons to the thumbnail
|
||||
/// image of a window in a taskbar button layout. Returns a Boolean object
|
||||
/// indicates whether the thumbnail has been added successfully.
|
||||
///
|
||||
/// The number of buttons in thumbnail toolbar should be no greater than 7 due
|
||||
/// The number of buttons in thumbnail toolbar should be no greater than 7 due
|
||||
/// to the limited room.Once you setup the thumbnail toolbar, the toolbar cannot
|
||||
/// be removed due to the platform’s limitation.But you can call the API with an
|
||||
/// empty array to clean the buttons.
|
||||
@@ -988,7 +988,7 @@ public class BrowserWindow : ApiBase
|
||||
/// <summary>
|
||||
/// Sets the properties for the window’s taskbar button.
|
||||
///
|
||||
/// Note: relaunchCommand and relaunchDisplayName must always be set together.
|
||||
/// Note: relaunchCommand and relaunchDisplayName must always be set together.
|
||||
/// If one of those properties is not set, then neither will be used.
|
||||
/// </summary>
|
||||
/// <param name="options"></param>
|
||||
@@ -1000,7 +1000,7 @@ public class BrowserWindow : ApiBase
|
||||
public void ShowDefinitionForSelection() => this.CallMethod0();
|
||||
|
||||
/// <summary>
|
||||
/// Sets whether the window menu bar should hide itself automatically.
|
||||
/// Sets whether the window menu bar should hide itself automatically.
|
||||
/// Once set the menu bar will only show when users press the single Alt key.
|
||||
///
|
||||
/// If the menu bar is already visible, calling setAutoHideMenuBar(true) won’t hide it immediately.
|
||||
@@ -1012,7 +1012,7 @@ public class BrowserWindow : ApiBase
|
||||
/// Whether menu bar automatically hides itself.
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public Task<bool> IsMenuBarAutoHideAsync() => this.GetPropertyAsync<bool>();
|
||||
public Task<bool> IsMenuBarAutoHideAsync() => this.InvokeAsync<bool>();
|
||||
|
||||
/// <summary>
|
||||
/// Sets whether the menu bar should be visible. If the menu bar is auto-hide,
|
||||
@@ -1025,7 +1025,7 @@ public class BrowserWindow : ApiBase
|
||||
/// Whether the menu bar is visible.
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public Task<bool> IsMenuBarVisibleAsync() => this.GetPropertyAsync<bool>();
|
||||
public Task<bool> IsMenuBarVisibleAsync() => this.InvokeAsync<bool>();
|
||||
|
||||
/// <summary>
|
||||
/// Sets whether the window should be visible on all workspaces.
|
||||
@@ -1041,12 +1041,12 @@ public class BrowserWindow : ApiBase
|
||||
/// Note: This API always returns false on Windows.
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public Task<bool> IsVisibleOnAllWorkspacesAsync() => this.GetPropertyAsync<bool>();
|
||||
public Task<bool> IsVisibleOnAllWorkspacesAsync() => this.InvokeAsync<bool>();
|
||||
|
||||
/// <summary>
|
||||
/// Makes the window ignore all mouse events.
|
||||
///
|
||||
/// All mouse events happened in this window will be passed to the window
|
||||
/// All mouse events happened in this window will be passed to the window
|
||||
/// below this window, but if this window has focus, it will still receive keyboard events.
|
||||
/// </summary>
|
||||
/// <param name="ignore"></param>
|
||||
@@ -1055,7 +1055,7 @@ public class BrowserWindow : ApiBase
|
||||
/// <summary>
|
||||
/// Prevents the window contents from being captured by other apps.
|
||||
///
|
||||
/// On macOS it sets the NSWindow’s sharingType to NSWindowSharingNone.
|
||||
/// On macOS it sets the NSWindow’s sharingType to NSWindowSharingNone.
|
||||
/// On Windows it calls SetWindowDisplayAffinity with WDA_MONITOR.
|
||||
/// </summary>
|
||||
/// <param name="enable"></param>
|
||||
@@ -1068,7 +1068,7 @@ public class BrowserWindow : ApiBase
|
||||
public void SetFocusable(bool focusable) => this.CallMethod1(focusable);
|
||||
|
||||
/// <summary>
|
||||
/// Sets parent as current window’s parent window,
|
||||
/// Sets parent as current window’s parent window,
|
||||
/// passing null will turn current window into a top-level window.
|
||||
/// </summary>
|
||||
/// <param name="parent"></param>
|
||||
@@ -1090,7 +1090,7 @@ public class BrowserWindow : ApiBase
|
||||
/// <returns></returns>
|
||||
public async Task<BrowserWindow> GetParentWindowAsync()
|
||||
{
|
||||
var browserWindowId = await this.GetPropertyAsync<int>().ConfigureAwait(false);
|
||||
var browserWindowId = await this.InvokeAsync<int>().ConfigureAwait(false);
|
||||
var browserWindow = Electron.WindowManager.BrowserWindows.ToList().Single(x => x.Id == browserWindowId);
|
||||
return browserWindow;
|
||||
}
|
||||
@@ -1101,7 +1101,7 @@ public class BrowserWindow : ApiBase
|
||||
/// <returns></returns>
|
||||
public async Task<List<BrowserWindow>> GetChildWindowsAsync()
|
||||
{
|
||||
var browserWindowIds = await this.GetPropertyAsync<int[]>().ConfigureAwait(false);
|
||||
var browserWindowIds = await this.InvokeAsync<int[]>().ConfigureAwait(false);
|
||||
var browserWindows = new List<BrowserWindow>();
|
||||
|
||||
foreach (var id in browserWindowIds)
|
||||
@@ -1120,11 +1120,11 @@ public class BrowserWindow : ApiBase
|
||||
public void SetAutoHideCursor(bool autoHide) => this.CallMethod1(autoHide);
|
||||
|
||||
/// <summary>
|
||||
/// Adds a vibrancy effect to the browser window.
|
||||
/// Adds a vibrancy effect to the browser window.
|
||||
/// Passing null or an empty string will remove the vibrancy effect on the window.
|
||||
/// </summary>
|
||||
/// <param name="type">Can be appearance-based, light, dark, titlebar, selection,
|
||||
/// menu, popover, sidebar, medium-light or ultra-dark.
|
||||
/// <param name="type">Can be appearance-based, light, dark, titlebar, selection,
|
||||
/// menu, popover, sidebar, medium-light or ultra-dark.
|
||||
/// See the macOS documentation for more details.</param>
|
||||
public void SetVibrancy(Vibrancy type) => this.CallMethod1(type.GetDescription());
|
||||
|
||||
@@ -1134,8 +1134,8 @@ public class BrowserWindow : ApiBase
|
||||
public WebContents WebContents { get; internal set; }
|
||||
|
||||
/// <summary>
|
||||
/// A BrowserView can be used to embed additional web content into a BrowserWindow.
|
||||
/// It is like a child window, except that it is positioned relative to its owning window.
|
||||
/// A BrowserView can be used to embed additional web content into a BrowserWindow.
|
||||
/// It is like a child window, except that it is positioned relative to its owning window.
|
||||
/// It is meant to be an alternative to the webview tag.
|
||||
/// </summary>
|
||||
/// <param name="browserView"></param>
|
||||
|
||||
@@ -2,6 +2,7 @@ using ElectronNET.API.Entities;
|
||||
using ElectronNET.API.Serialization;
|
||||
using System.Text.Json;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
// ReSharper disable InconsistentNaming
|
||||
|
||||
namespace ElectronNET.API
|
||||
@@ -9,7 +10,7 @@ namespace ElectronNET.API
|
||||
/// <summary>
|
||||
/// Perform copy and paste operations on the system clipboard.
|
||||
/// </summary>
|
||||
public sealed class Clipboard: ApiBase
|
||||
public sealed class Clipboard : ApiBase
|
||||
{
|
||||
protected override SocketTaskEventNameTypes SocketTaskEventNameType => SocketTaskEventNameTypes.DashesLowerFirst;
|
||||
protected override SocketTaskMessageNameTypes SocketTaskMessageNameType => SocketTaskMessageNameTypes.DashesLowerFirst;
|
||||
@@ -45,7 +46,7 @@ namespace ElectronNET.API
|
||||
/// </summary>
|
||||
/// <param name="type"></param>
|
||||
/// <returns>The content in the clipboard as plain text.</returns>
|
||||
public Task<string> ReadTextAsync(string type = "") => GetPropertyAsync<string>(type);
|
||||
public Task<string> ReadTextAsync(string type = "") => this.InvokeAsync<string>(type);
|
||||
|
||||
/// <summary>
|
||||
/// Writes the text into the clipboard as plain text.
|
||||
@@ -62,7 +63,7 @@ namespace ElectronNET.API
|
||||
/// </summary>
|
||||
/// <param name="type"></param>
|
||||
/// <returns></returns>
|
||||
public Task<string> ReadHTMLAsync(string type = "") => GetPropertyAsync<string>(type);
|
||||
public Task<string> ReadHTMLAsync(string type = "") => this.InvokeAsync<string>(type);
|
||||
|
||||
/// <summary>
|
||||
/// Writes markup to the clipboard.
|
||||
@@ -79,7 +80,7 @@ namespace ElectronNET.API
|
||||
/// </summary>
|
||||
/// <param name="type"></param>
|
||||
/// <returns></returns>
|
||||
public Task<string> ReadRTFAsync(string type = "") => GetPropertyAsync<string>(type);
|
||||
public Task<string> ReadRTFAsync(string type = "") => this.InvokeAsync<string>(type);
|
||||
|
||||
/// <summary>
|
||||
/// Writes the text into the clipboard in RTF.
|
||||
@@ -92,18 +93,18 @@ namespace ElectronNET.API
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns an Object containing title and url keys representing
|
||||
/// the bookmark in the clipboard. The title and url values will
|
||||
/// 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.
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public Task<ReadBookmark> ReadBookmarkAsync() => GetPropertyAsync<ReadBookmark>();
|
||||
public Task<ReadBookmark> ReadBookmarkAsync() => this.InvokeAsync<ReadBookmark>();
|
||||
|
||||
/// <summary>
|
||||
/// 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
|
||||
/// into them so you can use clipboard.write to write both a
|
||||
/// bookmark and fallback text to the clipboard.
|
||||
/// </summary>
|
||||
/// <param name="title"></param>
|
||||
@@ -120,10 +121,10 @@ namespace ElectronNET.API
|
||||
/// find pasteboard whenever the application is activated.
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public Task<string> ReadFindTextAsync() => GetPropertyAsync<string>();
|
||||
public Task<string> ReadFindTextAsync() => this.InvokeAsync<string>();
|
||||
|
||||
/// <summary>
|
||||
/// macOS: Writes the text into the find pasteboard as plain text. This method uses
|
||||
/// macOS: Writes the text into the find pasteboard as plain text. This method uses
|
||||
/// synchronous IPC when called from the renderer process.
|
||||
/// </summary>
|
||||
/// <param name="text"></param>
|
||||
@@ -146,7 +147,7 @@ namespace ElectronNET.API
|
||||
/// </summary>
|
||||
/// <param name="type"></param>
|
||||
/// <returns></returns>
|
||||
public Task<string[]> AvailableFormatsAsync(string type = "") => GetPropertyAsync<string[]>(type);
|
||||
public Task<string[]> AvailableFormatsAsync(string type = "") => this.InvokeAsync<string[]>(type);
|
||||
|
||||
/// <summary>
|
||||
/// Writes data to the clipboard.
|
||||
@@ -163,7 +164,7 @@ namespace ElectronNET.API
|
||||
/// </summary>
|
||||
/// <param name="type"></param>
|
||||
/// <returns></returns>
|
||||
public Task<NativeImage> ReadImageAsync(string type = "") => GetPropertyAsync<NativeImage>(type);
|
||||
public Task<NativeImage> ReadImageAsync(string type = "") => this.InvokeAsync<NativeImage>(type);
|
||||
|
||||
/// <summary>
|
||||
/// Writes an image to the clipboard.
|
||||
@@ -175,4 +176,4 @@ namespace ElectronNET.API
|
||||
BridgeConnector.Socket.Emit("clipboard-writeImage", JsonSerializer.Serialize(image, ElectronJson.Options), type);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -59,7 +59,5 @@ namespace ElectronNET.API
|
||||
}
|
||||
|
||||
private event Action<Cookie, CookieChangedCause, bool> _changed;
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -37,8 +37,8 @@ namespace ElectronNET.API
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 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']
|
||||
/// 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.
|
||||
/// </summary>
|
||||
/// <param name="browserWindow">The browserWindow argument allows the dialog to attach itself to a parent window, making it modal.</param>
|
||||
@@ -50,9 +50,9 @@ namespace ElectronNET.API
|
||||
var guid = Guid.NewGuid().ToString();
|
||||
|
||||
BridgeConnector.Socket.Once<string[]>("showOpenDialogComplete" + guid, tcs.SetResult);
|
||||
BridgeConnector.Socket.Emit("showOpenDialog",
|
||||
browserWindow,
|
||||
options,
|
||||
BridgeConnector.Socket.Emit("showOpenDialog",
|
||||
browserWindow,
|
||||
options,
|
||||
guid);
|
||||
|
||||
return tcs.Task;
|
||||
@@ -167,9 +167,9 @@ namespace ElectronNET.API
|
||||
/// <summary>
|
||||
/// 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,
|
||||
/// 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.
|
||||
/// </summary>
|
||||
/// <param name="title">The title to display in the error box.</param>
|
||||
@@ -181,7 +181,7 @@ namespace ElectronNET.API
|
||||
|
||||
/// <summary>
|
||||
/// On macOS, this displays a modal dialog that shows a message and certificate information,
|
||||
/// and gives the user the option of trusting/importing the certificate. If you provide a
|
||||
/// and gives the user the option of trusting/importing the certificate. If you provide a
|
||||
/// browserWindow argument the dialog will be attached to the parent window, making it modal.
|
||||
/// </summary>
|
||||
/// <param name="options"></param>
|
||||
@@ -193,7 +193,7 @@ namespace ElectronNET.API
|
||||
|
||||
/// <summary>
|
||||
/// On macOS, this displays a modal dialog that shows a message and certificate information,
|
||||
/// and gives the user the option of trusting/importing the certificate. If you provide a
|
||||
/// and gives the user the option of trusting/importing the certificate. If you provide a
|
||||
/// browserWindow argument the dialog will be attached to the parent window, making it modal.
|
||||
/// </summary>
|
||||
/// <param name="browserWindow"></param>
|
||||
@@ -212,7 +212,5 @@ namespace ElectronNET.API
|
||||
|
||||
return tcs.Task;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -208,7 +208,5 @@ namespace ElectronNET.API
|
||||
{
|
||||
BridgeConnector.Socket.Emit("dock-setIcon", image);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -140,7 +140,7 @@
|
||||
/// <summary>
|
||||
/// Allows you to execute native JavaScript/TypeScript code from the host process.
|
||||
///
|
||||
/// It is only possible if the Electron.NET CLI has previously added an
|
||||
/// It is only possible if the Electron.NET CLI has previously added an
|
||||
/// ElectronHostHook directory:
|
||||
/// <c>electronize add HostHook</c>
|
||||
/// </summary>
|
||||
@@ -153,7 +153,7 @@
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Allows you to execute native Lock and Unlock process.
|
||||
/// Allows you to execute native Lock and Unlock process.
|
||||
/// </summary>
|
||||
public static PowerMonitor PowerMonitor
|
||||
{
|
||||
|
||||
@@ -35,4 +35,4 @@ namespace ElectronNET.API.Entities
|
||||
[DefaultValue(false)]
|
||||
public bool Vertical { get; set; } = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -10,4 +10,4 @@
|
||||
/// </summary>
|
||||
public float ScaleFactor { get; set; } = 1.0f;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -28,4 +28,4 @@
|
||||
/// </summary>
|
||||
public bool IsAdminRightsRequired { get; set; }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -22,4 +22,4 @@
|
||||
/// </summary>
|
||||
public string ProxyCredentials { get; set; }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,4 @@
|
||||
using ElectronNET.Converter;
|
||||
|
||||
using System.ComponentModel;
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
@@ -126,6 +125,11 @@ namespace ElectronNET.API.Entities
|
||||
/// </summary>
|
||||
public bool SkipTaskbar { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Determines if Blazor is used. Will disable "module" and "process" globals. Default is false.
|
||||
/// </summary>
|
||||
public bool IsRunningBlazor { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The kiosk mode. Default is false.
|
||||
/// </summary>
|
||||
@@ -291,8 +295,4 @@ namespace ElectronNET.API.Entities
|
||||
/// </summary>
|
||||
public string ProxyCredentials { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -11,9 +11,9 @@
|
||||
public double PercentCPUUsage { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The number of average idle cpu wakeups per second since the last call to
|
||||
/// The number of average idle cpu wakeups per second since the last call to
|
||||
/// getCPUUsage.First call returns 0.
|
||||
/// </summary>
|
||||
public int IdleWakeupsPerSecond { get; set; }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -26,4 +26,4 @@
|
||||
/// </summary>
|
||||
public string Version { get; set; }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -21,4 +21,4 @@
|
||||
/// </summary>
|
||||
public string[] Quotas { get; set; }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,10 +1,9 @@
|
||||
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace ElectronNET.API.Entities
|
||||
{
|
||||
/// <summary>
|
||||
/// The cause of the change
|
||||
/// The cause of the change
|
||||
/// </summary>
|
||||
public enum CookieChangedCause
|
||||
{
|
||||
@@ -35,4 +34,4 @@ namespace ElectronNET.API.Entities
|
||||
[JsonPropertyName("expired_overwrite")]
|
||||
expiredOverwrite
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -49,7 +49,7 @@ namespace ElectronNET.API.Entities
|
||||
public bool HttpOnly { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// (optional) - The expiration date of the cookie as the number of seconds since the UNIX epoch.
|
||||
/// (optional) - The expiration date of the cookie as the number of seconds since the UNIX epoch.
|
||||
/// If omitted then the cookie becomes a session cookie and will not be retained between sessions.
|
||||
/// </summary>
|
||||
[DefaultValue(0)]
|
||||
|
||||
@@ -20,4 +20,4 @@
|
||||
/// </summary>
|
||||
public float ScaleFactor { get; set; } = 1.0f;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -64,4 +64,4 @@
|
||||
ETag = eTag;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -25,4 +25,4 @@
|
||||
/// </summary>
|
||||
public int UploadThroughput { get; set; }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -35,4 +35,4 @@
|
||||
/// </summary>
|
||||
public string Version { get; set; }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,3 @@
|
||||
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace ElectronNET.API.Entities
|
||||
|
||||
@@ -77,6 +77,4 @@ namespace ElectronNET.API.Entities
|
||||
/// </summary>
|
||||
public InputEventType Type { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -1,4 +1,3 @@
|
||||
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace ElectronNET.API.Entities
|
||||
@@ -23,5 +22,4 @@ namespace ElectronNET.API.Entities
|
||||
/// </summary>
|
||||
public JumpListCategoryType Type { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,4 +1,3 @@
|
||||
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace ElectronNET.API.Entities
|
||||
@@ -54,6 +53,4 @@ namespace ElectronNET.API.Entities
|
||||
/// </summary>
|
||||
public JumpListItemType Type { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -11,7 +11,7 @@
|
||||
public int WorkingSetSize { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The maximum amount of memory that has ever been pinned to actual physical RAM.
|
||||
/// The maximum amount of memory that has ever been pinned to actual physical RAM.
|
||||
/// </summary>
|
||||
public int PeakWorkingSetSize { get; set; }
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ namespace ElectronNET.API.Entities
|
||||
public class MenuItem
|
||||
{
|
||||
/// <summary>
|
||||
/// Will be called with click(menuItem, browserWindow, event) when the menu item is
|
||||
/// Will be called with click(menuItem, browserWindow, event) when the menu item is
|
||||
/// clicked.
|
||||
/// </summary>
|
||||
[JsonIgnore]
|
||||
@@ -96,6 +96,4 @@ namespace ElectronNET.API.Entities
|
||||
/// </summary>
|
||||
public string Position { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -1,4 +1,3 @@
|
||||
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace ElectronNET.API.Entities
|
||||
@@ -97,6 +96,4 @@ namespace ElectronNET.API.Entities
|
||||
Message = message;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -21,4 +21,4 @@
|
||||
/// </value>
|
||||
public bool CheckboxChecked { get; set; }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -35,5 +35,4 @@ namespace ElectronNET.API.Entities
|
||||
return new NativeImage(newDictionary);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -15,4 +15,4 @@ public class OnDidFailLoadInfo
|
||||
/// Validated URL.
|
||||
/// </summary>
|
||||
public string ValidatedUrl { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -14,4 +14,4 @@ public class OnDidNavigateInfo
|
||||
/// HTTP response code.
|
||||
/// </summary>
|
||||
public int HttpResponseCode { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,3 @@
|
||||
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace ElectronNET.API.Entities
|
||||
@@ -15,5 +14,4 @@ namespace ElectronNET.API.Entities
|
||||
/// </summary>
|
||||
public DevToolsMode Mode { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,4 +1,3 @@
|
||||
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace ElectronNET.API.Entities
|
||||
@@ -41,7 +40,7 @@ namespace ElectronNET.API.Entities
|
||||
public string Message { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The filters specifies an array of file types that can be displayed or
|
||||
/// The filters specifies an array of file types that can be displayed or
|
||||
/// selected when you want to limit the user to a specific type. For example:
|
||||
/// </summary>
|
||||
/// <example>
|
||||
@@ -57,5 +56,4 @@ namespace ElectronNET.API.Entities
|
||||
/// </example>
|
||||
public FileFilter[] Filters { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -17,4 +17,4 @@ public class PageSize
|
||||
public static implicit operator string(PageSize pageSize) => pageSize?._value;
|
||||
|
||||
public static implicit operator PageSize(string value) => new(value);
|
||||
}
|
||||
}
|
||||
@@ -20,7 +20,7 @@ namespace ElectronNET.API.Entities
|
||||
AppData,
|
||||
|
||||
/// <summary>
|
||||
/// The directory for storing your app’s configuration files,
|
||||
/// The directory for storing your app’s configuration files,
|
||||
/// which by default it is the appData directory appended with your app’s name.
|
||||
/// </summary>
|
||||
[Description("userData")]
|
||||
@@ -92,4 +92,4 @@ namespace ElectronNET.API.Entities
|
||||
[Description("PepperFlashSystemPlugin")]
|
||||
PepperFlashSystemPlugin
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -7,4 +7,4 @@ namespace ElectronNET.API.Entities
|
||||
/// <param name="Electron">Value representing Electron's version string</param>
|
||||
/// <returns></returns>
|
||||
public record ProcessVersions(string Chrome, string Electron);
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,3 @@
|
||||
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace ElectronNET.API.Entities
|
||||
@@ -13,5 +12,4 @@ namespace ElectronNET.API.Entities
|
||||
/// </summary>
|
||||
public ProgressBarMode Mode { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -30,4 +30,4 @@
|
||||
/// </summary>
|
||||
public string Transferred { get; set; }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -33,4 +33,4 @@
|
||||
ProxyBypassRules = proxyBypassRules;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -15,4 +15,4 @@
|
||||
/// </summary>
|
||||
public string Note { get; set; }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,3 @@
|
||||
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace ElectronNET.API.Entities
|
||||
@@ -25,7 +24,7 @@ namespace ElectronNET.API.Entities
|
||||
public string Realm { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Scheme of the authentication. Can be basic, digest, ntlm, negotiate.
|
||||
/// Scheme of the authentication. Can be basic, digest, ntlm, negotiate.
|
||||
/// Must be provided if removing by origin.
|
||||
/// </summary>
|
||||
public Scheme Scheme { get; set; }
|
||||
@@ -49,6 +48,4 @@ namespace ElectronNET.API.Entities
|
||||
Type = type;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -20,4 +20,4 @@
|
||||
/// </summary>
|
||||
public string Quality { get; set; } = "best";
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -27,7 +27,7 @@ namespace ElectronNET.API
|
||||
public string ButtonLabel { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The filters specifies an array of file types that can be displayed or
|
||||
/// The filters specifies an array of file types that can be displayed or
|
||||
/// selected when you want to limit the user to a specific type. For example:
|
||||
/// </summary>
|
||||
/// <example>
|
||||
|
||||
@@ -25,4 +25,4 @@ namespace ElectronNET.API.Entities
|
||||
[Description("replace")]
|
||||
Replace
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -56,5 +56,4 @@ namespace ElectronNET.API.Entities
|
||||
Icon = icon;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,4 +1,3 @@
|
||||
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace ElectronNET.API.Entities
|
||||
|
||||
@@ -10,4 +10,4 @@
|
||||
/// </summary>
|
||||
public float ScaleFactor { get; set; } = 1.0f;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -10,4 +10,4 @@
|
||||
/// </summary>
|
||||
public float ScaleFactor { get; set; } = 1.0f;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -10,4 +10,4 @@
|
||||
/// </summary>
|
||||
public float ScaleFactor { get; set; } = 1.0f;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -20,4 +20,4 @@
|
||||
/// </summary>
|
||||
public UpdateCancellationToken CancellationToken { get; set; }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -10,4 +10,4 @@
|
||||
/// </summary>
|
||||
public string Url { get; set; }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -213,4 +213,4 @@ namespace ElectronNET.API.Entities
|
||||
[DefaultValue(false)]
|
||||
public bool EnableRemoteModule { get; set; } = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -36,4 +36,4 @@ namespace ElectronNET.API.Extensions
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -39,10 +39,10 @@ namespace ElectronNET.API
|
||||
private Dictionary<string, Action> _shortcuts = new Dictionary<string, Action>();
|
||||
|
||||
/// <summary>
|
||||
/// Registers a global shortcut of accelerator.
|
||||
/// Registers a global shortcut of accelerator.
|
||||
/// The callback is called when the registered shortcut is pressed by the user.
|
||||
///
|
||||
/// When the accelerator is already taken by other applications, this call will
|
||||
/// When the accelerator is already taken by other applications, this call will
|
||||
/// silently fail.This behavior is intended by operating systems, since they don’t
|
||||
/// want applications to fight for global shortcuts.
|
||||
/// </summary>
|
||||
@@ -66,7 +66,7 @@ namespace ElectronNET.API
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// When the accelerator is already taken by other applications,
|
||||
/// When the accelerator is already taken by other applications,
|
||||
/// this call will still return false. This behavior is intended by operating systems,
|
||||
/// since they don’t want applications to fight for global shortcuts.
|
||||
/// </summary>
|
||||
|
||||
@@ -8,7 +8,7 @@ namespace ElectronNET.API
|
||||
/// <summary>
|
||||
/// Allows you to execute native JavaScript/TypeScript code from the host process.
|
||||
///
|
||||
/// It is only possible if the Electron.NET CLI has previously added an
|
||||
/// It is only possible if the Electron.NET CLI has previously added an
|
||||
/// ElectronHostHook directory:
|
||||
/// <c>electronize add HostHook</c>
|
||||
/// </summary>
|
||||
@@ -48,10 +48,7 @@ namespace ElectronNET.API
|
||||
/// <param name="arguments">Optional parameters.</param>
|
||||
public void Call(string socketEventName, params dynamic[] arguments)
|
||||
{
|
||||
BridgeConnector.Socket.Once<string>(socketEventName + "Error" + oneCallguid, (result) =>
|
||||
{
|
||||
Electron.Dialog.ShowErrorBox("Host Hook Exception", result);
|
||||
});
|
||||
BridgeConnector.Socket.Once<string>(socketEventName + "Error" + oneCallguid, (result) => { Electron.Dialog.ShowErrorBox("Host Hook Exception", result); });
|
||||
|
||||
BridgeConnector.Socket.Emit(socketEventName, arguments, oneCallguid);
|
||||
}
|
||||
@@ -95,7 +92,5 @@ namespace ElectronNET.API
|
||||
|
||||
return tcs.Task;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -39,7 +39,7 @@ namespace ElectronNET.API
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Listens to channel, when a new message arrives listener would be called with
|
||||
/// Listens to channel, when a new message arrives listener would be called with
|
||||
/// listener(event, args...).
|
||||
/// </summary>
|
||||
/// <param name="channel">Channelname.</param>
|
||||
@@ -71,7 +71,7 @@ namespace ElectronNET.API
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Send a message to the renderer process synchronously via channel,
|
||||
/// Send a message to the renderer process synchronously via channel,
|
||||
/// you can also send arbitrary arguments.
|
||||
///
|
||||
/// Note: Sending a synchronous message will block the whole renderer process,
|
||||
@@ -160,7 +160,5 @@ namespace ElectronNET.API
|
||||
{
|
||||
BridgeConnector.Socket.Emit("sendToIpcRendererBrowserView", browserView.Id, channel, data);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -129,7 +129,5 @@ namespace ElectronNET.API
|
||||
{
|
||||
BridgeConnector.Socket.Emit("menu-contextMenuPopup", browserWindow.Id);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -8,7 +8,7 @@ namespace ElectronNET.API
|
||||
/// <summary>
|
||||
/// Read and respond to changes in Chromium's native color theme.
|
||||
/// </summary>
|
||||
public sealed class NativeTheme: ApiBase
|
||||
public sealed class NativeTheme : ApiBase
|
||||
{
|
||||
protected override SocketTaskEventNameTypes SocketTaskEventNameType => SocketTaskEventNameTypes.DashesLowerFirst;
|
||||
protected override SocketEventNameTypes SocketEventNameType => SocketEventNameTypes.DashedLower;
|
||||
@@ -59,7 +59,7 @@ namespace ElectronNET.API
|
||||
/// </item>
|
||||
/// <item>
|
||||
/// <description>The 'updated' event will be emitted</description>
|
||||
/// </item>
|
||||
/// </item>
|
||||
/// </list>
|
||||
/// <para/>
|
||||
/// Settings this property to <see cref="ThemeSourceMode.Light"/> will have the following effects:
|
||||
@@ -79,7 +79,7 @@ namespace ElectronNET.API
|
||||
/// <item>
|
||||
/// <description>The 'updated' event will be emitted</description>
|
||||
/// </item>
|
||||
/// </list>
|
||||
/// </list>
|
||||
/// The usage of this property should align with a classic "dark mode" state machine in your application where the user has three options.
|
||||
/// <para/>
|
||||
/// <list type="bullet">
|
||||
@@ -107,26 +107,26 @@ namespace ElectronNET.API
|
||||
/// A <see cref="ThemeSourceMode"/> property that can be <see cref="ThemeSourceMode.System"/>, <see cref="ThemeSourceMode.Light"/> or <see cref="ThemeSourceMode.Dark"/>. It is used to override (<seealso cref="SetThemeSource"/>) and
|
||||
/// supercede the value that Chromium has chosen to use internally.
|
||||
/// </summary>
|
||||
public Task<ThemeSourceMode> GetThemeSourceAsync() => GetPropertyAsync<ThemeSourceMode>();
|
||||
public Task<ThemeSourceMode> GetThemeSourceAsync() => this.InvokeAsync<ThemeSourceMode>();
|
||||
|
||||
/// <summary>
|
||||
/// A <see cref="bool"/> for if the OS / Chromium currently has a dark mode enabled or is
|
||||
/// being instructed to show a dark-style UI. If you want to modify this value you
|
||||
/// should use <see cref="SetThemeSource"/>.
|
||||
/// </summary>
|
||||
public Task<bool> ShouldUseDarkColorsAsync() => GetPropertyAsync<bool>();
|
||||
public Task<bool> ShouldUseDarkColorsAsync() => this.InvokeAsync<bool>();
|
||||
|
||||
/// <summary>
|
||||
/// A <see cref="bool"/> for if the OS / Chromium currently has high-contrast mode enabled or is
|
||||
/// being instructed to show a high-contrast UI.
|
||||
/// </summary>
|
||||
public Task<bool> ShouldUseHighContrastColorsAsync() => GetPropertyAsync<bool>();
|
||||
public Task<bool> ShouldUseHighContrastColorsAsync() => this.InvokeAsync<bool>();
|
||||
|
||||
/// <summary>
|
||||
/// A <see cref="bool"/> for if the OS / Chromium currently has an inverted color scheme or is
|
||||
/// being instructed to use an inverted color scheme.
|
||||
/// </summary>
|
||||
public Task<bool> ShouldUseInvertedColorSchemeAsync() => GetPropertyAsync<bool>();
|
||||
public Task<bool> ShouldUseInvertedColorSchemeAsync() => this.InvokeAsync<bool>();
|
||||
|
||||
/// <summary>
|
||||
/// Emitted when something in the underlying NativeTheme has changed. This normally means that either the value of <see cref="ShouldUseDarkColorsAsync"/>,
|
||||
|
||||
@@ -9,7 +9,7 @@ namespace ElectronNET.API
|
||||
/// <summary>
|
||||
/// Create OS desktop notifications
|
||||
/// </summary>
|
||||
public sealed class Notification: ApiBase
|
||||
public sealed class Notification : ApiBase
|
||||
{
|
||||
protected override SocketTaskEventNameTypes SocketTaskEventNameType => SocketTaskEventNameTypes.NoDashUpperFirst;
|
||||
private static Notification _notification;
|
||||
@@ -88,10 +88,7 @@ namespace ElectronNET.API
|
||||
isActionDefined = true;
|
||||
|
||||
BridgeConnector.Socket.Off("NotificationEventReply");
|
||||
BridgeConnector.Socket.On<string[]>("NotificationEventReply", (args) =>
|
||||
{
|
||||
_notificationOptions.Single(x => x.ReplyID == args[0]).OnReply(args[1]);
|
||||
});
|
||||
BridgeConnector.Socket.On<string[]>("NotificationEventReply", (args) => { _notificationOptions.Single(x => x.ReplyID == args[0]).OnReply(args[1]); });
|
||||
}
|
||||
|
||||
if (notificationOptions.OnAction != null)
|
||||
@@ -100,10 +97,7 @@ namespace ElectronNET.API
|
||||
isActionDefined = true;
|
||||
|
||||
BridgeConnector.Socket.Off("NotificationEventAction");
|
||||
BridgeConnector.Socket.On<string[]>("NotificationEventAction", (args) =>
|
||||
{
|
||||
_notificationOptions.Single(x => x.ActionID == args[0]).OnAction(args[1]);
|
||||
});
|
||||
BridgeConnector.Socket.On<string[]>("NotificationEventAction", (args) => { _notificationOptions.Single(x => x.ActionID == args[0]).OnAction(args[1]); });
|
||||
}
|
||||
|
||||
if (isActionDefined)
|
||||
@@ -116,6 +110,6 @@ namespace ElectronNET.API
|
||||
/// Whether or not desktop notifications are supported on the current system.
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public Task<bool> IsSupportedAsync() => GetPropertyAsync<bool>();
|
||||
public Task<bool> IsSupportedAsync() => this.InvokeAsync<bool>();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -7,13 +7,13 @@ namespace ElectronNET.API
|
||||
/// <summary>
|
||||
/// Monitor power state changes..
|
||||
/// </summary>
|
||||
public sealed class PowerMonitor: ApiBase
|
||||
public sealed class PowerMonitor : ApiBase
|
||||
{
|
||||
protected override SocketTaskEventNameTypes SocketTaskEventNameType => SocketTaskEventNameTypes.DashesLowerFirst;
|
||||
protected override SocketEventNameTypes SocketEventNameType => SocketEventNameTypes.DashedLower;
|
||||
|
||||
/// <summary>
|
||||
/// Emitted when the system is about to lock the screen.
|
||||
/// Emitted when the system is about to lock the screen.
|
||||
/// </summary>
|
||||
public event Action OnLockScreen
|
||||
{
|
||||
@@ -22,7 +22,7 @@ namespace ElectronNET.API
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Emitted when the system is about to unlock the screen.
|
||||
/// Emitted when the system is about to unlock the screen.
|
||||
/// </summary>
|
||||
public event Action OnUnLockScreen
|
||||
{
|
||||
|
||||
@@ -9,10 +9,11 @@ namespace ElectronNET.API
|
||||
/// Electron's process object is extended from the Node.js process object. It adds the
|
||||
/// events, properties, and methods.
|
||||
/// </summary>
|
||||
public sealed class Process: ApiBase
|
||||
public sealed class Process : ApiBase
|
||||
{
|
||||
protected override SocketTaskEventNameTypes SocketTaskEventNameType => SocketTaskEventNameTypes.DashesLowerFirst;
|
||||
protected override SocketTaskMessageNameTypes SocketTaskMessageNameType => SocketTaskMessageNameTypes.DashesLowerFirst;
|
||||
|
||||
internal Process()
|
||||
{
|
||||
}
|
||||
@@ -43,8 +44,8 @@ namespace ElectronNET.API
|
||||
/// <summary>
|
||||
/// The process.execPath property returns the absolute pathname of the executable that
|
||||
/// started the Node.js process. Symbolic links, if any, are resolved.
|
||||
/// </summary>
|
||||
public Task<string> ExecPathAsync => GetPropertyAsync<string>();
|
||||
/// </summary>
|
||||
public Task<string> ExecPathAsync => this.InvokeAsync<string>();
|
||||
|
||||
/// <summary>
|
||||
/// The process.argv property returns an array containing the command-line arguments passed
|
||||
@@ -53,56 +54,56 @@ namespace ElectronNET.API
|
||||
/// will be the path to the JavaScript file being executed. The remaining elements will be
|
||||
/// any additional command-line arguments
|
||||
/// </summary>
|
||||
public Task<string[]> ArgvAsync => GetPropertyAsync<string[]>();
|
||||
public Task<string[]> ArgvAsync => this.InvokeAsync<string[]>();
|
||||
|
||||
/// <summary>
|
||||
/// The process.execPath property returns the absolute pathname of the executable that
|
||||
/// started the Node.js process. Symbolic links, if any, are resolved.
|
||||
/// </summary>
|
||||
public Task<string> TypeAsync => GetPropertyAsync<string>();
|
||||
public Task<string> TypeAsync => this.InvokeAsync<string>();
|
||||
|
||||
/// <summary>
|
||||
/// The process.versions property returns an object listing the version strings of
|
||||
/// chrome and electron.
|
||||
/// </summary>
|
||||
public Task<ProcessVersions> VersionsAsync => GetPropertyAsync<ProcessVersions>();
|
||||
/// </summary>
|
||||
public Task<ProcessVersions> VersionsAsync => this.InvokeAsync<ProcessVersions>();
|
||||
|
||||
/// <summary>
|
||||
/// A Boolean. When app is started by being passed as parameter to the default app, this
|
||||
/// property is true in the main process, otherwise it is false.
|
||||
/// </summary>
|
||||
public Task<bool> DefaultAppAsync => GetPropertyAsync<bool>();
|
||||
public Task<bool> DefaultAppAsync => this.InvokeAsync<bool>();
|
||||
|
||||
/// <summary>
|
||||
/// A Boolean, true when the current renderer context is the "main" renderer frame. If you
|
||||
/// want the ID of the current frame you should use webFrame.routingId
|
||||
/// </summary>
|
||||
public Task<bool> IsMainFrameAsync => GetPropertyAsync<bool>();
|
||||
public Task<bool> IsMainFrameAsync => this.InvokeAsync<bool>();
|
||||
|
||||
/// <summary>
|
||||
/// A String representing the path to the resources directory.
|
||||
/// </summary>
|
||||
public Task<string> ResourcesPathAsync => GetPropertyAsync<string>();
|
||||
public Task<string> ResourcesPathAsync => this.InvokeAsync<string>();
|
||||
|
||||
/// <summary>
|
||||
/// The number of seconds the current Node.js process has been running. The return value
|
||||
/// includes fractions of a second. Use Math.floor() to get whole seconds.
|
||||
/// </summary>
|
||||
public Task<double> UpTimeAsync => GetPropertyAsync<double>();
|
||||
public Task<double> UpTimeAsync => this.InvokeAsync<double>();
|
||||
|
||||
/// <summary>
|
||||
/// The PID of the electron process
|
||||
/// </summary>
|
||||
public Task<int> PidAsync => GetPropertyAsync<int>();
|
||||
public Task<int> PidAsync => this.InvokeAsync<int>();
|
||||
|
||||
/// <summary>
|
||||
/// The operating system CPU architecture for which the Node.js binary was compiled
|
||||
/// </summary>
|
||||
public Task<string> ArchAsync => GetPropertyAsync<string>();
|
||||
public Task<string> ArchAsync => this.InvokeAsync<string>();
|
||||
|
||||
/// <summary>
|
||||
/// A string identifying the operating system platform on which the Node.js process is running
|
||||
/// </summary>
|
||||
public Task<string> PlatformAsync => GetPropertyAsync<string>();
|
||||
public Task<string> PlatformAsync => this.InvokeAsync<string>();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -10,7 +10,7 @@ namespace ElectronNET.API
|
||||
/// <summary>
|
||||
/// Retrieve information about screen size, displays, cursor position, etc.
|
||||
/// </summary>
|
||||
public sealed class Screen: ApiBase
|
||||
public sealed class Screen : ApiBase
|
||||
{
|
||||
protected override SocketTaskEventNameTypes SocketTaskEventNameType => SocketTaskEventNameTypes.DashesLowerFirst;
|
||||
protected override SocketTaskMessageNameTypes SocketTaskMessageNameType => SocketTaskMessageNameTypes.DashesLowerFirst;
|
||||
@@ -35,8 +35,8 @@ namespace ElectronNET.API
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Emitted when one or more metrics change in a display.
|
||||
/// The changedMetrics is an array of strings that describe the changes.
|
||||
/// 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.
|
||||
/// </summary>
|
||||
public event Action<Display, string[]> OnDisplayMetricsChanged
|
||||
@@ -56,6 +56,7 @@ namespace ElectronNET.API
|
||||
|
||||
BridgeConnector.Socket.Emit("register-screen-display-metrics-changed", GetHashCode());
|
||||
}
|
||||
|
||||
_onDisplayMetricsChanged += value;
|
||||
}
|
||||
remove
|
||||
@@ -101,37 +102,37 @@ namespace ElectronNET.API
|
||||
/// The current absolute position of the mouse pointer.
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public Task<Point> GetCursorScreenPointAsync() => GetPropertyAsync<Point>();
|
||||
public Task<Point> GetCursorScreenPointAsync() => this.InvokeAsync<Point>();
|
||||
|
||||
/// <summary>
|
||||
/// macOS: The height of the menu bar in pixels.
|
||||
/// </summary>
|
||||
/// <returns>The height of the menu bar in pixels.</returns>
|
||||
public Task<Rectangle> GetMenuBarWorkAreaAsync() => GetPropertyAsync<Rectangle>();
|
||||
public Task<Rectangle> GetMenuBarWorkAreaAsync() => this.InvokeAsync<Rectangle>();
|
||||
|
||||
/// <summary>
|
||||
/// The primary display.
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public Task<Display> GetPrimaryDisplayAsync() => GetPropertyAsync<Display>();
|
||||
public Task<Display> GetPrimaryDisplayAsync() => this.InvokeAsync<Display>();
|
||||
|
||||
/// <summary>
|
||||
/// An array of displays that are currently available.
|
||||
/// </summary>
|
||||
/// <returns>An array of displays that are currently available.</returns>
|
||||
public Task<Display[]> GetAllDisplaysAsync() => GetPropertyAsync<Display[]>();
|
||||
public Task<Display[]> GetAllDisplaysAsync() => this.InvokeAsync<Display[]>();
|
||||
|
||||
/// <summary>
|
||||
/// The display nearest the specified point.
|
||||
/// </summary>
|
||||
/// <returns>The display nearest the specified point.</returns>
|
||||
public Task<Display> GetDisplayNearestPointAsync(Point point) => GetPropertyAsync<Display>(point);
|
||||
public Task<Display> GetDisplayNearestPointAsync(Point point) => this.InvokeAsync<Display>(point);
|
||||
|
||||
/// <summary>
|
||||
/// The display that most closely intersects the provided bounds.
|
||||
/// </summary>
|
||||
/// <param name="rectangle"></param>
|
||||
/// <returns>The display that most closely intersects the provided bounds.</returns>
|
||||
public Task<Display> GetDisplayMatchingAsync(Rectangle rectangle) => GetPropertyAsync<Display>(rectangle);
|
||||
public Task<Display> GetDisplayMatchingAsync(Rectangle rectangle) => this.InvokeAsync<Display>(rectangle);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -373,7 +373,5 @@ namespace ElectronNET.API
|
||||
|
||||
return tcs.Task;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -68,7 +68,7 @@ namespace ElectronNET.API
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Open the given external protocol URL in the desktop’s default manner.
|
||||
/// Open the given external protocol URL in the desktop’s default manner.
|
||||
/// (For example, mailto: URLs in the user’s default mail agent).
|
||||
/// </summary>
|
||||
/// <param name="url">Max 2081 characters on windows.</param>
|
||||
@@ -79,7 +79,7 @@ namespace ElectronNET.API
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Open the given external protocol URL in the desktop’s default manner.
|
||||
/// Open the given external protocol URL in the desktop’s default manner.
|
||||
/// (For example, mailto: URLs in the user’s default mail agent).
|
||||
/// </summary>
|
||||
/// <param name="url">Max 2081 characters on windows.</param>
|
||||
@@ -158,7 +158,5 @@ namespace ElectronNET.API
|
||||
|
||||
return tcs.Task;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -14,7 +14,7 @@ namespace ElectronNET.API
|
||||
/// <summary>
|
||||
/// Add icons and context menus to the system's notification area.
|
||||
/// </summary>
|
||||
public sealed class Tray: ApiBase
|
||||
public sealed class Tray : ApiBase
|
||||
{
|
||||
protected override SocketTaskEventNameTypes SocketTaskEventNameType => SocketTaskEventNameTypes.DashesLowerFirst;
|
||||
protected override SocketEventNameTypes SocketEventNameType => SocketEventNameTypes.DashedLower;
|
||||
@@ -38,6 +38,7 @@ namespace ElectronNET.API
|
||||
|
||||
BridgeConnector.Socket.Emit("register-tray-click", GetHashCode());
|
||||
}
|
||||
|
||||
_click += value;
|
||||
}
|
||||
remove
|
||||
@@ -72,6 +73,7 @@ namespace ElectronNET.API
|
||||
|
||||
BridgeConnector.Socket.Emit("register-tray-right-click", GetHashCode());
|
||||
}
|
||||
|
||||
_rightClick += value;
|
||||
}
|
||||
remove
|
||||
@@ -106,6 +108,7 @@ namespace ElectronNET.API
|
||||
|
||||
BridgeConnector.Socket.Emit("register-tray-double-click", GetHashCode());
|
||||
}
|
||||
|
||||
_doubleClick += value;
|
||||
}
|
||||
remove
|
||||
@@ -140,7 +143,7 @@ namespace ElectronNET.API
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Windows: Emitted when the tray balloon is closed
|
||||
/// Windows: Emitted when the tray balloon is closed
|
||||
/// because of timeout or user manually closes it.
|
||||
/// </summary>
|
||||
public event Action OnBalloonClosed
|
||||
@@ -295,7 +298,6 @@ namespace ElectronNET.API
|
||||
}
|
||||
|
||||
|
||||
|
||||
private const string ModuleName = "tray";
|
||||
|
||||
/// <summary>
|
||||
@@ -330,4 +332,4 @@ namespace ElectronNET.API
|
||||
public async Task Once<T>(string eventName, Action<T> action)
|
||||
=> await Events.Instance.Once(ModuleName, eventName, action).ConfigureAwait(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -9,7 +9,7 @@ namespace ElectronNET.API;
|
||||
/// <summary>
|
||||
/// Render and control web pages.
|
||||
/// </summary>
|
||||
public class WebContents: ApiBase
|
||||
public class WebContents : ApiBase
|
||||
{
|
||||
protected override SocketTaskEventNameTypes SocketTaskEventNameType => SocketTaskEventNameTypes.DashesLowerFirst;
|
||||
protected override SocketTaskMessageNameTypes SocketTaskMessageNameType => SocketTaskMessageNameTypes.DashesLowerFirst;
|
||||
@@ -139,24 +139,25 @@ public class WebContents: ApiBase
|
||||
/// Get system printers.
|
||||
/// </summary>
|
||||
/// <returns>printers</returns>
|
||||
public Task<PrinterInfo[]> GetPrintersAsync() => GetPropertyAsync<PrinterInfo[]>();
|
||||
public Task<PrinterInfo[]> GetPrintersAsync() => this.InvokeAsync<PrinterInfo[]>();
|
||||
|
||||
/// <summary>
|
||||
/// Prints window's web page.
|
||||
/// </summary>
|
||||
/// <param name="options"></param>
|
||||
/// <returns>success</returns>
|
||||
public Task<bool> PrintAsync(PrintOptions options) => GetPropertyAsync<bool>(options);
|
||||
public Task<bool> PrintAsync(PrintOptions options) => this.InvokeAsync<bool>(options);
|
||||
|
||||
/// <summary>
|
||||
/// Prints window's web page.
|
||||
/// </summary>
|
||||
/// <returns>success</returns>
|
||||
public Task<bool> PrintAsync() => GetPropertyAsync<bool>(string.Empty);
|
||||
public Task<bool> PrintAsync() => this.InvokeAsync<bool>(string.Empty);
|
||||
|
||||
/// <summary>
|
||||
/// 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;
|
||||
/// 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.
|
||||
/// </summary>
|
||||
/// <param name="path"></param>
|
||||
@@ -222,7 +223,7 @@ public class WebContents: ApiBase
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The async method will resolve when the page has finished loading,
|
||||
/// 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
|
||||
@@ -239,7 +240,7 @@ public class WebContents: ApiBase
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The async method will resolve when the page has finished loading,
|
||||
/// 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
|
||||
@@ -261,10 +262,7 @@ public class WebContents: ApiBase
|
||||
tcs.SetResult(null);
|
||||
});
|
||||
|
||||
BridgeConnector.Socket.Once<string>("webContents-loadURL-error" + Id, (error) =>
|
||||
{
|
||||
tcs.SetException(new InvalidOperationException(error));
|
||||
});
|
||||
BridgeConnector.Socket.Once<string>("webContents-loadURL-error" + Id, (error) => { tcs.SetException(new InvalidOperationException(error)); });
|
||||
|
||||
BridgeConnector.Socket.Emit("webContents-loadURL", Id, url, options);
|
||||
|
||||
@@ -282,4 +280,4 @@ public class WebContents: ApiBase
|
||||
{
|
||||
BridgeConnector.Socket.Emit("webContents-insertCSS", Id, isBrowserWindow, path);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -59,4 +59,4 @@ namespace ElectronNET.API.Entities
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -158,8 +158,8 @@ namespace ElectronNET.API
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// A BrowserView can be used to embed additional web content into a BrowserWindow.
|
||||
/// It is like a child window, except that it is positioned relative to its owning window.
|
||||
/// A BrowserView can be used to embed additional web content into a BrowserWindow.
|
||||
/// It is like a child window, except that it is positioned relative to its owning window.
|
||||
/// It is meant to be an alternative to the webview tag.
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
@@ -169,8 +169,8 @@ namespace ElectronNET.API
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// A BrowserView can be used to embed additional web content into a BrowserWindow.
|
||||
/// It is like a child window, except that it is positioned relative to its owning window.
|
||||
/// A BrowserView can be used to embed additional web content into a BrowserWindow.
|
||||
/// It is like a child window, except that it is positioned relative to its owning window.
|
||||
/// It is meant to be an alternative to the webview tag.
|
||||
/// </summary>
|
||||
/// <param name="options"></param>
|
||||
@@ -192,6 +192,5 @@ namespace ElectronNET.API
|
||||
|
||||
return await tcs.Task.ConfigureAwait(false);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -121,4 +121,4 @@ internal class SocketIoFacade
|
||||
{
|
||||
_socket.Dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -51,14 +51,14 @@ namespace ElectronNET.Common
|
||||
|
||||
return str;
|
||||
}
|
||||
|
||||
|
||||
public static string StripOn(this string str)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(str) || !str.StartsWith("On", StringComparison.Ordinal))
|
||||
{
|
||||
return str;
|
||||
}
|
||||
|
||||
|
||||
return str.Substring(2);
|
||||
}
|
||||
|
||||
@@ -66,7 +66,7 @@ namespace ElectronNET.Common
|
||||
{
|
||||
return string.Join("-", Regex.Split(str.StripOn(), "(?<!^)(?=[A-Z])")).ToLower(CultureInfo.InvariantCulture);
|
||||
}
|
||||
|
||||
|
||||
public static string ToCamelCaseEventName(this string str)
|
||||
{
|
||||
return str.StripOn().LowerFirst();
|
||||
@@ -87,4 +87,4 @@ namespace ElectronNET.Common
|
||||
return service == null || service.State == LifetimeState.Stopped;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -23,6 +23,7 @@ public class ModifierTypeListConverter : JsonConverter<List<ModifierType>>
|
||||
{
|
||||
throw new JsonException("Expected array for ModifierType list");
|
||||
}
|
||||
|
||||
while (reader.Read())
|
||||
{
|
||||
if (reader.TokenType == JsonTokenType.EndArray) break;
|
||||
@@ -30,6 +31,7 @@ public class ModifierTypeListConverter : JsonConverter<List<ModifierType>>
|
||||
var s = reader.GetString();
|
||||
list.Add((ModifierType)Enum.Parse(typeof(ModifierType), s, ignoreCase: true));
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
@@ -40,6 +42,7 @@ public class ModifierTypeListConverter : JsonConverter<List<ModifierType>>
|
||||
{
|
||||
writer.WriteStringValue(modifier.ToString());
|
||||
}
|
||||
|
||||
writer.WriteEndArray();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -42,5 +42,4 @@ public class PageSizeConverter : JsonConverter<PageSize>
|
||||
JsonSerializer.Serialize(writer, value, ElectronJson.Options);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -42,5 +42,4 @@ public class TitleBarOverlayConverter : JsonConverter<TitleBarOverlay>
|
||||
JsonSerializer.Serialize(writer, value, ElectronJson.Options);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -52,4 +52,4 @@
|
||||
return RuntimeControllerCore?.Socket;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -8,4 +8,4 @@
|
||||
/// <summary>ASP.NET Core cross-platform app.</summary>
|
||||
AspNetCoreApp,
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -9,4 +9,4 @@
|
||||
Stopping,
|
||||
Stopped,
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -34,4 +34,4 @@
|
||||
/// </remarks>
|
||||
UnpackedDotnetFirst,
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -69,4 +69,4 @@
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -21,6 +21,5 @@
|
||||
port += 2;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -106,4 +106,4 @@
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -30,5 +30,4 @@ namespace ElectronNET.API.Serialization
|
||||
internal partial class ElectronJsonContext : JsonSerializerContext
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,36 +1,36 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<Import Project="..\common.props" />
|
||||
<Import Project="..\common.props" />
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>netstandard2.0</TargetFramework>
|
||||
<IsPackable>False</IsPackable>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.Build.Utilities.Core" Version="17.3.2" />
|
||||
</ItemGroup>
|
||||
|
||||
|
||||
|
||||
<PropertyGroup>
|
||||
|
||||
<_DllTargetPath>$(MSBuildThisFileDirectory)\..\ElectronNET\build</_DllTargetPath>
|
||||
|
||||
</PropertyGroup>
|
||||
|
||||
<Target BeforeTargets="AfterBuild" Name="CopyToBuildFolder">
|
||||
<PropertyGroup>
|
||||
<TargetFramework>netstandard2.0</TargetFramework>
|
||||
<IsPackable>False</IsPackable>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<OutputFiles Include="$(OutDir)**\*.dll"></OutputFiles>
|
||||
<PackageReference Include="Microsoft.Build.Utilities.Core" Version="17.3.2" />
|
||||
</ItemGroup>
|
||||
|
||||
<Message Text="Copy ElectronNET.Build.dll to destination: $(_DllTargetPath)" Importance="high"/>
|
||||
|
||||
<Copy SourceFiles="@(OutputFiles)"
|
||||
DestinationFolder="$(_DllTargetPath)\%(RecursiveDir)"
|
||||
OverwriteReadOnlyFiles="true"></Copy>
|
||||
|
||||
</Target>
|
||||
<PropertyGroup>
|
||||
|
||||
<_DllTargetPath>$(MSBuildThisFileDirectory)\..\ElectronNET\build</_DllTargetPath>
|
||||
|
||||
</PropertyGroup>
|
||||
|
||||
<Target BeforeTargets="AfterBuild" Name="CopyToBuildFolder">
|
||||
|
||||
<ItemGroup>
|
||||
<OutputFiles Include="$(OutDir)**\*.dll"></OutputFiles>
|
||||
</ItemGroup>
|
||||
|
||||
<Message Text="Copy ElectronNET.Build.dll to destination: $(_DllTargetPath)" Importance="high"/>
|
||||
|
||||
<Copy SourceFiles="@(OutputFiles)"
|
||||
DestinationFolder="$(_DllTargetPath)\%(RecursiveDir)"
|
||||
OverwriteReadOnlyFiles="true"></Copy>
|
||||
|
||||
</Target>
|
||||
|
||||
</Project>
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
<ElectronNetDevMode>true</ElectronNetDevMode>
|
||||
</PropertyGroup>
|
||||
|
||||
<Import Project="..\ElectronNET\build\ElectronNET.props" Condition="$(ElectronNetDevMode)" />
|
||||
<Import Project="..\ElectronNET\build\ElectronNET.Core.props" Condition="$(ElectronNetDevMode)" />
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
@@ -69,9 +69,9 @@
|
||||
<ProjectReference Include="..\ElectronNET.API\ElectronNET.API.csproj" Condition="$(ElectronNetDevMode)" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="ElectronNET.Core" Version="0.1.0" Condition="'$(ElectronNetDevMode)' != 'true'" />
|
||||
<PackageReference Include="ElectronNET.Core" Version="0.2.0" Condition="'$(ElectronNetDevMode)' != 'true'" />
|
||||
</ItemGroup>
|
||||
|
||||
<Import Project="..\ElectronNET\build\ElectronNET.targets" Condition="$(ElectronNetDevMode)" />
|
||||
<Import Project="..\ElectronNET\build\ElectronNET.Core.targets" Condition="$(ElectronNetDevMode)" />
|
||||
|
||||
</Project>
|
||||
37
src/ElectronNET.Host/.vscode/launch.json
vendored
37
src/ElectronNET.Host/.vscode/launch.json
vendored
@@ -1,20 +1,21 @@
|
||||
{
|
||||
// Use IntelliSense to learn about possible attributes.
|
||||
// Hover to view descriptions of existing attributes.
|
||||
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
|
||||
"version": "0.2.0",
|
||||
"configurations": [
|
||||
{
|
||||
"type": "node",
|
||||
"request": "launch",
|
||||
"name": "Launch Electron App",
|
||||
"runtimeExecutable": "${workspaceFolder}/node_modules/.bin/electron",
|
||||
"program": "${workspaceFolder}/main.js",
|
||||
"sourceMaps": true,
|
||||
"args": [
|
||||
"--test=true",
|
||||
"--blub=wuhuu"
|
||||
]
|
||||
}
|
||||
]
|
||||
// Use IntelliSense to learn about possible attributes.
|
||||
// Hover to view descriptions of existing attributes.
|
||||
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
|
||||
"version": "0.2.0",
|
||||
"configurations": [
|
||||
{
|
||||
"type": "node",
|
||||
"request": "launch",
|
||||
"name": "Launch Electron App",
|
||||
"runtimeExecutable": "${workspaceFolder}/node_modules/.bin/electron",
|
||||
"program": "${workspaceFolder}/main.js",
|
||||
"skipFiles": [ "<node_internals>/**" ],
|
||||
"cwd": "${workspaceFolder}",
|
||||
"console": "externalTerminal",
|
||||
"args": [
|
||||
"--test=true"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -1,7 +1,10 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.Connector = void 0;
|
||||
const socket_io_1 = require("socket.io");
|
||||
class Connector {
|
||||
socket;
|
||||
app;
|
||||
constructor(socket,
|
||||
// @ts-ignore
|
||||
app) {
|
||||
|
||||
@@ -1 +1 @@
|
||||
{"version":3,"file":"connector.js","sourceRoot":"","sources":["connector.ts"],"names":[],"mappings":";;;AAEA,MAAa,SAAS;IAClB,YAAoB,MAAc;IAC9B,aAAa;IACN,GAAiB;QAFR,WAAM,GAAN,MAAM,CAAQ;QAEvB,QAAG,GAAH,GAAG,CAAc;IAAI,CAAC;IAEjC,EAAE,CAAC,GAAW,EAAE,cAAwB;QACpC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,GAAG,EAAE,CAAC,GAAG,IAAW,EAAE,EAAE;YACnC,MAAM,EAAE,GAAW,IAAI,CAAC,GAAG,EAAE,CAAC;YAE9B,IAAI,CAAC;gBACD,cAAc,CAAC,GAAG,IAAI,EAAE,CAAC,IAAI,EAAE,EAAE;oBAC7B,IAAI,IAAI,EAAE,CAAC;wBACP,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,GAAG,WAAW,EAAE,EAAE,EAAE,IAAI,CAAC,CAAC;oBAClD,CAAC;gBACL,CAAC,CAAC,CAAC;YACP,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACb,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,GAAG,QAAQ,EAAE,EAAE,EAAE,qBAAqB,EAAE,KAAK,CAAC,CAAC;YACvE,CAAC;QACL,CAAC,CAAC,CAAC;IACP,CAAC;CACJ;AApBD,8BAoBC"}
|
||||
{"version":3,"file":"connector.js","sourceRoot":"","sources":["connector.ts"],"names":[],"mappings":";;;AAAA,yCAAmC;AAEnC,MAAa,SAAS;IACE;IAET;IAFX,YAAoB,MAAc;IAC9B,aAAa;IACN,GAAiB;QAFR,WAAM,GAAN,MAAM,CAAQ;QAEvB,QAAG,GAAH,GAAG,CAAc;IAAI,CAAC;IAEjC,EAAE,CAAC,GAAW,EAAE,cAAwB;QACpC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,GAAG,EAAE,CAAC,GAAG,IAAW,EAAE,EAAE;YACnC,MAAM,EAAE,GAAW,IAAI,CAAC,GAAG,EAAE,CAAC;YAE9B,IAAI,CAAC;gBACD,cAAc,CAAC,GAAG,IAAI,EAAE,CAAC,IAAI,EAAE,EAAE;oBAC7B,IAAI,IAAI,EAAE,CAAC;wBACP,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,GAAG,WAAW,EAAE,EAAE,EAAE,IAAI,CAAC,CAAC;oBAClD,CAAC;gBACL,CAAC,CAAC,CAAC;YACP,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACb,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,GAAG,QAAQ,EAAE,EAAE,EAAE,qBAAqB,EAAE,KAAK,CAAC,CAAC;YACvE,CAAC;QACL,CAAC,CAAC,CAAC;IACP,CAAC;CACJ;AApBD,8BAoBC"}
|
||||
@@ -1,8 +1,45 @@
|
||||
"use strict";
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||
}
|
||||
Object.defineProperty(o, k2, desc);
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
}));
|
||||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
||||
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
||||
}) : function(o, v) {
|
||||
o["default"] = v;
|
||||
});
|
||||
var __importStar = (this && this.__importStar) || (function () {
|
||||
var ownKeys = function(o) {
|
||||
ownKeys = Object.getOwnPropertyNames || function (o) {
|
||||
var ar = [];
|
||||
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
||||
return ar;
|
||||
};
|
||||
return ownKeys(o);
|
||||
};
|
||||
return function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
||||
__setModuleDefault(result, mod);
|
||||
return result;
|
||||
};
|
||||
})();
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.HookService = void 0;
|
||||
// @ts-ignore
|
||||
const Electron = __importStar(require("electron"));
|
||||
const socket_io_1 = require("socket.io");
|
||||
const connector_1 = require("./connector");
|
||||
class HookService extends connector_1.Connector {
|
||||
app;
|
||||
constructor(socket, app) {
|
||||
super(socket, app);
|
||||
this.app = app;
|
||||
|
||||
@@ -1 +1 @@
|
||||
{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";;;AAGA,2CAAwC;AAExC,MAAa,WAAY,SAAQ,qBAAS;IACtC,YAAY,MAAc,EAAS,GAAiB;QAChD,KAAK,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;QADY,QAAG,GAAH,GAAG,CAAc;IAEpD,CAAC;IAED,WAAW;QACP,8CAA8C;IAClD,CAAC;CACJ;AARD,kCAQC"}
|
||||
{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,aAAa;AACb,mDAAqC;AACrC,yCAAmC;AACnC,2CAAwC;AAExC,MAAa,WAAY,SAAQ,qBAAS;IACH;IAAnC,YAAY,MAAc,EAAS,GAAiB;QAChD,KAAK,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;QADY,QAAG,GAAH,GAAG,CAAc;IAEpD,CAAC;IAED,WAAW;QACP,8CAA8C;IAClD,CAAC;CACJ;AARD,kCAQC"}
|
||||
5
src/ElectronNET.Host/ElectronNET.Host.esproj
Normal file
5
src/ElectronNET.Host/ElectronNET.Host.esproj
Normal file
@@ -0,0 +1,5 @@
|
||||
<Project Sdk="Microsoft.VisualStudio.JavaScript.Sdk/1.0.3864779">
|
||||
<ItemGroup>
|
||||
<None Include=".vscode\tasks.json" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user