コード例 #1
0
ファイル: Quiz.cs プロジェクト: kontur-edu/uLearn
		public override Component ToEdxComponent(string displayName, Slide slide, int componentIndex)
		{
			var items = new []
			{
				new Choice { Correct = Answer, Text = "true" },
				new Choice { Correct = !Answer, Text = "false" }
			};
			var cg = new MultipleChoiceGroup { Label = Text, Type = "MultipleChoice", Choices = items };
			return new MultipleChoiceComponent
			{
				UrlName = slide.NormalizedGuid + componentIndex,
				ChoiceResponse = new MultipleChoiceResponse { ChoiceGroup = cg },
				Title = EdxTexReplacer.ReplaceTex(Text),
				Solution = new Solution(Explanation)
			};
		}
コード例 #2
0
ファイル: Quiz.cs プロジェクト: kontur-edu/uLearn
		public override Component ToEdxComponent(string displayName, Slide slide, int componentIndex)
		{
			var items = Items.Select(x => new Choice { Correct = x.IsCorrect, Text = EdxTexReplacer.ReplaceTex(x.Description) }).ToArray();
			ChoiceResponse cr;
			if (Multiple)
			{
				var cg = new CheckboxGroup { Label = Text, Direction = "vertical", Choices = items };
				cr = new ChoiceResponse { ChoiceGroup = cg };
			}
			else
			{
				var cg = new MultipleChoiceGroup { Label = Text, Type = "MultipleChoice", Choices = items };
				cr = new MultipleChoiceResponse { ChoiceGroup = cg };
			}
			return new MultipleChoiceComponent
			{
				UrlName = slide.NormalizedGuid + componentIndex,
				ChoiceResponse = cr,
				Title = EdxTexReplacer.ReplaceTex(Text)
			};
		}