private void createTest_Click(object sender, RoutedEventArgs e)
        {
            string name = testName.Text;
            string description = testDescription.Text;

            if (name.Equals(String.Empty) || description.Equals(String.Empty)) 
            {
                return;
            }

            SociologicalTest sociologicalTest = new SociologicalTest(name, description, testType);

            Window createTestWindow = null;

            if (testType == SociologicalTest.MULT_TEST_TYPE) 
            {
                createTestWindow = new CreateTest(sociologicalTest);
            }
            else if (testType == SociologicalTest.DICHOTOMIC_TEST_TYPE)
            {
                createTestWindow = new CreateDichotomicQuestionWindow(sociologicalTest);
            }
            else 
            {
                createTestWindow = new CreateOpenQuestionWindow(sociologicalTest);
            }

            createTestWindow.ShowDialog();

            RestoreOriginalState();

            tests.Add(sociologicalTest);
        }
 public TestExecutionWindow(SociologicalTest test)
 {
     Test = test;
     InitializeComponent();
     this.WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen;
     InitQuestion();
 }
        private void testsComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            var comboBox = sender as ComboBox;

            string value = comboBox.SelectedItem as string;

            SelectedTest = tests.FirstOrDefault(t => t.Name.Equals(value));
            descriptionLabel.Text = SelectedTest.Description;
            viewTestTypeLabel.Content = testTypes[SelectedTest.Type][0];
        }
 public CreateOpenQuestionWindow(SociologicalTest test)
 {
     Test = test;
     InitializeComponent();
     this.WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen;
 }
示例#5
0
        private SociologicalTest CreateTest(string name, string description, int number, int type,
            Dictionary<int, Dictionary<string, string>> questions, List<Rule> rules) 
        {
            SociologicalTest test = new SociologicalTest(number, name, description, type);

            test.rules = rules;

            foreach (int key in questions.Keys) 
            {
                string text = null;
                string measure = null;
                string example = null;
                Dictionary<string, string> values = questions[key];
                Dictionary<string, string> answers = new Dictionary<string, string>();
                foreach (var value in values) 
                {
                    if (value.Key.Equals("q"))
                    {
                        text = value.Value;
                    }
                    else if (value.Key.Equals("measure")) 
                    {
                        measure = value.Value;
                    }
                    else if (value.Key.Equals("example"))
                    {
                        example = value.Value;
                    }
                    else
                    {
                        answers.Add(value.Key, value.Value);
                    }
                }

                Question question = new Question(text, key, type);
                question.Answers = answers;
                question.Measure = measure;
                question.Example = example;

                test.Questions.Add(key, question);
            }

            return test;
        }
 public CreateTest(SociologicalTest test)
 {
     this.test = test;
     InitializeComponent();
 }