Exemple #1
0
        private void btInvitePlayer_Click(object sender, RoutedEventArgs e)
        {
            if (lbUsers.SelectedIndex == -1)
            {
                MessageBox.Show("In order to invite player you need to choose player first.",
                                "Notice", MessageBoxButton.OK, MessageBoxImage.Information);
                return;
            }
            String selectedUser = lbUsers.SelectedItem.ToString().Split(' ')[0];

            if (selectedUser.Equals(Username))
            {
                MessageBox.Show("You can't invite yourself, choose other player.",
                                "Notice", MessageBoxButton.OK, MessageBoxImage.Information);
                return;
            }

            if (lbUsers.SelectedItem.ToString().Contains("Playing*"))
            {
                MessageBox.Show("You can't invite player that is already in a match.",
                                "Notice", MessageBoxButton.OK, MessageBoxImage.Information);
                return;
            }
            GameInvitationWindow invitationWindow = new GameInvitationWindow();

            invitationWindow.InviteReciverName = selectedUser;
            invitationWindow.Client            = Client;
            invitationWindow.Username          = Username;
            invitationWindow.PlayerStats       = PlayerStats;
            invitationWindow.CallBack          = CallBack;
            invitationWindow.ShowDialog();
        }
        private void btInvitePlayer_Click(object sender, RoutedEventArgs e)
        {
            if (lbUsers.SelectedIndex == -1)
            {
                MessageBox.Show("In order to invite player you need to choose player first.",
                                "Error occurred!", MessageBoxButton.OK, MessageBoxImage.Error);
                return;
            }
            String selectedUser = lbUsers.SelectedItem.ToString();

            if (selectedUser.Equals(Username))
            {
                MessageBox.Show("You cant invite yourself, choose other player.",
                                "Error occurred!", MessageBoxButton.OK, MessageBoxImage.Error);
                return;
            }
            GameInvitationWindow invitationWindow = new GameInvitationWindow();

            invitationWindow.InviteReciverName = selectedUser;
            invitationWindow.ShowDialog();
        }