Updated the winforms app and make it work with the chat sample

This commit is contained in:
David Fowler 2018-05-13 23:49:10 -07:00
Родитель 53b58bbbb1
Коммит 77e7a20f83
2 изменённых файлов: 7 добавлений и 11 удалений

Просмотреть файл

@ -32,7 +32,7 @@ namespace WindowsFormsSample
.WithUrl(addressTextBox.Text)
.Build();
_connection.On<string>("Send", OnSend);
_connection.On<string, string>("broadcastMessage", OnSend);
Log(Color.Gray, "Starting connection...");
try
@ -78,7 +78,7 @@ namespace WindowsFormsSample
{
try
{
await _connection.InvokeAsync("Send", messageTextBox.Text);
await _connection.InvokeAsync("Send", "WinFormsApp", messageTextBox.Text);
}
catch (Exception ex)
{
@ -96,9 +96,9 @@ namespace WindowsFormsSample
sendButton.Enabled = connected;
}
private void OnSend(string message)
private void OnSend(string name, string message)
{
Log(Color.Black, message);
Log(Color.Black, name + ": " + message);
}
private void Log(Color color, string message)

Просмотреть файл

@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
@ -81,13 +81,9 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.SignalR.Client">
<Version>1.0.0-preview2-final</Version>
<Version>1.0.0-rc1-final</Version>
</PackageReference>
<!-- Workaround for https://github.com/dotnet/corefx/issues/29149 -->
<PackageReference Include="System.Numerics.Vectors">
<Version>4.5.0-preview2-26406-04</Version>
</PackageReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
</Project>