Developer Programs

Learn

Docs

AnimChng

API Reference > AnimChng
SoapActionn/a
Input NameAnimChng
Output NameAnimChngResponse
Input Namespacen/a
Group NameXperience
ContainerXP_MsgBus.xsd
AnimChng.cs
this.messageBus.Subscribe(this.OnAnimate, SubscriptionThreadOption.UIThread);

private void OnAnimate(IMessageContext context)
{
    if (this.MessageError(context))
    {
        return;
    }

    var animate = context.DeserializeMessage();
    var state = animate.AnimState != null ? animate.AnimState.Value : "null";
    this.UpdateListbox("Animate message was received!");
    this.UpdateListbox("Animation State:  " + state);
}

private bool MessageError(
    IMessageContext context)
{
    var result = false;
    if (context != null
        && !context.IsValid())
    {
        var sb = new StringBuilder();

        sb.AppendLine();
        sb.AppendLine("MESSAGE ERRORS");
        sb.Append(Helper.CollectionErrors(context.MessageErrors));
        sb.AppendLine($"Message Action:  {context.Action}");
        sb.AppendLine($"Serialized message:  {context.SerializedMessage}");
        sb.AppendLine($"Message Source:  {context.Source}");

        this.UpdateListbox(sb.ToString(), false, true);

        result = true;
    }
    else if (string.IsNullOrEmpty(context?.SerializedMessage))
    {
        this.UpdateListbox("The RESPONSE MESSAGE IS NULL OR MISSING THE SERIALIZED MESSAGE");
    }

    return result;
}

Did this page help you?

Last updated Mon Dec 9 2024