public void newGame(int vertex) { lineColor = new Color(1, 1, 1, 0.7f); answer = AnswerList.TakeRandom(vertex); List <GameObject> spots = new List <GameObject>(); for (int i = 0; i < vertex; i++) { spots.Add(GameObject.Find(answer[i] + "")); } //scoreTb.text = ""+spots.Length; render.SetVertexCount(2 * vertex - 1); for (int i = 0; i < vertex; i++) { render.SetPosition(2 * i, spots[i].transform.position + Vector3.forward * 2); if (i + 1 < vertex) { render.SetPosition(2 * i + 1, Vector3.MoveTowards(spots[i + 1].transform.position + Vector3.forward * 2, spots[i].transform.position + Vector3.forward * 2, 0.0001f)); } } maxTime = (maxTime <= 3f)?3f:(maxTime * 0.985f); countdown = maxTime; timeReducedWhenWrong = maxTime * 0.1f; //scoreTb.text = answer; }
private void LoadAnswers() { try { HttpClient client = InitializeClient(); string result; dynamic items; HttpResponseMessage response; //Call the API response = client.GetAsync("Answer").Result; if (response.StatusCode == System.Net.HttpStatusCode.OK) { //Proces response result = response.Content.ReadAsStringAsync().Result; //Put json into the activation list items = (JArray)JsonConvert.DeserializeObject(result); answers = items.ToObject <AnswerList>(); } else { throw new Exception("Error: " + response.ReasonPhrase); } } catch (Exception ex) { lblQuestion.Text = ex.Message; } }
public static List<AskDetail> ConvertList(DataSet ds) { List<AskDetail> list = new List<AskDetail>(); foreach (DataRow row in ds.Tables[0].Rows) { AskDetail data = new AskDetail(); data.AskSeq = row["AskSeq"].ToString(); data.UsersSeq = row["UsersSeq"].ToString(); data.AskTitle = row["AskTitle"].ToString(); data.AskDoc = row["AskDoc"].ToString(); data.AskCount = row["AskCount"].ToString(); data.UserNickName = row["UserNickName"].ToString(); data.Answers = new List<AnswerList>(); foreach (DataRow row1 in ds.Tables[1].Rows) { AnswerList data1 = new AnswerList(); data1.AnswerSeq = row1["AnswerSeq"].ToString(); data1.Answer = row1["Answer"].ToString(); data1.UsersSeq = row1["UsersSeq"].ToString(); data1.UserNickName = row1["UserNickName"].ToString(); data1.GoodAnswerCount = row1["GoodAnswerCount"].ToString(); data.Answers.Add(data1); } list.Add(data); } return list; }
// GET: api/Answer public IEnumerable <Answer> Get() { AnswerList answers = new AnswerList(); answers.Load(); return(answers); }
public void LoadExamPaper(BaobaoBook book) { ExamPaper paper = null; AnswerList.Clear(); QuestionList.Clear(); if (book != null) { if (!_books.ContainsKey(book) || _books[book] == null) { string examPaper = book.Name; paper = FileSettingsHelper <ExamPaper> .LoadSetting(Path.Combine(ZibaobaoLibContext.Instance.PersistentStorage.DataPath, examPaper)); _books[book] = paper; } else { paper = _books[book]; } } if (paper != null) { foreach (var question in paper.Questions) { QuestionList.Add(question); } if (QuestionList.Count > 0) { _currentQuestionIndex = -1; CurrentQuestionIndex = 0; } } }
private async Task ContentDiashow(AppBarButton appBarButton) { ContentDialog contentDialog = new ContentDialog { Title = "是否删除?", PrimaryButtonText = "删除", SecondaryButtonText = "取消", }; contentDialog.PrimaryButtonClick += (_s, _e) => { var list = NameMap.FindParent <ListViewItem>(appBarButton); if (RootPivot.SelectedIndex == 0) { drafts.RemoveAt(Draftlist.IndexFromContainer(list)); } else if (RootPivot.SelectedIndex == 1) { answerDrafts.RemoveAt(AnswerList.IndexFromContainer(list)); } }; contentDialog.SecondaryButtonClick += (_s, _e) => { }; await contentDialog.ShowAsync(); }
public async Task DeleteAnswerList(AnswerList answerList) { var answerListToDelete = await _unitOfWork.AnswerList.SingleOrDefaultAsync(m => m.Id == answerList.Id); answerListToDelete.Status = 2; await _unitOfWork.CommitAsync(); }
/// <summary> /// Header action handler. /// </summary> /// <param name="sender">Sender</param> /// <param name="e">Event args</param> private void HeaderActions_ActionPerformed(object sender, CommandEventArgs e) { switch (e.CommandName.ToLowerCSafe()) { case "btnreset_click": // Reset all answer counts // Check 'Manage' permission PollInfo pi = PollInfoProvider.GetPollInfo(AnswerList.PollId); int groupId = 0; if (pi != null) { groupId = pi.PollGroupID; } // Check permissions CheckPermissions(groupId, CMSAdminControl.PERMISSION_MANAGE); if (pollId > 0) { PollAnswerInfoProvider.ResetAnswers(pollId); AnswerList.ReloadData(); } break; } }
void CompleteWordsDictionary() { IsDictionaryCompleted = true; if (PopUp.CurrentWordsDictionary.Count == 0) { for (int i = 0; i < BlockVolume; i++) { PopUp.CurrentWordsDictionary.Add(PopUp.WordsDictionary.ElementAt(i).Key, PopUp.WordsDictionary.ElementAt(i).Value); } } else if (PopUp.CurrentWordsDictionary.Count != 0) { int currentWordsDictionaryCount = PopUp.CurrentWordsDictionary.Count(); Model.ReSortCurrentWordsDictionary(); for (int i = currentWordsDictionaryCount; i < BlockVolume; i++) { if (!PopUp.CurrentWordsDictionary.Keys.Contains(PopUp.WordsDictionary.ElementAt(i).Key)) { PopUp.CurrentWordsDictionary.Add(PopUp.WordsDictionary.ElementAt(i).Key, PopUp.WordsDictionary.ElementAt(i).Value); } } } AnswerList.Clear(); }
public StageReadyUseCase(AnswerList answerList, IAnswerRenderer answerRenderer, IAudioPlayer audioPlayer, IInfoEntity infoEntity, IKeyboardEntity keyboardEntity, IMainStateEntity mainStateEntity, IPhotonChatPrcRequester photonChatPrcRequester, IPlayerEntity playerEntity, IReadOnlyList <IKeyboardKeyRenderer> keyboardKeyRendererList, IReadOnlyList <IStageRenderer> stageRendererList, IStageEntity stageEntity, IStageReadyHandler stageReadyHandler, IStageReadyPlayerListRenderer stageReadyPlayerListRenderer, IStageReadyRpcRequester stageReadyRpcRequester, ITimerEntity timerEntity) { AnswerList = answerList; AnswerRenderer = answerRenderer; AudioPlayer = audioPlayer; InfoEntity = infoEntity; KeyboardEntity = keyboardEntity; MainStateEntity = mainStateEntity; PhotonChatPrcRequester = photonChatPrcRequester; PlayerEntity = playerEntity; KeyboardKeyRendererList = keyboardKeyRendererList; StageRendererList = stageRendererList; StageEntity = stageEntity; StageReadyHandler = stageReadyHandler; StageReadyPlayerListRenderer = stageReadyPlayerListRenderer; StageReadyRpcRequester = stageReadyRpcRequester; TimerEntity = timerEntity; }
/// <summary> /// Reset answers button handler. /// </summary> private void btnResetAnswers_Click(object sender, EventArgs e) { if (CheckModifyPermission(ItemID)) { PollAnswerInfoProvider.ResetAnswers(ItemID); AnswerList.ReloadData(); } }
public async Task <AnswerList> CreateAnswerList(AnswerList newAnswerList) { await _unitOfWork.AnswerList .AddAsync(newAnswerList); await _unitOfWork.CommitAsync(); return(newAnswerList); }
protected override void OnPreRender(EventArgs e) { base.OnPreRender(e); if (!RequestHelper.IsPostBack()) { AnswerList.ReloadData(); } }
protected void btnVastaa_Click(object sender, EventArgs e) { btnVastaa.Visible = false; answerview.Visible = false; lblInfo.Text = "Kiitos vastauksistasi!"; AnswerList a = new AnswerList(); Answer b = new Answer(); List <string> answers = new List <string>(); List <int> selected = new List <int>(); string question = ""; int j = 0; int i = 0; foreach (Control item in studentPane.Controls) { if (item is TextBox) { if (i > 0) { b.question = question; b.answers = answers; b.selected = selected; a.vastaukset.Add(b); b = new Answer(); } TextBox txtInstance = (TextBox)item; question = txtInstance.Text; i++; } if (item is CheckBox) { CheckBox chkInstance = (CheckBox)item; if (chkInstance.Checked) { selected.Add(j); } j++; } if (item is Label) { Label lblInstance = (Label)item; answers.Add(lblInstance.Text); } } b.question = question; b.answers = answers; b.selected = selected; a.vastaukset.Add(b); Serialisointi.SerialisoiXmlVastaukset(HttpContext.Current.Server.MapPath("~/App_Data/SavesAnswers.xml"), a); }
private void SubmitAnswer_Click(object sender, RoutedEventArgs e) { ExControl.NextExerciseVisible(); List<bool> choiceList = parseToList(MultipleChoiceAnswerInput.SelectedItems); MultipleChoiceAnswerInput.SelectedItems.Clear(); if (choiceList.Count == 0) return; AnswerList<bool> ans = new AnswerList<bool>(choiceList); bool correctAnswer = true; bool[] feedback = ans.GetFeedback(App.ViewModel.CurrentSolution.Answer as AnswerList<bool>); StringBuilder headerBuilder = new StringBuilder(); StringBuilder builder = new StringBuilder(); for (int i = 0; i < feedback.Length; ++i) { if (!feedback[i]) { correctAnswer = false; break; } } var currentExerciseId = App.ViewModel.Exercises[App.ViewModel.CurrentQuestionNumber].ID; if (correctAnswer) { App.ViewModel.AddAnswer(currentExerciseId, true); App.ViewModel.CorrectAnswers++; App.ViewModel.AddAnswer(true); headerBuilder.Append("Correct!"); builder.Append(""); ExControl.CorrectAnswerMediaElement.Play(); } else { App.ViewModel.AddAnswer(currentExerciseId, false); App.ViewModel.AddAnswer(false); headerBuilder.Append("You're wrong :-("); builder.Append("Explanation:\n"); for (int i = 0; i < feedback.Length; ++i) { builder.Append(i + 1); if (feedback[i]) { builder.Append("). OK\n"); } else { builder.Append("). Wrong!"); builder.AppendLine(); } } ExControl.WrongAnswerMediaElement.Play(); } MultipleChoiceAnswerInput.Visibility = Visibility.Collapsed; ExControl.SubmitAnswerClick(headerBuilder, builder); }
public MultipleChoiceQuestion(String xml) { value = ""; answers = new AnswerList<string>(); correctAnswerIndex = -1; _questionForm = new QuestionForm(this); if (!String.IsNullOrEmpty(xml)) { fromXML(xml); } }
private void ClearTest() { TaskList.Items.Clear(); AnswerList.Clear(); editor.Html = ""; currentAnswerNum = 0; currentTask = null; currentTaskNum = 0; currentText = null; currentUnit = null; }
private void AnswerListGoToTop_Tapped(object sender, TappedRoutedEventArgs e) { var firstAnswer = AnswerList.Items.FirstOrDefault(); if (firstAnswer == null) { return; } AnswerList.ScrollIntoView(firstAnswer); }
public void LoadTest() { AnswerList answers = new AnswerList(); answers.Load(); int expected = 8; int actual = answers.Count; Assert.AreEqual(expected, actual); }
public void DeleteTest() { //Load all answers and then get the answer AnswerList answers = new AnswerList(); answers.Load(); Answer answer = answers.FirstOrDefault(q => q.Text == "ChangedText"); int actual = answer.Delete(); Assert.IsTrue(actual > 0); }
async void AddOrUpdateCommandAction() { if (!string.IsNullOrEmpty(Question.Description) && !string.IsNullOrEmpty(AnswerList[0].Description) && !string.IsNullOrEmpty(AnswerList[1].Description) && !string.IsNullOrEmpty(AnswerList[1].Description)) { //Question.QuestionID = 0; if (AnswerList[0].QuestionFK != Question.QuestionID) { Question.QuestionID = AnswerList[0].QuestionFK; await _dialogService.DisplayAlertAsync("Error", "You can not change the ID, please select concerned Question or create new question !", "OK"); return; } //Add New Question App.SQLiteDb.SaveItemAsync(Question); //Add all Answers of questions in Answer Table for (int i = 0; i < 3; i++) { App.SQLiteDb.SaveItemAsync(AnswerList[i]); } //fill all answer in question --> quesion id as changed after that Question.Answers = AnswerList.ToList(); //finally update Question App.SQLiteDb.SaveItemAsync(Question); //nooooooooooon il faut utilser SQLiteNetExtensions packet nugget //foreach (var answer in AnswerList) // await App.SQLiteDb.SaveItemAsync(answer); await _dialogService.DisplayAlertAsync("Sucess", "Question saved !", "OK"); GetAllQuestion(); InitializeQuestion(); } else { await _dialogService.DisplayAlertAsync("Error", "Question not saved ! You forgot something", "OK"); } }
private IshiharaResultFlag EvaluatePlateAnswers(IshiharaPlateReadLimits limits) { var count = AnswerList.Count(CompareNormalPlateReadCountToLimits(limits)); if (count >= limits.LowerLimitOfPass) { return(IshiharaResultFlag.NormalVision); } return(count <= limits.UpperLimitOfFail ? IshiharaResultFlag.ColorVisionDeficit : IshiharaResultFlag.IndeterminantResult); }
public QuestionForm(MultipleChoiceQuestion question) { InitializeComponent(); this.question = question; questionValue.Text = question.question; answers = new AnswerList<String>(question.answers); correctAnswer = question.correctAnswerIndex; Choices.DataSource = answers; if (correctAnswer >= 0) { Choices.SetItemChecked(correctAnswer, true); } Choices.ItemCheck += new ItemCheckEventHandler(Choices_ItemCheck); }
private void populatePane() { AnswerList a = new AnswerList(); Serialisointi.DeSerialisoiVastauksetXml(HttpContext.Current.Server.MapPath("~/App_Data/SavedQuestions.xml"), ref a); pane.Controls.Add(new LiteralControl("<br/>")); Label lbl = new Label(); lbl.Text = "Vastauksia tuli yhteensä: "+a.vastaukset.Count().ToString(); pane.Controls.Add(new Label()); }
public void LoadQuestions() { var currentQuestion = CurrentQuestion; if (currentQuestion != null) { AnswerList.Clear(); foreach (var answer in currentQuestion.Answers) { AnswerList.Add(answer); } } }
public QnAmazingPage() { InitializeComponent(); BindingContext = new QnAmazingPageViewModel(Navigation); var viewModel = (QnAmazingPageViewModel)BindingContext; viewModel.Answers.CollectionChanged += (sender, e) => { if (e.Action == System.Collections.Specialized.NotifyCollectionChangedAction.Add) { AnswerList.ScrollTo(viewModel.Answers[0], ScrollToPosition.Start, true); } }; }
private void populatePane() { AnswerList a = new AnswerList(); Serialisointi.DeSerialisoiVastauksetXml(HttpContext.Current.Server.MapPath("~/App_Data/SavedQuestions.xml"), ref a); pane.Controls.Add(new LiteralControl("<br/>")); Label lbl = new Label(); lbl.Text = "Vastauksia tuli yhteensä: " + a.vastaukset.Count().ToString(); pane.Controls.Add(new Label()); }
private void Send_Click(object sender, RoutedEventArgs e) { AppBarButton appBarButton = (AppBarButton)sender; var list = NameMap.FindParent <ListViewItem>(appBarButton); if (RootPivot.SelectedIndex == 0) { viewItem = list; Frame.Navigate(typeof(EditArtical), drafts[Draftlist.IndexFromContainer(list)]); } else if (RootPivot.SelectedIndex == 1) { vAnsItem = list; Frame.Navigate(typeof(MakeAnswer), answerDrafts[AnswerList.IndexFromContainer(list)]); } }
public override IEnumerable <InputValue> Execute(IEnumerable <InputValue> inputValues) { foreach (var i in inputValues) { switch (i.Name) { case "number": AnswerList.Add(i); return(AnswerList); default: break; } } return(AnswerList); }
/// <summary> /// Header action handler. /// </summary> /// <param name="sender">Sender</param> /// <param name="e">Event args</param> private void HeaderActions_ActionPerformed(object sender, CommandEventArgs e) { switch (e.CommandName.ToLowerCSafe()) { case "btnreset_click": // Reset all answer counts // Check 'Modify' permission CheckPollsModifyPermission(pi.PollSiteID); if (pollId > 0) { PollAnswerInfoProvider.ResetAnswers(pollId); AnswerList.ReloadData(); } break; } }
public static void DeSerialisoiVastauksetXml(string filePath, ref AnswerList vastaukset) { XmlSerializer deserializer = new XmlSerializer(typeof(AnswerList)); try { FileStream xmlFile = new FileStream(filePath, FileMode.Open); vastaukset = (AnswerList)deserializer.Deserialize(xmlFile); xmlFile.Close(); } catch (Exception ex) { throw ex; } finally { } }
public MainPage() { InitializeComponent(); InitializeAnimalList(); InitializeFoodList(); ItemGridView.ItemsSource = animalsList; ItemListView.ItemsSource = foodList; flipView1.ItemsSource = AnswerList; var temp = "Состояние шерсти улучшается"; AnswerList.Insert((int)Animal.State.Good, temp); var temp1 = "Действует как успокоительное"; AnswerList.Insert((int)Animal.State.Neutral, temp1); var temp2 = "Животное умрет от отравления"; AnswerList.Insert((int)Animal.State.Bad, temp2); }
public static void SerialisoiXmlVastaukset(string tiedosto, AnswerList vastaukset) { XmlSerializer xs = new XmlSerializer(vastaukset.GetType()); TextWriter tw = new StreamWriter(tiedosto); try { xs.Serialize(tw, vastaukset); } catch (Exception e) { throw e; } finally { tw.Close(); } }
public override IEnumerable <InputValue> Execute(IEnumerable <InputValue> inputValues) { String input = ""; foreach (var i in inputValues) { input += i.Name; input += i.Data; } Expression e = new Expression(input); InputValue.Data = e.Evaluate().ToString(); InputValue.Name = "answer"; AnswerList.Add(InputValue); InputValue.Data = input; InputValue.Name = "formula"; AnswerList.Add(InputValue); return(AnswerList); }
public void UpdateTest() { //Load all answers and then get the answer AnswerList answers = new AnswerList(); answers.Load(); Answer answer = answers.FirstOrDefault(q => q.Text == "TestAnswer"); //Change the properties answer.Text = "ChangedText"; //Update the answer answer.Update(); //Load it answer.LoadById(); Assert.AreEqual(answer.Text, "ChangedText"); }
protected void btnEmpty_Click(object sender, EventArgs e) { AnswerList a = new AnswerList(); Serialisointi.SerialisoiXmlVastaukset(HttpContext.Current.Server.MapPath("~/App_Data/SavedQuestions.xml"), a); }
protected void btnVastaa_Click(object sender, EventArgs e) { btnVastaa.Visible = false; answerview.Visible = false; lblInfo.Text = "Kiitos vastauksistasi!"; AnswerList a = new AnswerList(); Answer b = new Answer(); List<string> answers = new List<string>(); List<int> selected = new List<int>(); string question = ""; int j = 0; int i = 0; foreach (Control item in studentPane.Controls) { if (item is TextBox) { if (i > 0) { b.question = question; b.answers = answers; b.selected = selected; a.vastaukset.Add(b); b = new Answer(); } TextBox txtInstance = (TextBox)item; question = txtInstance.Text; i++; } if (item is CheckBox) { CheckBox chkInstance = (CheckBox)item; if (chkInstance.Checked) { selected.Add(j); } j++; } if (item is Label) { Label lblInstance = (Label)item; answers.Add(lblInstance.Text); } } b.question = question; b.answers = answers; b.selected = selected; a.vastaukset.Add(b); Serialisointi.SerialisoiXmlVastaukset(HttpContext.Current.Server.MapPath("~/App_Data/SavesAnswers.xml"), a); }