Example #1
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 #2
0
 private void Play(object sender, RoutedEventArgs e)
 {
     try
     {
         InstanceContext   instanceContext   = new InstanceContext(this);
         PlayConnectClient playConnectClient = new PlayConnectClient(instanceContext);
         playConnectClient.VerifyGameStart();
         if (isStartGameCurrent)
         {
             MessageBox.Show(Properties.Resources.NoOpenMatchMessage, Properties.Resources.TitleMatch, (MessageBoxButton)System.Windows.Forms.MessageBoxButtons.OK, (MessageBoxImage)System.Windows.Forms.MessageBoxIcon.Exclamation);
         }
         else
         {
             WaitingRoom waitingRoom = new WaitingRoom();
             waitingRoom.NicknameReceived(nickname);
             waitingRoom.EmailReceived(emailAccount);
             waitingRoom.ObtainListPlayer();
             waitingRoom.Show();
             this.Close();
         }
     }
     catch (EndpointNotFoundException exception)
     {
         TelegramBot.SendToTelegram(exception);
         LogException.Log(this, exception);
         LogException.ErrorConnectionService();
     }
 }
Example #3
0
 private void StartGame(object sender, RoutedEventArgs routedEventArgs)
 {
     try {
         InstanceContext   instanceContext = new InstanceContext(this);
         PlayConnectClient playConnect     = new PlayConnectClient(instanceContext);
         playConnect.StartGame(nickname);
     }
     catch (EndpointNotFoundException exception)
     {
         TelegramBot.SendToTelegram(exception);
         LogException.Log(this, exception);
         LogException.ErrorConnectionService();
     }
 }
Example #4
0
 /// <summary>
 /// Method that gets the list of connected players
 /// </summary>
 public void ObtainListPlayer()
 {
     try {
         InstanceContext   instanceContext = new InstanceContext(this);
         PlayConnectClient playerConnect   = new PlayConnectClient(instanceContext);
         playerConnect.PlayerConnect(nickname);
     }
     catch (EndpointNotFoundException exception)
     {
         TelegramBot.SendToTelegram(exception);
         LogException.Log(this, exception);
         LogException.ErrorConnectionService();
     }
 }
Example #5
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();
 }
Example #6
0
 private void EndGame()
 {
     try
     {
         InstanceContext   instanceContext = new InstanceContext(this);
         PlayConnectClient endGame         = new PlayConnectClient(instanceContext);
         ServiceWinner     serviceWinner   = new ServiceWinner();
         serviceWinner.NickName = nickname;
         serviceWinner.Points   = Int32.Parse(tbCurrentScore.Text);
         serviceWinner.Time     = time;
         serviceWinner.Mistakes = countError;
         endGame.GameOver(serviceWinner);
     }
     catch (EndpointNotFoundException exception)
     {
         TelegramBot.SendToTelegram(exception);
         LogException.Log(this, exception);
         LogException.ErrorConnectionService();
     }
 }
Example #7
0
        private void GoOut(object sender, RoutedEventArgs routedEventArgs)
        {
            try {
                InstanceContext   instanceContext = new InstanceContext(this);
                PlayConnectClient playConnect     = new PlayConnectClient(instanceContext);
                playConnect.PlayerDisconnect(nickname);
            }
            catch (EndpointNotFoundException exception)
            {
                TelegramBot.SendToTelegram(exception);
                LogException.Log(this, exception);
                LogException.ErrorConnectionService();
            }
            Lobby lobby = new Lobby();

            lobby.EmailReceived(emailAccount);
            lobby.ColocateBestScores();
            lobby.ColocatePersonalInformation();
            lobby.Show();
            isClosing = false;
            this.Close();
        }