|
using System;
using DistributedCommand.Framework;
namespace DistributedCommand.Chat
{
/// <summary>
/// Client has been left and conversation
/// </summary>
[Serializable]
public class ClientLeftCommand : UICommand, ICommand
{
public ConnectedClient Client;
public ClientLeftCommand( ConnectedClient client )
{
this.Client = client;
}
void ICommand.Execute()
{
object itemToRemove = null;
// Remove the client from the client list
foreach( ConnectedClient client in base.UI.ClientListBox.Items )
{
if( client.ID == this.Client.ID )
{
base.UI.ChatHistoryTextBox.AppendText(
client.Name + " has left the room" + Environment.NewLine );
itemToRemove = client;
break;
}
}
if( null != itemToRemove )
{
base.UI.ClientListBox.Items.Remove( itemToRemove );
}
}
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.