Example #1
1
        public void EnumerateValues()
        {
            var filterItems = new List<string>();

            AnswerCollection anss = new AnswerCollection();
            Answer ta = anss.CreateAnswer<TextValue>("my answer");
            ta.UserExtendible = false; // user should not be able to add/remove/reorder iterations in the interview
            ta.SetValue<TextValue>(new TextValue("val1", false), 0); // user should not be able to modify this answer
            ta.SetValue<TextValue>(new TextValue("val2", true), 1);  // user will be able to modify this answer
            ta.SetValue<TextValue>(new TextValue("val3"), 2);        // user will be able to modify this answer
            ta.SetValue<TextValue>("val4", 3);                       // user will be able to modify this answer

            // now enumerate the values
            AnswerValueEnumerator(ta);

            // now enumerate some Number values
            Answer tn = anss.CreateAnswer<NumberValue>("my num answer");
            tn.SetValue<NumberValue>(new NumberValue(3), 0);
            AnswerValueEnumerator(tn);

            // now enumerate some Date values
            Answer td = anss.CreateAnswer<DateValue>("my date answer");
            td.SetValue<DateValue>(new DateValue(DateTime.Now), 0);
            AnswerValueEnumerator(td);
        }
        public void EnumerateValues()
        {
            var filterItems = new List <string>();

            AnswerCollection anss = new AnswerCollection();
            Answer           ta   = anss.CreateAnswer <TextValue>("my answer");

            ta.UserExtendible = false;                                // user should not be able to add/remove/reorder iterations in the interview
            ta.SetValue <TextValue>(new TextValue("val1", false), 0); // user should not be able to modify this answer
            ta.SetValue <TextValue>(new TextValue("val2", true), 1);  // user will be able to modify this answer
            ta.SetValue <TextValue>(new TextValue("val3"), 2);        // user will be able to modify this answer
            ta.SetValue <TextValue>("val4", 3);                       // user will be able to modify this answer

            // now enumerate the values
            AnswerValueEnumerator(ta);

            // now enumerate some Number values
            Answer tn = anss.CreateAnswer <NumberValue>("my num answer");

            tn.SetValue <NumberValue>(new NumberValue(3), 0);
            AnswerValueEnumerator(tn);

            // now enumerate some Date values
            Answer td = anss.CreateAnswer <DateValue>("my date answer");

            td.SetValue <DateValue>(new DateValue(DateTime.Now), 0);
            AnswerValueEnumerator(td);
        }
Example #3
0
        private static AnswerCollection CreateAnswerCollection()
        {
            var answerCollection = new AnswerCollection();

            //Text answers
            var answer = answerCollection.CreateAnswer <TextValue>("TextExample-t");

            answer.SetValue <TextValue>("World");

            return(answerCollection);
        }
Example #4
0
        private static AnswerCollection CreateAnswerCollection()
        {
            var answerCollection = new AnswerCollection();

            //Text answers
            var answer = answerCollection.CreateAnswer <TextValue>("TextExample-t");

            answer.SetValue <TextValue>("World");

            //Number answers
            var numberAnswer = answerCollection.CreateAnswer <NumberValue>("NumberExample-n");

            numberAnswer.SetValue <NumberValue>(123);

            //Date answers
            var dateAnswer = answerCollection.CreateAnswer <DateValue>("DateExample-d");

            dateAnswer.SetValue <DateValue>(DateTime.Now);

            //True/False answers
            var trueFalseAnswer = answerCollection.CreateAnswer <TrueFalseValue>("TrueFalseExample-tf");

            trueFalseAnswer.SetValue <TrueFalseValue>(true);

            //Multiple choice answers
            var mcAnswer        = answerCollection.CreateAnswer <MultipleChoiceValue>("MultipleChoiceExample-mc");
            var multipleChoices = new List <string> {
                "Apple", "Orange"
            };

            mcAnswer.SetValue(new MultipleChoiceValue(multipleChoices.ToArray()));

            //Repeat answers
            var repeatAnswer = answerCollection.CreateAnswer <TextValue>("NameRepeatExample-t");

            repeatAnswer.SetValue <TextValue>("Steve", 0);
            repeatAnswer.SetValue <TextValue>("Carol", 1);
            repeatAnswer.SetValue <TextValue>("John", 2);

            return(answerCollection);
        }