diff --git a/src/Arma3BE.Client.Infrastructure/Events/BE/BECommand.cs b/src/Arma3BE.Client.Infrastructure/Events/BE/BECommand.cs index be970fb..6f35876 100644 --- a/src/Arma3BE.Client.Infrastructure/Events/BE/BECommand.cs +++ b/src/Arma3BE.Client.Infrastructure/Events/BE/BECommand.cs @@ -1,5 +1,5 @@ -using System; -using Arma3BE.Server; +using Arma3BE.Server; +using System; namespace Arma3BE.Client.Infrastructure.Events.BE { @@ -14,4 +14,14 @@ public BECommand(Guid serverId, CommandType commandType, string parameters = nul public string Parameters { get; } public CommandType CommandType { get; } } + + public class BECustomCommand : BEMessageBase + { + public string Command { get; set; } + + public BECustomCommand(Guid serverId, string command) : base(serverId) + { + Command = command; + } + } } \ No newline at end of file diff --git a/src/Arma3BE.Client.Modules.BEServerModule/BEService.cs b/src/Arma3BE.Client.Modules.BEServerModule/BEService.cs index e3b83ac..629f6cd 100644 --- a/src/Arma3BE.Client.Modules.BEServerModule/BEService.cs +++ b/src/Arma3BE.Client.Modules.BEServerModule/BEService.cs @@ -106,6 +106,7 @@ public ServerItem(ServerInfo info, IBEServer beServer, IEventAggregator eventAgg BEServer.MessageHandler += BEServer_MessageHandler; _eventAggregator.GetEvent>().Subscribe(Command); + _eventAggregator.GetEvent>().Subscribe(CustomCommand); } private void BEServer_MessageHandler(object sender, EventArgs e) @@ -154,6 +155,7 @@ protected override void DisposeManagedResources() BEServer.MessageHandler -= BEServer_MessageHandler; _eventAggregator.GetEvent>().Unsubscribe(Command); + _eventAggregator.GetEvent>().Unsubscribe(CustomCommand); BEServer.Disconnect(); BEServer.Dispose(); @@ -193,6 +195,16 @@ private void Command(BECommand command) } } + private void CustomCommand(BECustomCommand command) + { + var server = BEServer; + + if (Info.Id == command.ServerId && server != null && server.Connected) + { + server.SendCommand(command.Command); + } + } + private void BEServer_MissionHandler(object sender, BEClientEventArgs> e) { _eventAggregator.GetEvent>>().Publish(new BEItemsMessage(e.Data, Info.Id)); diff --git a/src/Arma3BE.Client.Modules.ChatModule/Chat/ChatControl.xaml b/src/Arma3BE.Client.Modules.ChatModule/Chat/ChatControl.xaml index a631d21..f84e12f 100644 --- a/src/Arma3BE.Client.Modules.ChatModule/Chat/ChatControl.xaml +++ b/src/Arma3BE.Client.Modules.ChatModule/Chat/ChatControl.xaml @@ -95,9 +95,28 @@ - - - + + + + + + + + + + + + + + + + + + +