mirror of
https://github.com/ElectronNET/Electron.NET.git
synced 2026-02-10 05:36:57 +00:00
43 lines
1.3 KiB
C#
43 lines
1.3 KiB
C#
using ElectronNET.API.Entities;
|
|
using Newtonsoft.Json;
|
|
using Newtonsoft.Json.Linq;
|
|
using Newtonsoft.Json.Serialization;
|
|
using Quobject.SocketIoClientDotNet.Client;
|
|
using System;
|
|
|
|
namespace ElectronNET.API
|
|
{
|
|
public static class App
|
|
{
|
|
private static Socket _socket;
|
|
private static JsonSerializer _jsonSerializer;
|
|
|
|
public static void OpenWindow(int width, int height, bool show)
|
|
{
|
|
_jsonSerializer = new JsonSerializer()
|
|
{
|
|
ContractResolver = new CamelCasePropertyNamesContractResolver()
|
|
};
|
|
|
|
_socket = IO.Socket("http://localhost:3000");
|
|
_socket.On(Socket.EVENT_CONNECT, () =>
|
|
{
|
|
Console.WriteLine("Verbunden!");
|
|
|
|
var browserWindowOptions = new BrowserWindowOptions() {
|
|
Height = height,
|
|
Width = width,
|
|
Show = show
|
|
};
|
|
|
|
_socket.Emit("createBrowserWindow", JObject.FromObject(browserWindowOptions, _jsonSerializer));
|
|
});
|
|
}
|
|
|
|
public static void CreateNotification(NotificationOptions notificationOptions)
|
|
{
|
|
_socket.Emit("createNotification", JObject.FromObject(notificationOptions, _jsonSerializer));
|
|
}
|
|
}
|
|
}
|