using Avalonia.Controls; using System; using System.Linq; namespace CollabVMClient.Views { public partial class CollabVMChatView : Window { public event EventHandler ChatSend; public CollabVMChatView() { InitializeComponent(); chatInput.KeyDown += (s, e) => { if (e.Key == Avalonia.Input.Key.Return) SendChat(); }; sendBtn.Click += (s, e) => SendChat(); } private void SendChat() { if (string.IsNullOrEmpty(chatInput.Text) || chatInput.Text.ToCharArray().All(c => c == ' ')) return; ChatSend.Invoke(this, chatInput.Text); chatInput.Text = ""; } } }