public void Handle(object sender, PrivRequestEventArgs e) { string message = string.Empty; Command <IPrivRequest> command = FetchFromSet(e.RequestName, privCommands); message = command?.Execute(e); if (!string.IsNullOrEmpty(message)) { client.SendMessage(message); } }
public void Handle(object sender, WhisperRequestEventArgs e) { string message = string.Empty; Command <IWhisperRequest> command = FetchFromSet(e.RequestName, whisperCommands); message = command?.Execute(e); if (!string.IsNullOrEmpty(message)) { client.Whisper(e.User, message); } }
static void Main(string[] args) { // creates a queue of commands and executes it when you deem appropriate // example: ICommand, undo/redo functionality. for each action, an inverse action // is a pushed onto a stack and popped when the appropriate button is clicked // CQRS uses the command pattern // https://en.wikipedia.org/wiki/Command_pattern var command = new Command(); //command.CanExecuteChanged += (sender, eventArgs) => Console.WriteLine("Action added."); command.Add(() => Console.WriteLine("I'm creating an action.")); command.Add(() => Console.WriteLine("But it's not getting executed just yet.")); command.Add(() => Console.WriteLine("For that I need to process the queue.")); command.Add(() => Console.WriteLine("Voila, done!")); Console.WriteLine("Executing commands sequentially:"); command.Execute(true); Console.WriteLine(); Console.WriteLine("Executing commands in parallell:"); command.Execute(false); Console.ReadLine(); }
public void PressButton() { _command.Execute(); }
public void Compute(Command command) { command.Execute(); commands.Add(command); current++; }
public void ClickValidate() { Console.WriteLine("Formulario - Invoker: Validando Usuario "); _command.Execute(); }
public void ExecuteCommand() { command.Execute(); }
public void ButtonPress() { command.Execute(); }
public void ExecuteCommand() { _cmd.Execute(); }
public void ButtonWasPressd() { slot.Execute(); }