コード例 #1
0
        public void Load(int num)
        {
            bool Flag;

            ResetBtnBG();
            stopWatch.Reset();
            stopWatch.Start();
            dt.Start();
            Flag = ques.Generate_Qestion(num);
            if (Flag == true)
            {
                txt_question.Text = ques.Question;
                btn_A.Content     = ques.ChoiceA;
                btn_B.Content     = ques.ChoiceB;
                btn_C.Content     = ques.ChoiceC;
                btn_D.Content     = ques.ChoiceD;
            }

            else
            {
                if (stopWatch.IsRunning)
                {
                    stopWatch.Stop();
                }

                if (count >= 4)
                {
                    var res = MessageBox.Show("you Turn is Over", "Turn over", MessageBoxButton.OK, MessageBoxImage.Information);
                    if (res.ToString() == "OK")
                    {
                        GamePlay.Users _User = new GamePlay.Users();
                        _User.CurPlayer   = CurrentPlayer;
                        _User.PlayerScore = ques.final;
                        _User.DeactivePlayer();
                        _User.AddScores();
                        if (_User.UserStaus() == string.Empty)
                        {
                            count = 0;
                            Screens.Login login = new Screens.Login();
                            this.Close();
                            login.Show();
                        }
                        else if (_User.UserStaus() == "Finish")
                        {
                            Screens.Rounds round = new Rounds();
                            this.Close();
                            round.Show();
                        }
                    }
                }
            }
        }
コード例 #2
0
        private void btn_reg_Click(object sender, RoutedEventArgs e)
        {
            if (lst_user.SelectedItems.Count < 2)
            {
                lblNote.Content = "Select two Players";
            }
            else
            {
                lblNote.Content = string.Empty;

                string i = string.Empty;
                foreach (var player in lst_user.SelectedItems)
                {
                    Slct_Players.Add(player.ToString().Substring(3));
                }

                GamePlay.Users users = new GamePlay.Users();

                int Flag = users.Players(Slct_Players);

                if (Flag == 0)
                {
                    //Screens.Login _login = new Screens.Login();
                    //this.Close();
                    //_login.Show();


                    Screens.Rounds round = new Screens.Rounds();
                    this.Close();
                    round.Show();
                }
                else
                {
                    MessageBox.Show("Something Wrong with Database", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
                }
            }
        }