Winify
/trunk/Winify/Gotify/GotifyConnection.cs |
@@ -9,6 +9,7 @@ |
using System.Threading.Tasks; |
using Newtonsoft.Json; |
using Serilog; |
using Servers; |
using ClientWebSocket = System.Net.WebSockets.Managed.ClientWebSocket; |
|
namespace Winify.Gotify |
@@ -33,6 +34,13 @@ |
|
private ClientWebSocket _webSocketClient; |
|
private readonly Server _server; |
|
public GotifyConnection(Server server) |
{ |
_server = server; |
} |
|
#endregion |
|
#region Constructors, Destructors and Finalizers |
@@ -93,6 +101,8 @@ |
{ |
_cancellationTokenSource.Cancel(); |
} |
|
_runTask.Wait(CancellationToken.None); |
} |
|
#endregion |
@@ -140,6 +150,8 @@ |
continue; |
} |
|
gotifyNotification.Server = _server; |
|
if (!Uri.TryCreate($"{httpUri}/application", UriKind.Absolute, out var applicationUri)) |
{ |
continue; |
/trunk/Winify/Gotify/GotifyConnectionManager.cs |
@@ -109,7 +109,7 @@ |
|
private void CreateConnection(Server server) |
{ |
var connection = new GotifyConnection(); |
var connection = new GotifyConnection(server); |
connection.GotifyNotification += Connection_GotifyNotification; |
|
connection.Start(server.Username, server.Password, server.Url); |
/trunk/Winify/Gotify/GotifyNotification.cs |
@@ -1,5 +1,6 @@ |
using System; |
using Newtonsoft.Json; |
using Servers; |
|
namespace Winify.Gotify |
{ |
@@ -25,6 +26,8 @@ |
[JsonProperty(PropertyName = "date")] |
public DateTime Date { get; set; } |
|
public Server Server { get; set; } |
|
#endregion |
} |
} |