Exemple #1
0
        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));
        }
Exemple #2
0
 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);
 }
Exemple #4
0
        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);
        }
Exemple #5
0
 private void OnCommandSent(string command)
 {
     CommandSent?.Invoke(this, new PortCommandSentEventArgs(command));
 }
Exemple #6
0
 internal static void InvokeCommandSent(CommandSentArgs args)
 {
     CommandSent?.Invoke(null, args);
 }
 protected virtual void OnCommandSent(ICommand command) =>
 CommandSent?.Invoke(this, command);
Exemple #8
0
 public void RaiseCommand(BaseCommand <TGame, TPlayer, TRoom, TContainer, TThing> cmd) => CommandSent?.Invoke(this, cmd);
Exemple #9
0
 /// <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));
 }
Exemple #10
0
 private void OnCommandSent(string command)
 {
     CommandSent?.Invoke(this, command);
 }