From ecad72bc5574f2333e9786bcd62fa37a37fa0eb3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Franti=C5=A1ek=20Boh=C3=A1=C4=8Dek?= Date: Wed, 15 Feb 2023 08:55:19 +0100 Subject: [PATCH] chore: update dependencies --- src/PacketLogger/PacketLogger.csproj | 10 ++--- .../ViewModels/DocumentViewModel.cs | 42 ++++++++++++++++++- 2 files changed, 45 insertions(+), 7 deletions(-) diff --git a/src/PacketLogger/PacketLogger.csproj b/src/PacketLogger/PacketLogger.csproj index c135744..75ba3a8 100644 --- a/src/PacketLogger/PacketLogger.csproj +++ b/src/PacketLogger/PacketLogger.csproj @@ -31,16 +31,16 @@ - + All None - - - - + + + + diff --git a/src/PacketLogger/ViewModels/DocumentViewModel.cs b/src/PacketLogger/ViewModels/DocumentViewModel.cs index 38a1b81..9e99703 100644 --- a/src/PacketLogger/ViewModels/DocumentViewModel.cs +++ b/src/PacketLogger/ViewModels/DocumentViewModel.cs @@ -22,7 +22,9 @@ using Dock.Model.Mvvm.Controls; using DynamicData.Binding; using Microsoft.Extensions.DependencyInjection; using NosSmooth.Comms.Data.Messages; +using NosSmooth.Comms.Inject.Messages; using NosSmooth.Comms.Local; +using NosSmooth.Comms.Local.Extensions; using NosSmooth.Core.Contracts; using NosSmooth.Core.Extensions; using NosSmooth.Core.Stateful; @@ -188,8 +190,8 @@ public class DocumentViewModel : Document, INotifyPropertyChanged, IDisposable return; } - var handshakeInitResponse = handshakeResponse.InitializationErrorfulResult ?? Result.FromSuccess(); - if (!handshakeInitResponse.IsSuccess) + var handshakeInitResponse = handshakeResponse.InitializationResult; + if (handshakeInitResponse is not null && !handshakeInitResponse.Value.IsSuccess) { repository.Remove(connection.Client); Error = "An error has occurred during handshaking: " + handshakeInitResponse.ToFullString(); @@ -197,6 +199,42 @@ public class DocumentViewModel : Document, INotifyPropertyChanged, IDisposable return; } + if (handshakeInitResponse is null) + { + var runClientContractResult = await connection.Connection.ContractRunClient(new RunClientRequest()) + .WaitForAsync(DefaultStates.ResponseObtained, ct: ct); + + if (!runClientContractResult.IsDefined(out var runClientResponse)) + { + repository.Remove(connection.Client); + Error = "An error has occurred upon sending run client: " + runClientContractResult.ToFullString(); + Loading = false; + return; + } + + if (runClientResponse.InitializationResult is null) + { + repository.Remove(connection.Client); + Error = "Unknown error"; + Loading = false; + return; + } + + if (runClientResponse.BindingManagerResult is not null && !runClientResponse.BindingManagerResult.Value.IsSuccess) + { + Console.WriteLine("There was an error in binding initialization."); + Console.WriteLine(runClientResponse.BindingManagerResult.Value.ToFullString()); + } + + if (!runClientResponse.InitializationResult.Value.IsSuccess) + { + repository.Remove(connection.Client); + Error = "An error has occurred during starting client: " + runClientResponse.InitializationResult.ToFullString(); + Loading = false; + return; + } + } + _titleHandle?.Dispose(); _titleHandle = titleGenerator.AddTitle ( -- 2.48.1