mirror of
https://github.com/ElectronNET/Electron.NET.git
synced 2026-07-18 14:47:43 +00:00
implement first dialog-, notification-, tray- and menu-api functions
This commit is contained in:
39
ElectronNET.API/Notification.cs
Normal file
39
ElectronNET.API/Notification.cs
Normal file
@@ -0,0 +1,39 @@
|
||||
using ElectronNET.API.Entities;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using Newtonsoft.Json.Serialization;
|
||||
|
||||
namespace ElectronNET.API
|
||||
{
|
||||
public sealed class Notification
|
||||
{
|
||||
private static Notification _notification;
|
||||
|
||||
internal Notification() { }
|
||||
|
||||
internal static Notification Instance
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_notification == null)
|
||||
{
|
||||
_notification = new Notification();
|
||||
}
|
||||
|
||||
return _notification;
|
||||
}
|
||||
}
|
||||
|
||||
public void Show(NotificationOptions notificationOptions)
|
||||
{
|
||||
BridgeConnector.Socket.Emit("createNotification", JObject.FromObject(notificationOptions, _jsonSerializer));
|
||||
}
|
||||
|
||||
private JsonSerializer _jsonSerializer = new JsonSerializer()
|
||||
{
|
||||
ContractResolver = new CamelCasePropertyNamesContractResolver(),
|
||||
NullValueHandling = NullValueHandling.Ignore,
|
||||
DefaultValueHandling = DefaultValueHandling.Ignore
|
||||
};
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user