Skip to content

Commit e17a36f

Browse files
FreFre
authored andcommitted
small changes
1 parent deccebb commit e17a36f

File tree

4 files changed

+13
-68
lines changed

4 files changed

+13
-68
lines changed

ElectronNET.API/App.cs

Lines changed: 6 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -411,7 +411,7 @@ public string Name
411411
[Obsolete("Use the asynchronous version NameAsync instead")]
412412
get
413413
{
414-
return AsyncHelper.RunSync(async () => await NameAsync);
414+
return NameAsync.Result;
415415
}
416416
set
417417
{
@@ -448,29 +448,6 @@ public Task<string> NameAsync
448448
}
449449
}
450450

451-
/// <summary>
452-
///
453-
/// </summary>
454-
/// <returns></returns>
455-
public Task<string> GetName()
456-
457-
{
458-
459-
var taskCompletionSource = new TaskCompletionSource<string>();
460-
461-
BridgeConnector.Socket.On("appGetNameCompleted", (result) =>
462-
{
463-
BridgeConnector.Socket.Off("appGetNameCompleted");
464-
taskCompletionSource.SetResult((string)result);
465-
});
466-
467-
BridgeConnector.Socket.Emit("appGetName");
468-
469-
return taskCompletionSource.Task;
470-
471-
}
472-
473-
474451

475452
internal App()
476453
{
@@ -1524,7 +1501,7 @@ public string UserAgentFallback
15241501
[Obsolete("Use the asynchronous version UserAgentFallbackAsync instead")]
15251502
get
15261503
{
1527-
return AsyncHelper.RunSync(async () => await UserAgentFallbackAsync);
1504+
return UserAgentFallbackAsync.Result;
15281505
}
15291506
set
15301507
{
@@ -1549,10 +1526,10 @@ public Task<string> UserAgentFallbackAsync
15491526
var taskCompletionSource = new TaskCompletionSource<string>();
15501527

15511528
BridgeConnector.Socket.On("appGetUserAgentFallbackCompleted", (result) =>
1552-
{
1553-
BridgeConnector.Socket.Off("appGetUserAgentFallbackCompleted");
1554-
taskCompletionSource.SetResult((string)result);
1555-
});
1529+
{
1530+
BridgeConnector.Socket.Off("appGetUserAgentFallbackCompleted");
1531+
taskCompletionSource.SetResult((string)result);
1532+
});
15561533

15571534
BridgeConnector.Socket.Emit("appGetUserAgentFallback");
15581535

ElectronNET.API/AutoUpdater.cs

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,6 @@
44
using Newtonsoft.Json.Serialization;
55
using System;
66
using System.Collections.Generic;
7-
using System.Runtime.CompilerServices;
8-
using System.Security.Cryptography.X509Certificates;
9-
using System.Threading;
107
using System.Threading.Tasks;
118

129
namespace ElectronNET.API
@@ -221,7 +218,7 @@ public string Channel
221218
{
222219
get
223220
{
224-
return AsyncHelper.RunSync(async () => await ChannelAsync);
221+
return ChannelAsync.Result;
225222
}
226223
}
227224

@@ -284,10 +281,10 @@ public Dictionary<string, string> RequestHeaders
284281
}
285282
}
286283

287-
/// <summary>
288-
/// Emitted when there is an error while updating.
289-
/// </summary>
290-
public event Action<string> OnError
284+
/// <summary>
285+
/// Emitted when there is an error while updating.
286+
/// </summary>
287+
public event Action<string> OnError
291288
{
292289
add
293290
{
@@ -512,7 +509,7 @@ public Task<UpdateCheckResult> CheckForUpdatesAsync()
512509
string message = "An error occurred in CheckForUpdatesAsync";
513510
if (error != null && !string.IsNullOrEmpty(error.ToString()))
514511
message = JsonConvert.SerializeObject(error);
515-
taskCompletionSource.SetException(new ElectronException(message));
512+
taskCompletionSource.SetException(new Exception(message));
516513
});
517514

518515
BridgeConnector.Socket.Emit("autoUpdaterCheckForUpdates", guid);
@@ -554,7 +551,7 @@ public Task<UpdateCheckResult> CheckForUpdatesAndNotifyAsync()
554551
string message = "An error occurred in autoUpdaterCheckForUpdatesAndNotify";
555552
if (error != null)
556553
message = JsonConvert.SerializeObject(error);
557-
taskCompletionSource.SetException(new ElectronException(message));
554+
taskCompletionSource.SetException(new Exception(message));
558555
});
559556

560557
BridgeConnector.Socket.Emit("autoUpdaterCheckForUpdatesAndNotify", guid);

ElectronNET.API/Entities/ElectronException.cs

Lines changed: 0 additions & 28 deletions
This file was deleted.

ElectronNET.Host/api/autoUpdater.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,6 @@ export = (socket: SocketIO.Socket) => {
141141
});
142142
});
143143

144-
145144
socket.on('autoUpdaterQuitAndInstall', async (isSilent, isForceRunAfter) => {
146145
autoUpdater.quitAndInstall(isSilent, isForceRunAfter);
147146
});

0 commit comments

Comments
 (0)