From 027bdea4e80e638440a2b4ff341da03a313160b2 Mon Sep 17 00:00:00 2001 From: Nick <921260+divinci@users.noreply.github.com> Date: Wed, 30 Oct 2019 21:37:31 +0000 Subject: [PATCH] Not working (#58) --- .../DemoData.cs | 7 ++++++- .../Pages/ChatComponent.cs | 13 ++++++++++++- .../Hubs/ChatHub.cs | 4 ++-- 3 files changed, 20 insertions(+), 4 deletions(-) diff --git a/test/Blazor.Extensions.SignalR.Test.Client/DemoData.cs b/test/Blazor.Extensions.SignalR.Test.Client/DemoData.cs index 4666014..7b41b7d 100644 --- a/test/Blazor.Extensions.SignalR.Test.Client/DemoData.cs +++ b/test/Blazor.Extensions.SignalR.Test.Client/DemoData.cs @@ -1,8 +1,13 @@ +using System; + namespace Blazor.Extensions.SignalR.Test.Client { public class DemoData { - public int Id { get; set; } + public long Id { get; set; } public string Data { get; set; } + public decimal DecimalData { get; set; } + public DateTime DateTime { get; set; } + public bool Bool { get; set; } } } diff --git a/test/Blazor.Extensions.SignalR.Test.Client/Pages/ChatComponent.cs b/test/Blazor.Extensions.SignalR.Test.Client/Pages/ChatComponent.cs index f763ef1..d1195d9 100644 --- a/test/Blazor.Extensions.SignalR.Test.Client/Pages/ChatComponent.cs +++ b/test/Blazor.Extensions.SignalR.Test.Client/Pages/ChatComponent.cs @@ -108,7 +108,18 @@ private async Task GetJwtToken(string userId) private Task Handle(object msg) { Console.WriteLine(msg); - this.Messages.Add(msg.ToString()); + if(msg is DemoData[]) + { + var demoDatas = msg as DemoData[]; + foreach(var demoData in demoDatas) + { + this.Messages.Add($"demoData.id({demoData.Id}) | demoData.Data({demoData.Data}) | demoData.DateTime({demoData.DateTime}) | demoData.DecimalData({demoData.DecimalData}) | demoData.Bool({demoData.Bool})"); + } + } + else + { + this.Messages.Add(msg.ToString()); + } this.StateHasChanged(); return Task.CompletedTask; } diff --git a/test/Blazor.Extensions.SignalR.Test.Server/Hubs/ChatHub.cs b/test/Blazor.Extensions.SignalR.Test.Server/Hubs/ChatHub.cs index 8ad93d1..5e620bf 100644 --- a/test/Blazor.Extensions.SignalR.Test.Server/Hubs/ChatHub.cs +++ b/test/Blazor.Extensions.SignalR.Test.Server/Hubs/ChatHub.cs @@ -43,8 +43,8 @@ public Task DoMultipleArgs() public Task DoMultipleArgsComplex() { - return this.Clients.All.SendAsync("DemoMultiArgs2", new DemoData { Id = 1, Data = "Demo Data" }, - Enumerable.Range(1, 10).Select(x => new DemoData { Id = x, Data = $"Demo Data #{x}" }).ToList()); + return this.Clients.All.SendAsync("DemoMultiArgs2", new DemoData { Id = 1, Data = "Demo Data", DecimalData = 0.000000001M, DateTime = DateTime.UtcNow, Bool = true }, + Enumerable.Range(1, 10).Select(x => new DemoData { Id = x, Data = $"Demo Data #{x}", DecimalData = x * 0.000000001M , DateTime = DateTime.UtcNow.AddSeconds(-x), Bool = (x % 2 == 0) }).ToList()); } public Task Send(string message)