Files
StockSharp/Messages/ProcessSuspendedMessage.cs
mika@stocksharp.com 7299a97cb6 Messages: allow building ProcessSuspendedMessage with an argument and no loopback
The only way to attach an Arg to a ProcessSuspendedMessage was the adapter constructor, which loops the
message back and therefore requires a non-null adapter. Add a constructor that takes just the argument
for cases that feed the message directly to a manager. Fix the native-id reset test, which passed a null
adapter and threw before it could verify that reset clears the suspended state.
2026-06-20 00:31:19 +03:00

52 lines
1.3 KiB
C#

namespace StockSharp.Messages;
/// <summary>
/// Process suspended action.
/// </summary>
[DataContract]
[Serializable]
public class ProcessSuspendedMessage : Message
{
/// <summary>
/// Additional argument.
/// </summary>
[DataMember]
public object Arg { get; }
/// <summary>
/// Initializes a new instance of the <see cref="ProcessSuspendedMessage"/>.
/// </summary>
public ProcessSuspendedMessage()
: base(MessageTypes.ProcessSuspended)
{
}
/// <summary>
/// Initializes a new instance of the <see cref="ProcessSuspendedMessage"/> carrying an argument for
/// direct processing, without a loopback adapter.
/// </summary>
/// <param name="arg">Additional argument.</param>
public ProcessSuspendedMessage(object arg)
: this()
{
Arg = arg;
}
/// <summary>
/// Initializes a new instance of the <see cref="ProcessSuspendedMessage"/>.
/// </summary>
/// <param name="adapter">Adapter.</param>
/// <param name="arg">Additional argument.</param>
public ProcessSuspendedMessage(IMessageAdapter adapter, object arg = default)
: this()
{
this.LoopBack(adapter);
Arg = arg;
}
/// <summary>
/// Create a copy of <see cref="ProcessSuspendedMessage"/>.
/// </summary>
/// <returns>Copy.</returns>
public override Message Clone() => new ProcessSuspendedMessage(Adapter, Arg);
}