public QuestionConstructVM(QuestionConstruct questionConstruct, QuestionVM question) : base(questionConstruct) { Debug.Assert(questionConstruct != null); Debug.Assert(question != null); this.questionConstruct = questionConstruct; this.question = question; }
public override void InitRow(object newItem) { if (newItem is QuestionVM) { QuestionVM question = (QuestionVM)newItem; InitQuestion(question); if (question.Question.ConceptId == null && SelectedConcept != null) { //ConceptId setting in the case of adding from Grid question.Question.ConceptId = SelectedConcept.Id; } UpdateModel(false); } }
public QuestionFormVM(StudyUnitVM studyUnit) : base(studyUnit) { concepts = new ObservableCollection<ConceptVM>(); questionsDict = new Dictionary<string, ObservableCollection<QuestionVM>>(); foreach (Question questionModel in studyUnit.QuestionModels) { //QuestionVMの生成 ObservableCollection<QuestionVM> questions = RelatedQuestions(questionModel.ConceptId); QuestionVM question = new QuestionVM(questionModel); InitQuestion(question); //ResponseVMの生成 question.Response = CreateResponse(questionModel.Response); //配列に追加 questions.Add(question); } }
public QuestionFormVM(StudyUnitVM studyUnit) : base(studyUnit) { concepts = new ObservableCollection <ConceptVM>(); questionsDict = new Dictionary <string, ObservableCollection <QuestionVM> >(); foreach (Question questionModel in studyUnit.QuestionModels) { //Create QuestionVM ObservableCollection <QuestionVM> questions = RelatedQuestions(questionModel.ConceptId); QuestionVM question = new QuestionVM(questionModel); InitQuestion(question); //Create ResponseVM question.Response = CreateResponse(questionModel.Response); //Add to array questions.Add(question); } }
public void ChangeImage() { Debug.WriteLine("Change Image"); ConceptVM selectedConcept = SelectedConcept; QuestionVM selectedQuestion = SelectedQuestion; SelectObjectWindowVM <ConceptVM> vm = new SelectObjectWindowVM <ConceptVM>(Concepts); ConceptVM newConcept = SelectObjectWindow.Select(Resources.SelectImage, vm) as ConceptVM; if (newConcept != null && newConcept != selectedConcept) { SelectedQuestions.Remove(selectedQuestion); SelectedQuestionItem = null; ObservableCollection <QuestionVM> questions = RelatedQuestions(newConcept.Id); questions.Add(selectedQuestion); selectedQuestion.Question.ConceptId = newConcept.Id; UpdateModel(true); } }
private TableRow CreateDateTimeResponseRowJa(QuestionVM question, string prefix) { ResponseVM response = question.Response; DateTimeLayoutVM dateTimeLayout = (DateTimeLayoutVM)response.Layout; TableRow tableRow = new TableRow(); //年の入力欄の前の文字 if (HasYearPrefix(dateTimeLayout)) { string text = dateTimeLayout.CalendarEra == DateTimeLayoutCalendarEra.Japanese ? Resources.JapaneseEraTSH : Resources.WesternEra; //各行にセルをつくりそのボーダーの上左右を線なしに設定する。 TableCell calendarEraCell = CreateNoBorderCell(text); tableRow.Append(calendarEraCell); } //年の入力欄 List<TableCell> cells = CreateNumberInputCells(dateTimeLayout.Style, 4); tableRow.Append(cells); //年の入力欄の後の文字 TableCell yearLabelCell = CreateNoBorderCell(Resources.WordYear); tableRow.Append(yearLabelCell); //月の入力欄 if (HasMonth(response)) { cells = CreateNumberInputCells(dateTimeLayout.Style, 2); tableRow.Append(cells); TableCell monthLabelCell = CreateNoBorderCell(Resources.WordMonth); tableRow.Append(monthLabelCell); } //日の入力欄 if (HasDay(response)) { cells = CreateNumberInputCells(dateTimeLayout.Style, 2); tableRow.Append(cells); TableCell dayLabelCell = CreateNoBorderCell(Resources.WordDay); tableRow.Append(dayLabelCell); } //時間の入力欄 if (HasTime(response)) { cells = CreateNumberInputCells(dateTimeLayout.Style, 2); tableRow.Append(cells); TableCell hourLabelCell = CreateNoBorderCell(Resources.WordHour); tableRow.Append(hourLabelCell); cells = CreateNumberInputCells(dateTimeLayout.Style, 2); tableRow.Append(cells); TableCell minLabelCell = CreateNoBorderCell(Resources.WordMinute); tableRow.Append(minLabelCell); } if (!string.IsNullOrEmpty(prefix)) { tableRow.Append(CreateNoBorderCell(prefix)); } TableCell lastCell = CreateLastNoBorderCell(); tableRow.Append(lastCell); return tableRow; }
private Table CreateFreeResponseOfBox(QuestionVM question) { ResponseVM response = question.Response; FreeLayoutVM freeLayout = (FreeLayoutVM)response.Layout; int realRowCount = GetRealRowCount(freeLayout.RowCount); int realColumnCount = GetRealColumnCount(freeLayout.ColumnCount); return CreateTable(realRowCount, realColumnCount); }
public void OnRemoveQuestion(QuestionVM question) { //Memorizeはこの処理の後で呼び出されるので、以下のメソッド内ではよびだしてはならない。 variableForm.OnRemoveQuestion(question); sequenceForm.OnRemoveQuestion(question); bookForm.OnRemoveQuestion(question); questionGroupForm.OnRemoveQuestion(question); }
private TableRow CreateDateTimeResponseRowEn(QuestionVM question, string prefix) { ResponseVM response = question.Response; DateTimeLayoutVM dateTimeLayout = (DateTimeLayoutVM)response.Layout; TableRow tableRow = new TableRow(); TableCell cell = null; List<TableCell> cells = null; //月の入力欄 if (HasMonth(response)) { cell = CreateNoBorderCell(Resources.WordMonth); tableRow.Append(cell); cells = CreateNumberInputCells(dateTimeLayout.Style, 2); tableRow.Append(cells); } //日の入力欄 if (HasDay(response)) { cell = CreateNoBorderCell(Resources.WordDay); tableRow.Append(cell); cells = CreateNumberInputCells(dateTimeLayout.Style, 2); tableRow.Append(cells); } //年の入力欄 string yearLabel = Resources.WordYear; if (dateTimeLayout.CalendarEra == DateTimeLayoutCalendarEra.Japanese) { yearLabel += "[" + Resources.JapaneseEraTSH + "]"; } cell = CreateNoBorderCell(yearLabel); tableRow.Append(cell); cells = CreateNumberInputCells(dateTimeLayout.Style, 4); tableRow.Append(cells); //時間の入力欄 if (HasTime(response)) { cells = CreateNumberInputCells(dateTimeLayout.Style, 2); tableRow.Append(cells); CreateNoBorderCell(":"); cells = CreateNumberInputCells(dateTimeLayout.Style, 2); tableRow.Append(cells); } if (!string.IsNullOrEmpty(prefix)) { tableRow.Append(CreateNoBorderCell(prefix)); } TableCell lastCell = CreateLastNoBorderCell(); tableRow.Append(lastCell); return tableRow; }
public void InitQuestion(QuestionVM question) { question.Parent = this; question.ResponseTypes = Options.ResponseTypes; }
private XElement CreateVar(QuestionVM question) { string parentConvertId = ConvertId(question.Id); XElement varElem = new XElement(cb + TAG_VAR, CreateIDAttribute(parentConvertId), CreateNullableAttr(ATTR_NAME, question.Title) ); varElem.Add(CreateQstn(question)); AppendResponseElelems(varElem, parentConvertId, question.Response); return varElem; }
private void WriteFreeResponse(Body body, QuestionVM question) { ResponseVM response = question.Response; FreeLayoutVM freeLayout = (FreeLayoutVM)response.Layout; if (freeLayout.Style == LayoutStyle.Underline) { //アンダーライン(各セルにアンダーラインのある表) Table table = CreateFreeResponseOfUnderline(question); body.Append(table); } else if (freeLayout.Style == LayoutStyle.Box) { //マス(普通の表) Table table = CreateFreeResponseOfBox(question); body.Append(table); } else if (freeLayout.Style == LayoutStyle.Textbox) { //テキストボックス(罫線なしの表) Table table = CreateFreeResponseOfTextbox(question); body.Append(table); } }
private void WriteChoicesResponse(Body body, QuestionVM question) { ResponseVM response = question.Response; ChoicesLayoutVM choicesLayout = (ChoicesLayoutVM)response.Layout; List<CodeVM> validCodes = GetValidCodes(response.Codes); if (choicesLayout.MeasurementMethod == ChoicesLayoutMesurementMethod.Single || choicesLayout.MeasurementMethod == ChoicesLayoutMesurementMethod.Multiple) { //測定法が単一回答か多重回答の場合 Table table = CreateFilledTable(choicesLayout.Surround, false); List<List<CodeVM>> codesList = SplitCodes(validCodes, choicesLayout); //縦向きの場合(splitCount=列数となる) TableRow tableRow = new TableRow(); table.Append(tableRow); int firstCodesCount = codesList[0].Count; //セル中のパラグラフ数をあわせるため(レイアウト枠を表示するため)に最後の列では空パラグラフを追加する。 foreach (List<CodeVM> codes in codesList) { TableCell cell = CreateChoicesCell(codes, firstCodesCount); tableRow.Append(cell); } body.Append(table); } else { //意味微分法(SD法の場合) Table table = CreateFilledTable(true, true); TableRow tableRow1 = new TableRow(); TableRow tableRow2 = new TableRow(); table.Append(tableRow1); table.Append(tableRow2); foreach (CodeVM code in validCodes) { tableRow1.Append(CreateCenterCell(code.Value)); tableRow2.Append(CreateCenterCell(code.Label)); } body.Append(table); } }
public void RemoveQuestion(QuestionVM question) { bool removed = false; for (int i = constructs.Count - 1; i >= 0; i--) { ConstructVM construct = constructs[i]; if (construct is QuestionConstructVM ) { QuestionConstructVM questionConstruct = (QuestionConstructVM)construct; if (questionConstruct.Question == question) { constructs.RemoveAt(i); removed = true; } } } if (removed) { UpdateModel(false); } }
public void InsertQuestionConstruct(QuestionVM question, bool manualOperation) { ConstructVM construct = ConstructVM.FindByQuestionId(constructs, question.Id); if (construct != null) { if (manualOperation) { //画面から追加した場合エラーメッセージを表示する MessageBox.Show(Resources.AlreadySelectedQuestion); //選択済みの質問です } return; } QuestionConstruct questionConstructModel = new QuestionConstruct(); questionConstructModel.QuestionId = question.Id; questionConstructModel.No = ControlConstructScheme.QUESTION_NO_PREFIX + (ConstructUtils.QuestionConstructCount(constructs) + 1); QuestionConstructVM questionConstruct = new QuestionConstructVM(questionConstructModel, question); InsertConstruct(questionConstruct, manualOperation); }
public void OnRemoveQuestion(QuestionVM question) { foreach (QuestionGroupVM questionGroup in QuestionGroups) { questionGroup.Questions.Remove(question); } }
private void CreateVariableFor(QuestionVM question) { if (question.IsCreatedVariable) { //既に生成済みの場合作らない return; } VariableVM variable = VariableVM.FindByQuestionId(Variables, question.Id); if (variable != null) { //既に存在している場合は作らない(フラグで処理しているので念のため?) return; } question.IsCreatedVariable = true; Variable variableModel = new Variable(); variableModel.Title = "V" + (Variables.Count + 1); variableModel.Label = question.Title; variableModel.ConceptId = question.Question.ConceptId; variableModel.QuestionId = question.Id; variableModel.UniverseId = StudyUnit.DefaultUniverseGuid; variableModel.Response = question.DupResponseModel(); variableModel.Response.Title = null; //変数の回答法にはタイトル設定はできないのでnullにしておく。こうしておくことで変数設計画面で1からコードをいれたときのコード群名の生成が正しくなる。 VariableVM newVariable = new VariableVM(variableModel); InitVariable(newVariable); newVariable.Response = CreateResponse(variableModel.Response); variables.Add(newVariable); }
private Table CreateFreeResponseOfTextbox(QuestionVM question) { ResponseVM response = question.Response; FreeLayoutVM freeLayout = (FreeLayoutVM)response.Layout; //枠線、罫線ありの表を生成する。 int realRowCount = GetRealRowCount(freeLayout.RowCount); int realColumnCount = GetRealColumnCount(freeLayout.ColumnCount); Table table = CreateDefaultTable(); TableRow tableRow = new TableRow(); table.Append(tableRow); //1つのセルを作成 int cellWidth = CalcBoxCellWidth(realColumnCount); TableCell tableCell = CreateBorderCell(cellWidth); tableRow.Append(tableCell); for (int r = 0; r < realRowCount - 1; r++) //一行追加済みなのでその分へらす { //その中に行数分のパラグラフ tableCell.Append(CreateEmptyParagraph()); } return table; }
private XElement CreateQstn(QuestionVM question) { string type = GetResponseDomainType(question.Response.TypeCode); XElement qstn = new XElement(cb + TAG_QSTN, CreateNullableAttr(ATTR_RESPONSE_DOMAIN_TYPE, type), CreateNullable(cb + TAG_QSTN_LIT, question.Text)); return qstn; }
private Table CreateFreeResponseOfUnderline(QuestionVM question) { ResponseVM response = question.Response; FreeLayoutVM freeLayout = (FreeLayoutVM)response.Layout; //枠線なし、横罫線だけの表を作る。 int realRowCount = GetRealRowCount(freeLayout.RowCount); int realColumnCount = GetRealColumnCount(freeLayout.ColumnCount); Table table = CreateDefaultTable(); int cellWidth = CalcBoxCellWidth(realColumnCount); for (int r = 0; r < realRowCount; r++) { //各行にセルをつくりそのボーダーの上左右を線なしに設定する。 TableRow tableRow = new TableRow(); table.Append(tableRow); TableCell tableCell = CreateUnderlineCell(cellWidth); tableRow.Append(tableCell); } return table; }
public void OnRemoveQuestion(QuestionVM question) { foreach (VariableVM variable in variables) { if (variable.QuestionId == question.Id) { variable.QuestionId = null; } } }
private void WriteDateTimeResponse(Body body, QuestionVM question) { ResponseVM response = question.Response; DateTimeLayoutVM dateTimeLayout = (DateTimeLayoutVM)response.Layout; Table table = CreateFilledTable(); string prefix = null; if (HasRange(response)) { prefix = Resources.FromTo; } if (config.IsLanguageEn) { TableRow row1 = CreateDateTimeResponseRowEn(question, prefix); table.Append(row1); if (HasRange(response)) { TableRow row2 = CreateDateTimeResponseRowEn(question, " "); table.Append(row2); } } else { TableRow row1 = CreateDateTimeResponseRowJa(question, prefix); table.Append(row1); if (HasRange(response)) { TableRow row2 = CreateDateTimeResponseRowJa(question, " "); table.Append(row2); } } body.Append(table); }
//質問が削除されたときの処理を行う public void OnRemoveQuestion(QuestionVM question) { foreach (ControlConstructSchemeVM controlConstructScheme in controlConstructSchemes) { controlConstructScheme.RemoveQuestion(question); } }
private void WriteNumerResponse(Body body, QuestionVM question) { ResponseVM response = question.Response; NumericLayoutVM numericLayout = (NumericLayoutVM)response.Layout; Table table = CreateFilledTable(); TableRow tableRow = new TableRow(); table.Append(tableRow); if (numericLayout.MeasurementMethod == NumericLayoutMeasurementMethod.Number) { //数値を記入する場合 int count = CalcNumericColumnCount(response); tableRow.Append(CreateNumberInputCells(numericLayout.Style, count)); if (!string.IsNullOrEmpty(numericLayout.Unit)) { tableRow.Append(CreateNoBorderCell(numericLayout.Unit)); } tableRow.Append(CreateLastNoBorderCell()); } else { string leftStatement = ToSideStatement(numericLayout.LeftStatement); tableRow.Append(CreateNoBorderCell(leftStatement)); tableRow.Append(CreateNoBorderCell(BuildNumericLine(numericLayout))); string rightStatement = ToSideStatement(numericLayout.RightStatement); tableRow.Append(CreateNoBorderCell(rightStatement)); tableRow.Append(CreateLastNoBorderCell()); } body.Append(table); }
public void OnRemoveQuestion(QuestionVM question) { RemoveBookRelationOfMetaData(question.Id); }