/// <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); }
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(); }
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; } }
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(); }