Exemple #1
0
 public static void Generate(IWin32Window owner, DataSet data)
 {
     foreach (DataTable table in data.Tables)
     {
         var form = new ResultsForm(table);
         form.Show();
     }
 }
        public TriviaController(Form mainForm)
        {
            this.mainForm = mainForm;

            db = new QuizContext();


            questionForm        = new QuestionForm(this, mainForm);
            resultsForm         = new ResultsForm(this, mainForm);
            manageQuestionsForm = new ManageQuestionsForm(this, mainForm);
        }
Exemple #3
0
        /// <summary>
        /// Display the correctness of the user's supplied answer
        /// </summary>
        /// <param name="correct">Boolean representing correctness</param>
        private async Task ShowResult(bool correct)
        {
            try
            {
                //If answer is correct change it to green, else red
                AnswerInputBox.Foreground = correct ? new SolidColorBrush(Colors.Green) : new SolidColorBrush(Colors.Red);
                //Delay for 3 seconds before continuing
                await Task.Delay(3000);

                //Change the color back to white
                AnswerInputBox.Foreground = new SolidColorBrush(Colors.White);
                //Clear the answer box
                AnswerInputBox.Text = "";
                //Check to see if the game is over
                AnswerInputBox.IsEnabled = true;
                SubAnswerBtn.IsEnabled   = true;
                AnswerInputBox.Focus();
                if (CurGame.RemRounds != 0)
                {
                    //Get a new problem
                    PopulateProblem();
                    //Restart the timer
                    myTimer.Start();
                }
                else
                {
                    //Display the results window
                    ResultsForm resultsForm = new ResultsForm(CurGame.Score, Player);
                    App.Current.MainWindow = resultsForm;
                    this.Close();
                    resultsForm.Show();
                }
            }
            catch (Exception ex)
            {
                throw new Exception(MethodInfo.GetCurrentMethod().DeclaringType.Name + "." +
                                    MethodInfo.GetCurrentMethod().Name + " -> " + ex.Message);
            }
        }
Exemple #4
0
        private void fractionToolStripMenuItem_Click(object sender, EventArgs e)
        {
            List<ClusterOutput> oo = new List<ClusterOutput>();

            if (manager.clOutput == null || manager.clOutput.Count==0)
            {
                MessageBox.Show("No data! Nothing to be done!");
                return;
            }

            foreach (var item in manager.clOutput)
                oo.Add(item.Value);

            FormFraction f = new FormFraction(oo[0].juryLike!=null);

            DialogResult res=f.ShowDialog();

            if (res == DialogResult.OK)
            {                
                Fraction fr = new Fraction(oo);
                ResultsForm frRes = new ResultsForm();
                Progress prog = new Progress(fr,frRes);
                prog.Start();
                prog.Show();
                Thread startProg = new Thread(fr.GetFraction);
                fractionParams p;
                p.clustersNum = f.consideredClusters;
                p.distance = f.dist;
                p.distThreshold = f.distThreshold;
                p.profileName = f.profileName;
                startProg.Start(p);         
               // fr.GetFraction(f.dist,f.profileName,f.distThreshold,f.consideredClusters);
                //prog.Close();
            }
        }
Exemple #5
0
        private void button3_Click(object sender, EventArgs e)
        {           
            DistanceMeasures measure = distanceControl1.distDef;
            
            List<string> refStructures = new List<string>();
            dirName = textBox2.Text;

            try
            {
                    if (textBox1.Text != null && textBox1.Text.Length > 5 && File.Exists(textBox1.Text))
                    {
                        string[] tmp = textBox1.Text.Split(Path.DirectorySeparatorChar);
                        native = tmp[tmp.Length - 1];
                    }
                
                currentV = 0;
                ResultsForm fr = new ResultsForm();
                Progress pr = new Progress(this, fr);
                pr.Start();
                pr.Show();
                Thread startProg = new Thread(CalcStat);
                startProg.Start();

                
            }
            catch(Exception ex)
            {
                MessageBox.Show("Exception: " + ex.Message);
            }
        }
        private void CalcBtn_Click(object sender, EventArgs e)
        {

            Thread start = new Thread(CalcIndex);
            ResultsForm frRes = new ResultsForm();
            Progress prog = new Progress(this, frRes);
            prog.Start();
            prog.Show();

            start.Start();                     
        }
Exemple #7
0
        internal static void StartTest(string name,
                                       IEnumerable <Question> questions,
                                       bool shuffle,
                                       Action onFinish = null,
                                       Action <TestResults> onResults = null,
                                       bool oneOff = false)
        {
            var tester = new TestTester(name, questions, Properties.Settings.Default.testSkippable);

            void testFinish()
            {
                if (tester.DialogResult != DialogResult.OK)
                {
                    onFinish?.Invoke();
                    return;
                }

                var results = tester.Results;

                onResults?.Invoke(results);

                var resultForm = new ResultsForm(name, results, oneOff);

                resultForm.FormClosing += (s, e) =>
                {
                    var result = resultForm.DialogResult;

                    switch (result)
                    {
                    default:
                        // The user has exited the test.
                        onFinish?.Invoke();
                        return;

                    case DialogResult.Abort:
                        // The user is testing incorrect answers.
                        var incorrect = results.Incorrect.Select(x => x.question);

                        if (shuffle)
                        {
                            incorrect.Shuffle();
                        }

                        tester = new TestTester(name, incorrect, Properties.Settings.Default.testSkippable)
                        {
                            onFinish = testFinish
                        };
                        break;

                    case DialogResult.OK:
                        // Try again
                        // Reshuffle questions

                        if (shuffle)
                        {
                            questions.Shuffle();
                        }
                        tester = new TestTester(name, questions, Properties.Settings.Default.testSkippable)
                        {
                            onFinish = testFinish
                        };
                        break;
                    }

                    tester.Show();
                };

                resultForm.Show();
            }

            tester.onFinish = testFinish;

            tester.Show();
        }