Пример #1
0
        /*
         * Method :		readmsg()
         * Description:    This is a Thread keep reading the message which recived from the server
         * Return value:	No
         */
        private void Readmsg()
        {
            try
            {
                MyCallback   callback = new MyCallback(UpdateChatArea);
                StreamReader input    = new StreamReader(clientList[1]);

                // Read the message and invoke the update listbox
                while (connect)
                {
                    string inp = input.ReadLine();

                    if (inp != null)
                    {
                        //==============================
                        // DECRYPT the receiving message
                        //inp = blowFish.Decrypt_CBC(inp);

                        if (inp == "shutdown")
                        {
                            // check if the client is connected
                            Shutdown();
                            break;
                        }
                        Dispatcher.Invoke(callback, inp);
                    }
                }
            }
            catch (Exception ex)
            {
                Error.Content = ex;
            }
        }
Пример #2
0
 public ChatClient()
 {
     Events          = new MyCallback();
     Events.OnLogin += Login;
     Events.OnLeave += Leave;
     Client          = new ChatService.ChatServiceClient(new InstanceContext(Events));
 }