Example #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();
                        }
                    }
                }
            }
        }
        public void ShowScores()
        {
            GamePlay.Users _user  = new GamePlay.Users();
            string         scores = _user.displayScores();

            if (scores.ToString() == string.Empty)
            {
                lblscore1.Content = "0";
                lblscore2.Content = "0";
            }
            else
            {
                string[] arr_scores = scores.Split(',');
                lblscore1.Content = arr_scores[0].ToString();
                lblscore2.Content = arr_scores[1].ToString();
            }
        }