private void ClickValidate(object sender, RoutedEventArgs e)
        {
            string token = TextBoxToken.Text;

            if (!string.IsNullOrEmpty(token))
            {
                try
                {
                    Proxy.LoginServiceClient server = new Proxy.LoginServiceClient();
                    bool isVerified = server.VerificateUser(user, token);
                    server.Close();
                    if (isVerified)
                    {
                        CustomMessageBox.Show(Properties.Resources.SuccessfulVerification);
                        mainWindow.GoBack();
                    }
                    else
                    {
                        LabelAlert.Content = Properties.Resources.UnsuccessfulVerification;
                    }
                }
                catch (System.ServiceModel.EndpointNotFoundException ex)
                {
                    Console.WriteLine(ex.ToString());
                    LabelAlert.Content = Properties.Resources.ServerIsOff;
                }
            }
            else
            {
                LabelAlert.Content = Properties.Resources.EmptyFields;
            }
        }
Exemple #2
0
        private void ClickValidate(object sender, EventArgs e)
        {
            string token = TextBoxToken.Text;

            if (!string.IsNullOrEmpty(token))
            {
                try
                {
                    Proxy.LoginServiceClient verificator = new Proxy.LoginServiceClient();
                    bool isVerified = verificator.VerificateUser(username, token);
                    verificator.Close();

                    if (isVerified)
                    {
                        ButtonChat.IsEnabled           = true;
                        TextBoxChat.IsEnabled          = true;
                        ButtonSeeScores.IsEnabled      = true;
                        ButtonChangePassword.IsEnabled = true;
                        ButtonPlay.IsEnabled           = true;

                        TextBoxToken.Visibility   = Visibility.Collapsed;
                        IconToken.Visibility      = Visibility.Collapsed;
                        ButtonValidate.Visibility = Visibility.Collapsed;
                        LabelAlert.Content        = Properties.Resources.AccountHasBeenVerifiedText;

                        server.JoinChat(0, username);
                    }
                    else
                    {
                        MessageBox.Show(Properties.Resources.UnsuccessfulVerification);
                    }
                }
                catch (System.ServiceModel.EndpointNotFoundException ex)
                {
                    Console.WriteLine(ex.ToString());
                    LabelAlert.Content = Properties.Resources.ServerIsOff;
                }
            }
            else
            {
                MessageBox.Show(Properties.Resources.EmptyFields);
            }
        }