Exemplo n.º 1
0
        public CServer()
        {
            // creates the server's remote object
            RemotingServices.Marshal(this, NAME_SERVER, typeof(CServer));

            _clients = new List <ChatClient>();

            _updateMessagesDelegate = new UpdateMessagesDelegate(UpdateMessages);
            _updateMessagesCallback = new AsyncCallback(UpdateMessagesCallback);
        }
Exemplo n.º 2
0
 public void UpdateMessages(string nickname, string message)
 {
     if (_form.ConversationTextBox.InvokeRequired)
     {
         Console.WriteLine("invoke");
         UpdateMessagesDelegate updateMessagesDelegate = new UpdateMessagesDelegate(UpdateMessages);
         _form.ConversationTextBox.Invoke(updateMessagesDelegate, new object[] { nickname, message });
     }
     else
     {
         Console.WriteLine("non invoke");
         _form.ConversationTextText += nickname + ": " + message + "\r\n";
     }
 }
Exemplo n.º 3
0
 internal void MessagesUpdated(IInformation clientInformation, string message)
 {
     object[] args = new Object[] {clientInformation.Name, message};
     Delegate d = new UpdateMessagesDelegate(UpdateMessages);
     Invoke(d, args);
 }