Exemple #1
0
        private void cmdStartTiming_Click(object sender, EventArgs e)
        {
            string scheme = (string)cboScheme.SelectedItem;
            string survey = (string)cboSurvey.SelectedItem;

            switch (scheme)
            {
            case "Method 2 (User Type)":
                double            sum         = 0;
                List <Respondent> chosenUsers = new List <Respondent>();

                foreach (SelectableRespondent r in UserTypes)
                {
                    if (r.Selected)
                    {
                        Respondent chosen = new Respondent(r);
                        chosenUsers.Add(chosen);
                        sum += chosen.Weight;
                    }
                }

                if (sum != 1)
                {
                    // re-weight respondents
                    ReWeightRespondents(chosenUsers);
                }

                if (chosenUsers.Count() == 0)
                {
                    MessageBox.Show("Select at least one user type for timing.");
                    return;
                }

                frmUserTiming frm2 = new frmUserTiming(survey, chosenUsers);
                frm2.Show();
                break;

            case "Method 3 (Whole Survey)":
                frmSurveyTiming frm1 = new frmSurveyTiming(survey);
                frm1.Show();
                break;
            }
        }
Exemple #2
0
        // TODO
        private void method3ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            // get path
            var filePath = string.Empty;

            using (OpenFileDialog openFileDialog = new OpenFileDialog())
            {
                openFileDialog.InitialDirectory = TimingFolder;
                openFileDialog.Filter           = "XML Documents (*.xml)|*.xml";
                openFileDialog.FilterIndex      = 2;
                openFileDialog.RestoreDirectory = true;

                if (openFileDialog.ShowDialog() == DialogResult.OK)
                {
                    //Get the path of specified file
                    filePath = openFileDialog.FileName;
                }
            }

            if (string.IsNullOrEmpty(filePath))
            {
                return;
            }


            try
            {
                SurveyTiming    run = new SurveyTiming(File.ReadAllText(filePath));
                frmSurveyTiming frm = new frmSurveyTiming(run);
                frm.Show();
            }
            catch (Exception ex)
            {
                MessageBox.Show("Invalid saved run.");
                return;
            }
        }