@using System.Collections.Specialized @using LANCommander.SDK @using Microsoft.AspNetCore.Components.Web.Virtualization @inject Client Client
@code { [Parameter] public Guid Id { get; set; } ICollection _messageGroups; ICollection _messages = new List(); SDK.Models.ChatThread _thread; bool _sendingMessage = false; string _inputContents = String.Empty; protected override async Task OnParametersSetAsync() { if (Id != Guid.Empty) { _thread = Client.Chat.GetThread(Id); _thread.MessageGroups.CollectionChanged += MessageGroupsOnCollectionChanged; } } void MessageGroupsOnCollectionChanged(object? sender, NotifyCollectionChangedEventArgs e) { StateHasChanged(); } async Task SendMessage(PressEnterEventArgs args) { if (!args.ShiftKey) { _sendingMessage = true; await Client.Chat.SendMessageAsync(Id, _inputContents); } } }