private static bool RequiresUserInteraction(UiDescriptionItem uiDescriptionItem)
        {
            if (uiDescriptionItem.Value == null) return true;

            var valueAsString = uiDescriptionItem.Value as string;
            return valueAsString != null && valueAsString == string.Empty;
        }
Example #2
0
        private static UiDescription Question(string question, string rightAnswer, IEnumerable<string> wrongAnsers)
        {
            var data = new UiDescription();
            var tmp = new UiDescription();

            var qData = new UiDescriptionItem
            {
                Name = "question",
                ControlType = "Label",
                Value = question
            };
            data.Add(qData);

            var rData = new UiDescriptionItem
            {
                Name = rightAnswer,
                Text = rightAnswer,
                ControlType = "DataRadioButton",
                Value = true,
                CheckRequired = true
            };
            data.Add(rData);

            foreach (var wAnswer in wrongAnsers)
            {
                var wData = new UiDescriptionItem
                {
                    Name = wAnswer,
                    Text = wAnswer,
                    ControlType = "DataRadioButton",
                    Value = false,
                    CheckRequired = true
                };
                tmp.Add(wData);
            }
            foreach (var dataItem in tmp)
                data.Add(dataItem);
            return data;
        }