Exemplo n.º 1
0
        public void SendMessage(object o)
        {
            string message = (string)o;

            message = message != null ? message : UserCurrentMessage;
            MessageInterpreter interpreter = new MessageInterpreter();

            if (interpreter.IsHistoryRequest(message))
            {
                ShowOlderMessages(o);
            }
            else if (SharedChatModel.IsInPartyChat())
            {
                if (interpreter.IsAGuess(message))
                {
                    ServerService.Answer(interpreter.ExtractWordFromCommand(message));
                }
                else if (interpreter.IsAClueRequest(message))
                {
                    ServerService.GetAClue();
                }
                #region DROPPED FEATURE
                //else if (interpreter.IsAKickRequest(message))
                //{
                //    ServerService.Kick(interpreter.ExtractWordFromCommand(message));
                //}
                #endregion
                else
                {
                    ServerService.SendMessage(message, SharedChatModel.CurrentChannelId);
                }
            }
            else
            {
                ServerService.SendMessage(message, SharedChatModel.CurrentChannelId);
            }

            if (SharedChatModel.IsInPartyChat())
            {
                UserCurrentMessage = MessageInterpreter.GameGuessPrefix + " ";
            }
            else
            {
                UserCurrentMessage = "";
            }
        }
Exemplo n.º 2
0
 public void SwitchChannel(string channelId)
 {
     foreach (Channel channel in SharedChatModel.Channels)
     {
         if (channel.id.Equals(channelId))
         {
             if (channel.joined)
             {
                 SharedChatModel.SwitchChannel(channelId);
                 break;
             }
             else
             {
                 ServerService.JoinChannel(channelId);
             }
         }
     }
 }
Exemplo n.º 3
0
 public Chat()
 {
     SharedChatModel.SetUp();
     SharedChatModel.PropertyChanged -= OnSharedModelChanged;
     SharedChatModel.PropertyChanged += OnSharedModelChanged;
 }