27 lines
739 B
C#
27 lines
739 B
C#
using Avalonia.Controls;
|
|
using System;
|
|
using System.Linq;
|
|
|
|
namespace CollabVMClient.Views
|
|
{
|
|
public partial class CollabVMChatView : Window
|
|
{
|
|
public event EventHandler<string> 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 = "";
|
|
}
|
|
}
|
|
}
|