public ClientSendAdminAction(string password, string textCommand) { if (!ServerAdminCommand.IsTextCommand(textCommand)) { throw new ArgumentException("this is not a text command"); } _password = password; _textCommand = textCommand; }
private void SendMessage(object obj) { if (string.IsNullOrWhiteSpace(Message)) { return; } try { if (ServerAdminCommand.IsTextCommand(Message)) { ClientModel.Api.Perform(new ClientSendAdminAction(Settings.Current.AdminPassword, Message)); AddSystemMessage(Message); } else if (SelectedReceiver.IsAllInRoom) { var action = SelectedMessageId == null ? new ClientSendMessageAction(Name, Message) : new ClientSendMessageAction(Name, SelectedMessageId.Value, Message); ClientModel.Api.Perform(action); } else { ClientModel.Api.Perform(new ClientSendPrivateMessageAction(SelectedReceiver.Nick, Message)); AddPrivateMessage(ClientModel.Client.Id, SelectedReceiver.Nick, Message); } } catch (SocketException se) { AddSystemMessage(se.Message); } finally { SelectedMessageId = null; Message = string.Empty; } }