1
0
mirror of synced 2024-11-15 01:33:51 +00:00

Fixed assembly/classname when publishing from a received message

This commit is contained in:
Mark van Renswoude 2021-12-15 13:16:48 +01:00
parent d7e21e508a
commit 4817b1806a
4 changed files with 15 additions and 5 deletions

View File

@ -2,6 +2,7 @@
using System.Windows.Input; using System.Windows.Input;
// TODO validate input // TODO validate input
// TODO profiles
namespace PettingZoo.UI.Connection namespace PettingZoo.UI.Connection
{ {

View File

@ -139,14 +139,14 @@ namespace PettingZoo.UI.Tab.Publisher
var tapetiPublisherViewModel = new TapetiPublisherViewModel(connection, fromReceivedMessage); var tapetiPublisherViewModel = new TapetiPublisherViewModel(connection, fromReceivedMessage);
tapetiPublisherView = new TapetiPublisherView(tapetiPublisherViewModel); tapetiPublisherView = new TapetiPublisherView(tapetiPublisherViewModel);
SetMessageTypeControl(MessageType.Tapeti); MessageType = MessageType.Tapeti;
} }
else else
{ {
var rawPublisherViewModel = new RawPublisherViewModel(connection, fromReceivedMessage); var rawPublisherViewModel = new RawPublisherViewModel(connection, fromReceivedMessage);
rawPublisherView = new RawPublisherView(rawPublisherViewModel); rawPublisherView = new RawPublisherView(rawPublisherViewModel);
SetMessageTypeControl(MessageType.Raw); MessageType = MessageType.Raw;
} }
} }
} }

View File

@ -226,12 +226,20 @@ namespace PettingZoo.UI.Tab.Publisher
Key = header.Key, Key = header.Key,
Value = header.Value Value = header.Value
}); });
PropertiesExpanded = AnyNotEmpty(AppId, ContentEncoding, Expiration, MessageId, Priority, Timestamp, TypeProperty, UserId);
} }
AddHeader(); AddHeader();
} }
private static bool AnyNotEmpty(params string?[] values)
{
return values.Any(s => !string.IsNullOrEmpty(s));
}
private void LastHeaderChanged(object? sender, PropertyChangedEventArgs e) private void LastHeaderChanged(object? sender, PropertyChangedEventArgs e)
{ {
LastHeader.PropertyChanged -= LastHeaderChanged; LastHeader.PropertyChanged -= LastHeaderChanged;

View File

@ -149,14 +149,15 @@ namespace PettingZoo.UI.Tab.Publisher
publishCommand = new DelegateCommand(PublishExecute, PublishCanExecute); publishCommand = new DelegateCommand(PublishExecute, PublishCanExecute);
if (receivedMessage == null) if (receivedMessage == null || !IsTapetiMessage(receivedMessage, out var receivedAssemblyName, out var receivedClassName))
return; return;
Exchange = receivedMessage.Exchange; Exchange = receivedMessage.Exchange;
RoutingKey = receivedMessage.RoutingKey; RoutingKey = receivedMessage.RoutingKey;
AssemblyName = assemblyName;
ClassName = className; AssemblyName = receivedAssemblyName;
ClassName = receivedClassName;
CorrelationId = receivedMessage.Properties.CorrelationId ?? ""; CorrelationId = receivedMessage.Properties.CorrelationId ?? "";
ReplyTo = receivedMessage.Properties.ReplyTo ?? ""; ReplyTo = receivedMessage.Properties.ReplyTo ?? "";
Payload = Encoding.UTF8.GetString(receivedMessage.Body); Payload = Encoding.UTF8.GetString(receivedMessage.Body);