Beispiel #1
0
        public List <string> TestOne()
        {
            List <string>   receive   = new List <string>();
            List <string>   result    = new List <string>();
            QuestionsHelper questions = new QuestionsHelper();
            CatchNowTester  tester    = new CatchNowTester();

            receive.AddRange(questions.Result());
            receive.Add(tester.Name());
            Random random = new Random();

            for (int i = 1; i < 21; i++)
            {
                string item = receive[random.Next(1, receive.Count())];
                if (result.Where(x => x == item).Any())
                {
                    i -= 1;
                }
                else
                {
                    result.Add(item);
                }
            }
            return(result);
        }
Beispiel #2
0
        public async void Execute(object parameter)
        {
            vm.resetAnswerColors();

            /*Get the Questions*/
            var temp = await QuestionsHelper.GetQuestions(vm);

            /*Clear the Questions array to make sure its empty before adding new values to it*/
            vm.Questions.Clear();

            /*Create a temp Oberservable Collection*/
            ObservableCollection <Question> questions = new ObservableCollection <Question>();

            /*Add the new questions to the temp array*/
            foreach (var a in temp)
            {
                questions.Add(a);
            }

            /*Open the game window*/
            vm.showGameWindow();

            /*Sets the temp var to the real Questions List, cant be set directly, cause the INotifyPropChanged wouldnt trigger with
             * just adding values to a Observable Collection*/
            vm.Questions = questions;

            /*Calculates the Questions left prop*/
            vm.QuestionsLeftCount = vm.Questions.Count - 1;

            /*Lets game over be false*/
            vm.GameOver = false;
        }
Beispiel #3
0
        public List <QuestionsModel> TestOne()
        {
            List <string>         receive   = new List <string>();
            List <QuestionsModel> result    = new List <QuestionsModel>();
            QuestionsModel        itemmodel = new QuestionsModel();
            QuestionsHelper       questions = new QuestionsHelper();
            CatchNowTester        tester    = new CatchNowTester();

            receive.AddRange(questions.ResultAll());
            receive.Add(tester.Name());
            Random random = new Random();

            for (int i = 1; i < 21; i++)
            {
                string item = receive[random.Next(1, receive.Count())];
                if (result.Where(x => x.Main == item).Any())
                {
                    i -= 1;
                }
                else
                {
                    if (questions.Result("Nature").Where(x => x == item).Any())
                    {
                        itemmodel = new QuestionsModel
                        {
                            Main        = item,
                            KeybordCode = "76"
                        };
                        result.Add(itemmodel);
                    }
                    else if (questions.Result("Artificial").Where(x => x == item).Any())
                    {
                        itemmodel = new QuestionsModel
                        {
                            Main        = item,
                            KeybordCode = "65"
                        };
                        result.Add(itemmodel);
                    }
                    else if (questions.Result("Color").Where(x => x == item).Any())
                    {
                        itemmodel = new QuestionsModel
                        {
                            Main        = item,
                            KeybordCode = "65"
                        };
                        result.Add(itemmodel);
                    }
                    else
                    {
                        itemmodel = new QuestionsModel
                        {
                            Main        = item,
                            KeybordCode = "76"
                        };
                        result.Add(itemmodel);
                    }
                }
            }
            itemmodel = new QuestionsModel
            {
                Main        = tester.Name(),
                KeybordCode = "76"
            };
            result.Add(itemmodel);
            return(result);
        }