public List <QuestionMode> LoadMode() { DataTable dtMode = null; List <QuestionMode> modeColl = null; QuestionMode mode = null; try { LoadXML(); dtMode = oeEntity.Tables[EntityConstents.TBL_QUESTIONMODE]; modeColl = new List <QuestionMode>(); foreach (DataRow dr in dtMode.Rows) { mode = new QuestionMode(); mode.ID = dr[EntityConstents.COL_QUESTIONMODE_ID].ToString(); mode.Code = dr[EntityConstents.COL_QUESTIONMODE_CODE].ToString(); mode.Description = dr[EntityConstents.COL_QUESTIONMODE_DESC].ToString(); modeColl.Add(mode); } } catch { } return(modeColl); }
/// <summary> /// Retrieves the stimuli from this class that are valid when used with the given question mode /// </summary> public IEnumerable <Stimulus> UsedStimuli(QuestionMode questionMode) { var usedStimuli = this.Stimuli.Where(s => s.Used); return(questionMode == QuestionMode.AskAndVerify ? usedStimuli.Where(s => s.Subclass != null) : usedStimuli); }
public void Remove() { if (manager.group.active) { mode = QuestionMode.delete; //ShowQuestion("Ви впевнені?"); manager.RemoveElement(); } }
/// <summary> /// initialises components, set datacontext, enable servis button if server is online /// </summary> public QuestionWindow() { InitializeComponent(); model = new QuestionMode(TroubleShooter.Current.RootQuestion); this.DataContext = model; ServiceButton.IsEnabled = TroubleShooter.Current.ServerOnline; if (!TroubleShooter.Current.ServerOnline) { ServiceButton.DescriptionText = "Nepodarilo sa nadviazať kontakt so servisným serverom."; } }
public QuestionAnswerItem() { isAnswered = false; questionTimer = 0; answerTime = 0; questionTitle = string.Empty; questionDesc = string.Empty; questionMode = QuestionMode.TEXT_INPUT; textboxType = TextboxType.STRING; answerText = string.Empty; selectionCount = 0; selectionText = new List <string>(); submitButtonText = string.Empty; correctValue = string.Empty; answerSelectID = -1; }
public Question(string code, QuestionMode mode, string text, GameObject button) { string firstChar = code.Substring(0, 1); string secondChar = code.Substring(1, 1); int prize = 0; if (mode == QuestionMode.FIRST_ROUND) { prize = int.Parse(secondChar) * 1000; Init(code, prize, text, button); } else if (mode == QuestionMode.SECOND_ROUND) { prize = (int.Parse(firstChar) * 10) + (int.Parse(secondChar)); prize = prize * 1000; Init(code, prize, text, button); } }
public void AddQuestionMode(QuestionMode QuestionMode) { DataTable dtQuestionMode = null; DataRow drNew = null; try { LoadXML(); dtQuestionMode = oeEntity.Tables[EntityConstents.TBL_QUESTIONMODE]; drNew = dtQuestionMode.NewRow(); drNew[EntityConstents.COL_QUESTIONMODE_ID] = Guid.NewGuid().ToString(); drNew[EntityConstents.COL_QUESTIONMODE_CODE] = QuestionMode.Code; drNew[EntityConstents.COL_QUESTIONMODE_DESC] = QuestionMode.Description; dtQuestionMode.Rows.Add(drNew); saveXML(oeEntity); } catch { } }
public void Cancle() { mode = QuestionMode.none; QuestionPanel.SetActive(false); }
/// <summary> /// Builds questions according to the history data of the feature extractor. /// </summary> /// <param name="phoneQuestionBuilder"> /// The question builder to hold all phone question. /// </param> /// <param name="customizedQuestionBuilders"> /// The customized question builders. /// </param> /// <param name="questionMode"> /// The question building mode (Lsp, LogF0, Duration, Prosody, All). /// </param> /// <returns> /// The all questions listed in string. /// </returns> /// <exception cref="ArgumentNullException"> /// Exception. /// </exception> /// <exception cref="ArgumentException"> /// Exception. /// </exception> public List<string> BuildQuestions(QuestionBuilder phoneQuestionBuilder, Dictionary<string, QuestionBuilder[]> customizedQuestionBuilders, QuestionMode questionMode) { if (phoneQuestionBuilder == null) { throw new ArgumentNullException("phoneQuestionBuilder"); } List<string> questions = new List<string>(); for (int i = 0; i < FeatureMetas.Count; ++i) { string name = FeatureMetas[i].Name; string left = FeatureNameSet.GetLeftSeparator(name); string right = FeatureNameSet.GetRightSeparator(name); // Skip question building for the non-matched linguistic feature. if (FeatureInfos[i] != null && (FeatureInfos[i].QuestionMode & questionMode) == 0) { continue; } if (FeatureMetas[i].Property == TtsFeatureProperty.TTS_FEATURE_PROPERTY_PHONE_ID) { // Builds phone questions. questions.AddRange(phoneQuestionBuilder.BuildQuestions(name, left, right)); } else if (FeatureMetas[i].Property == TtsFeatureProperty.TTS_FEATURE_PROPERTY_POS) { // Builds the pos questions. questions.AddRange( new QuestionBuilder( FeatureValueRecords[i].Values.Cast<object>().ToDictionary( o => PosSet.IdItems[(uint)((int)o)])) .BuildQuestions(name, left, right)); } else { if (FeatureInfos[i] == null) { // Builds integer questions. questions.AddRange(new QuestionBuilder(FeatureValueRecords[i].Values).BuildQuestions(name, left, right)); } else if (string.IsNullOrEmpty(FeatureInfos[i].QuestionCategory)) { if (FeatureInfos[i].ValueType == LingFeatureValueType.Null) { questions.AddRange(new QuestionBuilder(FeatureValueRecords[i].Values).BuildQuestions(name, left, right)); } else { questions.AddRange(new QuestionBuilder(FeatureValueRecords[i].Values, FeatureInfos[i].MinValue, FeatureInfos[i].MaxValue, FeatureInfos[i].ValueType).BuildQuestions(name, left, right)); } } else { // Builds customized questions. if (customizedQuestionBuilders == null) { throw new ArgumentException("Custmized question builder expected"); } if (!customizedQuestionBuilders.ContainsKey(FeatureInfos[i].QuestionCategory)) { throw new ArgumentException( Helper.NeutralFormat("Custmized question builder \"{0}\" not found", FeatureInfos[i].QuestionCategory)); } QuestionBuilder[] builders = customizedQuestionBuilders[FeatureInfos[i].QuestionCategory]; foreach (QuestionBuilder builder in builders) { questions.AddRange(builder.BuildQuestions(name, left, right)); } } } // Builds a not appliable feature question. questions.Add(QuestionBuilder.BuildNotApplicableFeatureQuestion(name, left, right)); } return questions; }
public PredictView(Runtime runtime, QuestionMode questionMode, IArrayView <EEGDataEntry> trial) : base() { var panel = this.RegisterDisposable(new Panel { Dock = DockStyle.Fill }); var displayList = runtime.Classifiers.Select(c => new Display() { Classifier = c.Settings.Name, Prediction = "predicting...", Confidence = c.Classifier.ComputesConfidence ? "predicting... " : "n/a", Accuracy = c.Accuracy }).ToList(); var grid = new DataGridView() { Dock = DockStyle.Fill, EditMode = DataGridViewEditMode.EditProgrammatically, DataSource = displayList, Font = GUIUtils.Constants.DISPLAY_FONT, AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill, ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize, }; panel.Controls.Add(grid); int count = runtime.Classifiers.Count; Stimulus selectedStimulus = null; Func <bool> succeeded = () => false; this.DoOnDeploy(c => { if (!string.IsNullOrWhiteSpace(this.Text)) { panel.Controls.Add(this.Text.ToLabel(DockStyle.Top, ContentAlignment.MiddleCenter)); } c.Controls.Add(panel); foreach (int index in (runtime.Classifiers.Count > 0 ? runtime.Classifiers.Indices() : (0).Enumerate())) { int i = index; ThreadPool.QueueUserWorkItem(ignored => { double confidence = 0; StimulusClass predicted; try { predicted = runtime.Classifiers[i].Predict(trial, out confidence) == runtime.Provider.StimulusClass1.Settings.Marker ? runtime.Provider.StimulusClass1 : runtime.Provider.StimulusClass2; } catch (Exception) { predicted = runtime.Provider.StimulusClass1; } this.Invoke(() => { if (displayList.Count > 0) { displayList[i].Prediction = predicted.Settings.Name; displayList[i].Confidence = runtime.Classifiers[i].Classifier.ComputesConfidence ? confidence.ToString() : "n/a"; grid.InvalidateRow(i); } if (--count > 0) { return; } // log prediction results foreach (var display in displayList) { runtime.LogLine(string.Format("Classifier {0} predicted {1} (accuracy so far = {2})", display.Classifier, display.Prediction, display.Accuracy)); } Panel choicePanel1 = new Panel() { Dock = DockStyle.Bottom }, choicePanel2 = new Panel() { Dock = DockStyle.Bottom, Visible = false }; var choicesSoFarLabel = new Label() { Dock = DockStyle.Bottom, TextAlign = ContentAlignment.MiddleCenter, Font = GUIUtils.Constants.DISPLAY_FONT, Visible = false }; var classChoice = new ChoiceView(new string[] { runtime.Provider.StimulusClass1.Settings.Name, runtime.Provider.StimulusClass2.Settings.Name }) { Text = "Which did you choose?" }; classChoice.DoOnFinishing(() => { if (!classChoice.Result.HasValue) { return; } choicePanel1.Enabled = false; bool picked1 = classChoice.Result.Value.Equals(runtime.Provider.StimulusClass1.Settings.Name); choicesSoFarLabel.Text = string.Format("(Choices so far: {0} {1}/{2} {3})", runtime.Class1TestPicks + (picked1 ? 1 : 0), runtime.Provider.StimulusClass1.Settings.Name, runtime.Class2TestPicks + (picked1 ? 0 : 1), runtime.Provider.StimulusClass2.Settings.Name); choicesSoFarLabel.Visible = true; selectedStimulus = picked1 ? runtime.CurrentTrial.Stimulus1 : runtime.CurrentTrial.Stimulus2; if (questionMode == QuestionMode.None) { succeeded = () => true; this.DeploySubView(new RestView(750), choicePanel1, true); } else { var choiceView = new ChoiceView(new string[] { selectedStimulus.Class.Settings.Answer1, selectedStimulus.Class.Settings.Answer2, GUIUtils.Strings.DONT_KNOW }); succeeded = () => questionMode == QuestionMode.AskAndVerify ? selectedStimulus.SubclassString.Equals(choiceView.Result.Value) : !GUIUtils.Strings.DONT_KNOW.Equals(choiceView.Result.Value); choicePanel2.Visible = true; this.DeploySubView(choiceView, choicePanel2); } }); this.DeploySubView(classChoice, choicePanel1, false); panel.Controls.Add(choicePanel1); panel.Controls.Add(choicesSoFarLabel); panel.Controls.Add(new Label() { Dock = DockStyle.Bottom }); panel.Controls.Add(choicePanel2); }); }); } }); this.DoOnFinishing(() => { if (succeeded()) { for (int i = 0; i < displayList.Count; i++) { runtime.Classifiers[i].RecordResult(selectedStimulus.Class.Settings.Marker, displayList[i].Prediction == runtime.Provider.StimulusClass1.Settings.Name ? runtime.Provider.StimulusClass1.Settings.Marker : runtime.Provider.StimulusClass2.Settings.Marker, 0); } runtime.CurrentTrial.UserPicked1 = (selectedStimulus == runtime.CurrentTrial.Stimulus1); runtime.CurrentTrial.Succeeded = true; runtime.LogLine("User chose " + selectedStimulus.Class.Settings.Name); } }); }
/// <summary> /// Retrieves the stimuli from this class that are valid when used with the given question mode /// </summary> public IEnumerable<Stimulus> UsedStimuli(QuestionMode questionMode) { var usedStimuli = this.Stimuli.Where(s => s.Used); return questionMode == QuestionMode.AskAndVerify ? usedStimuli.Where(s => s.Subclass != null) : usedStimuli; }
public Question(string qTitle, string rTitle, QuestionMode qm) { variableName = ""; title = qTitle; requestTitle = rTitle; remark = ""; mode = qm; required = true; allowSearch = false; decoration = QuestionDecoration.ForSupplierAndSampleLeads; }
public Question() { variableName = ""; title = ""; requestTitle = ""; remark = ""; mode = QuestionMode.SingleInput; required = true; allowSearch = false; decoration = QuestionDecoration.ForSupplierAndSampleLeads; }