public static List <Question> GetAllQuesitions() { TextAsset question_json = Resources.Load("interview_questions") as TextAsset; AllQuestions loaded_json = JsonUtility.FromJson <AllQuestions>(question_json.text); return(loaded_json.questions); }
public Question GetQuestion() { var questionsFromCurrentCategory = AllQuestions.Where(x => x.Category == CurrentCategory).ToList(); var number = Randomizer.GetRandomNumber(8); return(questionsFromCurrentCategory[number - 1]); }
public MainViewModel() { Cars.AddCarsToList(ListCars); AskQuestions(); Next = new DelegateCommand(ButtonQlik); AllQuestions.AddtoListQuestions(ListQuest); ask = NextQuest(NrQues); QuestionContext = ask.ContextQuestion; ButtonContent = "Następne pytanie"; }
private void CreateQuestions_Click(object sender, EventArgs e) { this.Hide(); AllQuestions allQuestions = new AllQuestions(user); allQuestions.Show(); this.AddOwnedForm(allQuestions); //CreateQuestion createquestion = new CreateQuestion(user); // createquestion.Show(); //this.AddOwnedForm(createquestion); }
private void GetQuestions(XmlDocument XMLQuestion) { XmlNode AllQuestions; AllQuestions = XMLQuestion.DocumentElement.SelectSingleNode("Questions"); foreach (XmlNode QuestionDetails in AllQuestions.SelectNodes("Question")) { Question NewQuestion = new Question(); if (QuestionDetails.SelectSingleNode("Name") != null) { NewQuestion.QuestionName = QuestionDetails.SelectSingleNode("Name").InnerText; } if (QuestionDetails.SelectSingleNode("Active") != null) { NewQuestion.QuestionActive = Convert.ToBoolean(QuestionDetails.SelectSingleNode("Active").InnerText); } if (QuestionDetails.SelectSingleNode("Description") != null) { NewQuestion.QuestionDescription = QuestionDetails.SelectSingleNode("Description").InnerText; } if (QuestionDetails.SelectSingleNode("Type") != null) { NewQuestion.QuestionTypeID = Convert.ToInt32(QuestionDetails.SelectSingleNode("Type").InnerText); } NewQuestion.ModuleID = Convert.ToInt32(dpModule.SelectedValue); NewQuestion.InsertQuestion(); XmlNode Answers = QuestionDetails.SelectSingleNode("Answers"); GetAnswers(Answers); } }
static void Main(string[] args) { Console.ForegroundColor = ConsoleColor.Cyan; Gamer Participant = new Gamer(); Questions Questions = new Questions(); //Create array methods AllQuestions[] MyQuestions = new AllQuestions[3]; MyQuestions[0] = Questions.ShowQuestionOne; MyQuestions[1] = Questions.ShowQuestionTwo; MyQuestions[2] = Questions.ShowQuestionThree; Console.WriteLine($"Викторина началась... \nПравила викторины :\n1.В ответ необходимо записывать строку\n2.Игра завершается если количество очков и количество попыток равняется нулю\nКоличество очков : {Participant.Score}\nКоличество попыток : {Participant.Attempts}\nНажмите любую клавишу если готовы начать викторину"); Console.ReadKey(); //Cycle foreach (AllQuestions MyQuestion in MyQuestions) { MyQuestion(); } Console.ReadKey(); Questions.ShowResult(); Console.ReadKey(); }
private void ButtonQlik(object parameter) { if (ButtonContent == "Reset") { System.Diagnostics.Process.Start(Application.ResourceAssembly.Location); Application.Current.Shutdown(); } BeforeNrQue = NrQues; if (_currentSelectionY) { NrQues = ask.AnswerTrue; YourChoice = true; } else if (_currentSelectionN) { NrQues = ask.AnswerFalse; YourChoice = false; } RemoveFromListCars(BeforeNrQue, YourChoice); if (NrQues == 10) { QuestionContext = ListCars.Where(x => x.Status == true).ToList().Count.ToString(); if (ListCars.Where(x => x.Status == true).ToList().Count > 0) { ButtonContent = "Reset"; QuestionContext = ListCars.Where(x => x.Status == true).Select(x => "Twoje wymarzone auto to: " + x.Mark + " " + x.Model + " " + x.Series).FirstOrDefault(); ImageLocation = ListCars.Where(x => x.Status == true).Select(x => "G:/Git/C# Projekty/JanuszowyExpert/JanuszowyExpert/Zdjecia/" + x.LocationPhotos).FirstOrDefault(); } else { ButtonContent = "Reset"; QuestionContext = " Niestety Janusz nie ogarnął tematu..."; ImageLocation = "G:/Git/C# Projekty/JanuszowyExpert/JanuszowyExpert/Zdjecia/brak.jpg"; } } else { ask = NextQuest(NrQues); QuestionContext = ask.ContextQuestion; } CurentSelectionY = false; CurentSelectionN = false; if (ButtonContent == "Reset") { ActiveButton = true; } else { ActiveButton = false; } }
public static IEnumerable <QuestionBase> GetQuestionsByLevel(Level level) { return(AllQuestions.Where(q => q.Theme.Level == level)); }