示例#1
0
        public void RecieveMessage(MOG_Command message)
        {
            // Check if this is a first time response
            if (mHandle.Length == 0)
            {
                mHandle = message.GetVersion();
            }
            else if (string.Compare(mHandle, message.GetVersion(), true) != 0)
            {
                // This is not our conversation
                return;
            }

            string userMessage = message.GetDescription();
            string user        = message.GetUser();

            // Update title of box to show who is talking

            // Update message window
            MessagesRichTextBox.AppendText(string.Concat("<", user, ">: ", userMessage));

            // Add a carriage return if the message does not have one
            if (!userMessage.EndsWith("\n"))
            {
                MessagesRichTextBox.AppendText(string.Concat(MessagesRichTextBox.Text, "\n"));
            }

            // Make sure we scroll to the bottom
            MessagesRichTextBox.Focus();
            MessagesRichTextBox.ScrollToCaret();
            SendRichTextBox.Focus();

            // Update users
            mActive = message.GetDestination();
            UpdateUsers();

            // Play sound
            mainForm.mSoundManager.PlayStatusSound("ClientEvents", "RecieveChat");
        }