예제 #1
0
 private void ButtomEnter_Click(object sender, RoutedEventArgs e)
 {
     if (textBoxLogin.Text == "" || passwordBox.Password == "")//no login
     {
         MessageBox.Show("Enter login and password please", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
         return;
     }
     else if (LINQFactory.IsLogin(textBoxLogin.Text) == false)
     {
         MessageBox.Show("You enter incorrect login", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
         return;
     }
     else if (LINQFactory.IsLoginAndPassword(textBoxLogin.Text, passwordBox.Password) == false)
     {
         MessageBox.Show("Your password is incorrect", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
         return;
     }
     else if (LINQFactory.HasACareer(textBoxLogin.Text)) //has choosen a team
     {
         //start a game
         this.UserId = LINQFactory.GetUserIdByLogin(textBoxLogin.Text);
         Champoins_League chp = new Champoins_League(userId, Setting, SP);
         chp.ShowDialog();
     }
     else
     {
         this.UserId                   = LINQFactory.GetUserIdByLogin(textBoxLogin.Text);
         GridEnter.Visibility          = Visibility.Hidden;
         GridChoosingMyTeam.Visibility = Visibility.Visible;
     }
 }
예제 #2
0
        private void ButtonOKFromChoosing_Click(object sender, RoutedEventArgs e)
        {
            if (ComboxTeams.SelectedIndex == -1)
            {
                MessageBox.Show("You haven't choosen a team", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
                return;
            }
            //start game
            string myteam = ComboxTeams.SelectedValue.ToString();

            if (Championship.CreateChampionship(myteam, UserId) == false)
            {
                MessageBox.Show("Check your internet connection and restart program", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
                return;
            }
            Champoins_League chp = new Champoins_League(UserId, Setting, SP);

            chp.ShowDialog();
            GridChoosingMyTeam.Visibility = Visibility.Hidden;
            GridEnter.Visibility          = Visibility.Visible;
        }