Example #1
0
        /// <summary>
        /// This method connect a player to chat
        /// </summary>
        public void ConnectToChat()
        {
            InstanceContext   instanceContext = new InstanceContext(this);
            ChatManagerClient chatManager     = new ChatManagerClient(instanceContext);

            chatManager.ClientConnect(nickname);
        }
Example #2
0
        private void MissGame()
        {
            dispatcher.Stop();
            try
            {
                InstanceContext   instanceContext = new InstanceContext(this);
                PlayConnectClient playConnect     = new PlayConnectClient(instanceContext);
                playConnect.PlayerDisconnect(nickname);
                InstanceContext   instanceContextChat = new InstanceContext(this);
                ChatManagerClient chatManagerClient   = new ChatManagerClient(instanceContextChat);
                chatManagerClient.RemoveUser(nickname);
            }
            catch (EndpointNotFoundException exception)
            {
                TelegramBot.SendToTelegram(exception);
                LogException.Log(this, exception);
                LogException.ErrorConnectionService();
            }
            LostGame lostGame = new LostGame();

            lostGame.Owner = this;
            lostGame.ShowDialog();
            Lobby lobby = new Lobby();

            lobby.EmailReceived(emailAccount);
            lobby.ColocateBestScores();
            lobby.ColocatePersonalInformation();
            lobby.Show();
            this.Close();
        }
Example #3
0
        private void SendMessage(object sender, RoutedEventArgs routedEventArgs)
        {
            InstanceContext   instanceContext = new InstanceContext(this);
            ChatManagerClient chatManager     = new ChatManagerClient(instanceContext);

            if (tbMessage.Text != null)
            {
                chatManager.SendNewMessages(tbMessage.Text, nickname);
                tbMessage.Text = null;
            }
        }
Example #4
0
 private void WindowClosing(object sender, System.ComponentModel.CancelEventArgs cancelEventArgs)
 {
     try {
         InstanceContext   instanceContext = new InstanceContext(this);
         PlayConnectClient playConnect     = new PlayConnectClient(instanceContext);
         playConnect.PlayerDisconnect(nickname);
         InstanceContext   instanceContextChat = new InstanceContext(this);
         ChatManagerClient chatManagerClient   = new ChatManagerClient(instanceContextChat);
         chatManagerClient.RemoveUser(nickname);
     }
     catch (EndpointNotFoundException exception)
     {
         TelegramBot.SendToTelegram(exception);
         LogException.Log(this, exception);
         LogException.ErrorConnectionService();
     }
     dispatcher.Stop();
 }