public override void SendMessage (string command) { var message = new global::JabbR.Client.Models.ClientMessage{ Id = Guid.NewGuid ().ToString (), Room = this.Name, Content = command }; if (!command.TrimStart ().StartsWith ("/")) { OnMessageReceived (new MessageEventArgs (new ChannelMessage (message.Id, DateTimeOffset.Now, Server.CurrentUser.Name, command))); } Server.Client.Send (message).ContinueWith (task => { Application.Instance.Invoke (() => { MessageBox.Show ( Application.Instance.MainForm, string.Format ("Error sending message: {0}", task.Exception) ); }); }, TaskContinuationOptions.OnlyOnFaulted); }
public override void SendMessage (string command) { if (Client == null) { OnGlobalMessageReceived (new NotificationEventArgs (new NotificationMessage (DateTimeOffset.Now, "Cannot send command. You are not connected."))); return; } var message = new global::JabbR.Client.Models.ClientMessage{ Id = Guid.NewGuid ().ToString (), Content = command }; Client.Send (message).ContinueWith (task => { Application.Instance.Invoke (() => { MessageBox.Show (Application.Instance.MainForm, string.Format ("Error sending message: {0}", task.Exception)); }); }, TaskContinuationOptions.OnlyOnFaulted); }