/// <summary> /// Inheritors should override this method to implement custom Command handling functionality /// </summary> /// <remarks>Code in this method is protected by a Queue Lock. /// This method is called with the Message Dispatch thread exclusively. /// Some commands (Shutdown, Flush) are handled by MessengerBase and redirected into specific /// method calls.</remarks> /// <param name="command">The MessagingCommand enum value of this command.</param> /// <param name="state"></param> /// <param name="writeThrough">Whether write-through (synchronous) behavior was requested.</param> /// <param name="maintenanceRequested">Specifies whether maintenance mode has been requested and the type (source) of that request.</param> protected override void OnCommand(MessagingCommand command, object state, bool writeThrough, ref MaintenanceModeRequest maintenanceRequested) { if (command == MessagingCommand.CloseFile) { // This command is for us! It means issue maintenance mode to close and roll over to a new file. maintenanceRequested = MaintenanceModeRequest.Explicit; } }
protected override void OnCommand(MessagingCommand command, object state, bool writeThrough, ref MaintenanceModeRequest maintenanceRequested) { switch (command) { case MessagingCommand.OpenRemoteViewer: //open an outbound pending connection. var options = (NetworkConnectionOptions)state; StartLiveView(options, Guid.Empty, Guid.NewGuid()); //this is a new channel we're opening. break; case MessagingCommand.ExitMode: //close all of our outbound connections. OnClose(); break; } }
/// <summary> /// Create a new command packet for the provided command, with state. /// </summary> /// <param name="command"></param> /// <param name="state"></param> public CommandPacket(MessagingCommand command, object state) { Command = command; State = state; }
/// <summary> /// Create a new command packet for the provided command. /// </summary> /// <param name="command"></param> public CommandPacket(MessagingCommand command) { Command = command; State = null; }
/// <summary> /// Initializes a new instance of the <see cref="ProvisionDeviceEvent" /> class. /// </summary> /// <param name="command">The command.</param> /// <param name="entity">The entity.</param> public ProvisionDeviceEvent(MessagingCommand command, Device entity) : base() { this.Command = command; this.Entity = entity; }