From 13df961a3fa63406388870400f9b766a2f469b81 Mon Sep 17 00:00:00 2001 From: yuhuang Date: Mon, 27 Feb 2017 15:55:58 +0800 Subject: [PATCH 1/2] get and set the connection's name --- ExampleCLI/ExampleCLI.csproj | 2 +- ExampleGUI/ExampleGUI.csproj | 2 +- NamedPipeWrapper/NamedPipeConnection.cs | 2 +- NamedPipeWrapper/NamedPipeWrapper.csproj | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/ExampleCLI/ExampleCLI.csproj b/ExampleCLI/ExampleCLI.csproj index 49e786d..ebf7d91 100644 --- a/ExampleCLI/ExampleCLI.csproj +++ b/ExampleCLI/ExampleCLI.csproj @@ -20,7 +20,7 @@ true full false - bin\Debug\ + ..\bin\ DEBUG;TRACE prompt 4 diff --git a/ExampleGUI/ExampleGUI.csproj b/ExampleGUI/ExampleGUI.csproj index 163a9e7..6e22e07 100644 --- a/ExampleGUI/ExampleGUI.csproj +++ b/ExampleGUI/ExampleGUI.csproj @@ -20,7 +20,7 @@ true full false - bin\Debug\ + ..\bin\ DEBUG;TRACE prompt 4 diff --git a/NamedPipeWrapper/NamedPipeConnection.cs b/NamedPipeWrapper/NamedPipeConnection.cs index 1894718..6fa16bd 100644 --- a/NamedPipeWrapper/NamedPipeConnection.cs +++ b/NamedPipeWrapper/NamedPipeConnection.cs @@ -28,7 +28,7 @@ public class NamedPipeConnection /// /// Gets the connection's name. /// - public string Name { get; } + public string Name { get; set; } /// /// Gets a value indicating whether the pipe is connected or not. diff --git a/NamedPipeWrapper/NamedPipeWrapper.csproj b/NamedPipeWrapper/NamedPipeWrapper.csproj index 90ec8e9..78a6119 100644 --- a/NamedPipeWrapper/NamedPipeWrapper.csproj +++ b/NamedPipeWrapper/NamedPipeWrapper.csproj @@ -21,7 +21,7 @@ true full false - bin\Debug\ + ..\bin\ DEBUG;TRACE prompt 4 From e4ecd92e8a0715e38f52be5af6d717ad2c9ffa4f Mon Sep 17 00:00:00 2001 From: yuhuang Date: Mon, 27 Feb 2017 16:35:28 +0800 Subject: [PATCH 2/2] send message to selected client --- ExampleGUI/FormServer.cs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/ExampleGUI/FormServer.cs b/ExampleGUI/FormServer.cs index d9f0b9d..d66f65f 100644 --- a/ExampleGUI/FormServer.cs +++ b/ExampleGUI/FormServer.cs @@ -70,8 +70,16 @@ private void buttonSend_Click(object sender, EventArgs e) { if (string.IsNullOrWhiteSpace(textBoxMessage.Text)) return; - - _server.PushMessage(textBoxMessage.Text); + if (listBoxClients.SelectedItem == null) + { + _server.PushMessage(textBoxMessage.Text); + } + else + { + var name = listBoxClients.SelectedItem.ToString(); + _server.PushMessage(textBoxMessage.Text, name); + } + textBoxMessage.Text = ""; } }