1
0
mirror of synced 2024-11-14 09:29:17 +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;
// TODO validate input
// TODO profiles
namespace PettingZoo.UI.Connection
{

View File

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

View File

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

View File

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