mirror of
https://github.com/ElectronNET/Electron.NET.git
synced 2026-07-18 14:47:43 +00:00
small changes
This commit is contained in:
@@ -411,7 +411,7 @@ namespace ElectronNET.API
|
||||
[Obsolete("Use the asynchronous version NameAsync instead")]
|
||||
get
|
||||
{
|
||||
return AsyncHelper.RunSync(async () => await NameAsync);
|
||||
return NameAsync.Result;
|
||||
}
|
||||
set
|
||||
{
|
||||
@@ -448,29 +448,6 @@ namespace ElectronNET.API
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public Task<string> GetName()
|
||||
|
||||
{
|
||||
|
||||
var taskCompletionSource = new TaskCompletionSource<string>();
|
||||
|
||||
BridgeConnector.Socket.On("appGetNameCompleted", (result) =>
|
||||
{
|
||||
BridgeConnector.Socket.Off("appGetNameCompleted");
|
||||
taskCompletionSource.SetResult((string)result);
|
||||
});
|
||||
|
||||
BridgeConnector.Socket.Emit("appGetName");
|
||||
|
||||
return taskCompletionSource.Task;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
internal App()
|
||||
{
|
||||
@@ -1524,7 +1501,7 @@ namespace ElectronNET.API
|
||||
[Obsolete("Use the asynchronous version UserAgentFallbackAsync instead")]
|
||||
get
|
||||
{
|
||||
return AsyncHelper.RunSync(async () => await UserAgentFallbackAsync);
|
||||
return UserAgentFallbackAsync.Result;
|
||||
}
|
||||
set
|
||||
{
|
||||
@@ -1549,10 +1526,10 @@ namespace ElectronNET.API
|
||||
var taskCompletionSource = new TaskCompletionSource<string>();
|
||||
|
||||
BridgeConnector.Socket.On("appGetUserAgentFallbackCompleted", (result) =>
|
||||
{
|
||||
BridgeConnector.Socket.Off("appGetUserAgentFallbackCompleted");
|
||||
taskCompletionSource.SetResult((string)result);
|
||||
});
|
||||
{
|
||||
BridgeConnector.Socket.Off("appGetUserAgentFallbackCompleted");
|
||||
taskCompletionSource.SetResult((string)result);
|
||||
});
|
||||
|
||||
BridgeConnector.Socket.Emit("appGetUserAgentFallback");
|
||||
|
||||
|
||||
@@ -4,9 +4,6 @@ using Newtonsoft.Json.Linq;
|
||||
using Newtonsoft.Json.Serialization;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Security.Cryptography.X509Certificates;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ElectronNET.API
|
||||
@@ -221,7 +218,7 @@ namespace ElectronNET.API
|
||||
{
|
||||
get
|
||||
{
|
||||
return AsyncHelper.RunSync(async () => await ChannelAsync);
|
||||
return ChannelAsync.Result;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -284,10 +281,10 @@ namespace ElectronNET.API
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Emitted when there is an error while updating.
|
||||
/// </summary>
|
||||
public event Action<string> OnError
|
||||
/// <summary>
|
||||
/// Emitted when there is an error while updating.
|
||||
/// </summary>
|
||||
public event Action<string> OnError
|
||||
{
|
||||
add
|
||||
{
|
||||
@@ -512,7 +509,7 @@ namespace ElectronNET.API
|
||||
string message = "An error occurred in CheckForUpdatesAsync";
|
||||
if (error != null && !string.IsNullOrEmpty(error.ToString()))
|
||||
message = JsonConvert.SerializeObject(error);
|
||||
taskCompletionSource.SetException(new ElectronException(message));
|
||||
taskCompletionSource.SetException(new Exception(message));
|
||||
});
|
||||
|
||||
BridgeConnector.Socket.Emit("autoUpdaterCheckForUpdates", guid);
|
||||
@@ -554,7 +551,7 @@ namespace ElectronNET.API
|
||||
string message = "An error occurred in autoUpdaterCheckForUpdatesAndNotify";
|
||||
if (error != null)
|
||||
message = JsonConvert.SerializeObject(error);
|
||||
taskCompletionSource.SetException(new ElectronException(message));
|
||||
taskCompletionSource.SetException(new Exception(message));
|
||||
});
|
||||
|
||||
BridgeConnector.Socket.Emit("autoUpdaterCheckForUpdatesAndNotify", guid);
|
||||
|
||||
@@ -1,28 +0,0 @@
|
||||
using System;
|
||||
|
||||
namespace ElectronNET.API.Entities
|
||||
{
|
||||
/// <summary>
|
||||
/// Electron Exception
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
public class ElectronException : Exception
|
||||
{
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public ElectronException()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="error"></param>
|
||||
public ElectronException(string error) : base(error)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user