public async Task Send <TCommand>(TCommand command, CancellationToken cancellationToken) where TCommand : ICommand { var handler = _lifetimeScope.Resolve <IHandleCommand <TCommand> >(); await handler.Handle(command, cancellationToken); CommandSent?.Invoke(this, new CommandSentEventArgs(command)); }
private FTPResponse SendCommand(string command, bool checkConnection) { // make sure we're connected if (checkConnection) { CheckConnect(); } // encode the command byte[] bytes = Encoding.ASCII.GetBytes((command + "\r\n").ToCharArray()); // send it m_cmdsocket.Send(bytes, bytes.Length, 0); if (CommandSent != null) { foreach (FTPCommandHandler ch in CommandSent.GetInvocationList()) { ch(this, command); } } ReadResponse(); return(m_response); }
protected virtual void OnCommandSent(SerialEventArgs info) { if (CommandSent != null) { Task.Run(() => CommandSent?.Invoke(this, info)); } }
public override void SendCommand(string command) { if (!Port.IsOpen) { return; } Port.Write(command); CommandSent?.Invoke(this, command); Thread.Sleep(Delay); }
public override void SendCommand(string command) { if (!IsConnected) { return; } var stream = Client.GetStream(); var data = Encoding.ASCII.GetBytes(command); stream.Write(data, 0, data.Length); CommandSent?.Invoke(this, command); Thread.Sleep(Delay); }
/// <summary> /// ボナンザへの書き込みを行います。 /// </summary> private void WriteMain(object arg) { var writer = (StreamWriter)arg; while (!this.aborted) { var command = GetWriteCommand(); if (command == null) { continue; } writer.WriteLine(command + "\n"); writer.Flush(); CommandSent.SafeRaiseEvent(this, new BonanzaReceivedCommandEventArgs(command)); } }
private void OnCommandSent(string command) { CommandSent?.Invoke(this, new PortCommandSentEventArgs(command)); }
internal static void InvokeCommandSent(CommandSentArgs args) { CommandSent?.Invoke(null, args); }
protected virtual void OnCommandSent(ICommand command) => CommandSent?.Invoke(this, command);
public void RaiseCommand(BaseCommand <TGame, TPlayer, TRoom, TContainer, TThing> cmd) => CommandSent?.Invoke(this, cmd);
/// <summary> /// Raises the <see cref="CommandSent"/> event with passed data. /// </summary> /// <param name="message">NMDC-message that represents the <paramref name="command"/>.</param> /// <param name="command">Sent command.</param> private void OnCommandSent(string message, NmdcCommand command) { CommandSent?.Invoke(this, new NmdcCommandTransferredArgs(DateTime.Now, message, command)); }
private void OnCommandSent(string command) { CommandSent?.Invoke(this, command); }