@using System.Collections.Specialized @using LANCommander.SDK @using LANCommander.SDK.Services @using Microsoft.AspNetCore.Components.Web.Virtualization @inject ChatClient ChatClient @namespace LANCommander.UI.Components
@code { [Parameter] public Guid Id { get; set; } ICollection _messageGroups = new List(); 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 = ChatClient.GetThread(Id); _thread.MessageGroups.CollectionChanged += MessageGroupsOnCollectionChanged; } } void MessageGroupsOnCollectionChanged(object? sender, NotifyCollectionChangedEventArgs e) { StateHasChanged(); } async Task SendMessage(string contents) { await ChatClient.SendMessageAsync(Id, contents); } }