|
@@ -173,6 +173,8 @@ namespace PRSDesktop
|
|
|
//new RPC stuff (temporary disabled - for enabling when RPC is ready)
|
|
|
_transport = new RpcClientSocketTransport(App.DatabaseSettings.URLs);
|
|
|
_transport.OnClose += TransportConnectionLost;
|
|
|
+ _transport.OnException += Transport_OnException;
|
|
|
+ _transport.OnOpen += Transport_OnOpen; ;
|
|
|
dbConnected = _transport.Connect();
|
|
|
ClientFactory.SetClientType(typeof(RpcClient<>), Platform.Wpf, CoreUtils.GetVersion(),
|
|
|
_transport);
|
|
@@ -446,9 +448,20 @@ namespace PRSDesktop
|
|
|
return ConnectionFailedResult.Ok;
|
|
|
}
|
|
|
|
|
|
+ private void Transport_OnOpen(IRpcTransport transport, RpcTransportOpenArgs e)
|
|
|
+ {
|
|
|
+ Logger.Send(LogType.Information, "Connection opened");
|
|
|
+ }
|
|
|
+
|
|
|
+ private void Transport_OnException(IRpcTransport transport, RpcTransportExceptionArgs e)
|
|
|
+ {
|
|
|
+ Logger.Send(LogType.Error, $"Error in connection: {CoreUtils.FormatException(e.Exception)}");
|
|
|
+ }
|
|
|
+
|
|
|
private void TransportConnectionLost(IRpcTransport transport, RpcTransportCloseArgs e)
|
|
|
{
|
|
|
- if ((transport is IRpcClientTransport client))
|
|
|
+ Logger.Send(LogType.Information, ClientFactory.UserID, "Connection lost");
|
|
|
+ if (transport is IRpcClientTransport client)
|
|
|
{
|
|
|
Dispatcher.Invoke(() =>
|
|
|
{
|
|
@@ -463,9 +476,10 @@ namespace PRSDesktop
|
|
|
try
|
|
|
{
|
|
|
Logger.Send(LogType.Error, ClientFactory.UserID, "Reconnecting - ({0:hh\\:mm})", DateTime.Now - lost);
|
|
|
- client.Connect(ct);
|
|
|
- if (client.IsConnected())
|
|
|
+ if (client.Connect(ct))
|
|
|
+ {
|
|
|
break;
|
|
|
+ }
|
|
|
}
|
|
|
catch (System.Exception e1)
|
|
|
{
|
|
@@ -474,7 +488,9 @@ namespace PRSDesktop
|
|
|
}
|
|
|
if (client.IsConnected())
|
|
|
{
|
|
|
+ Logger.Send(LogType.Information, ClientFactory.UserID, "Reconnected");
|
|
|
ClientFactory.Validate(ClientFactory.SessionID);
|
|
|
+ Logger.Send(LogType.Information, ClientFactory.UserID, "Validated");
|
|
|
}
|
|
|
}
|
|
|
catch (Exception e)
|
|
@@ -3213,12 +3229,12 @@ namespace PRSDesktop
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- Logger.Send(LogType.Information, ClientFactory.UserID, CoreUtils.FormatException(remote));
|
|
|
+ Logger.Send(LogType.Information, ClientFactory.UserID, $"Error in CheckIsLoggedOn(): {CoreUtils.FormatException(remote)}");
|
|
|
}
|
|
|
}
|
|
|
else if (e is not null)
|
|
|
{
|
|
|
- Logger.Send(LogType.Information, ClientFactory.UserID, CoreUtils.FormatException(e));
|
|
|
+ Logger.Send(LogType.Information, ClientFactory.UserID, $"Error in CheckIsLoggedOn(): {CoreUtils.FormatException(e)}");
|
|
|
}
|
|
|
else if (o is not null)
|
|
|
{
|