Example #1
0
        void display_result()
        {
            DateTime time_end   = DateTime.Now;
            TimeSpan difference = time_end.Subtract(timer);

            time_stamp = difference.ToString("c");
            bool combination_error = true;

            for (int i = 0; i < MAX_INPUT; i++)
            {
                if (user_input[i] != combination[i])
                {
                    combination_error = false;
                    break;
                }
            }


            if (mode.Equals("calibrate") && combination_error == true)
            {
                Cognitiv_Test_Info newCognitiveInfo = new Cognitiv_Test_Info {
                    cognitiv_calibrate = time_stamp,
                    cognitiv_time      = time_stamp
                };
                Cognitiv_Info_Items.Add(newCognitiveInfo);
                cognitiveDB.Cognitiv_Test_Information.InsertOnSubmit(newCognitiveInfo);

                this.NavigationService.Navigate(new Uri("/MotionTest.xaml?mode=" + mode, UriKind.Relative));
            }
            else if (mode.Equals("calibrate") && combination_error == false)
            {
                MessageBox.Show("Wrong combination input. Please try again");

                this.NavigationService.Navigate(new Uri("/CognitivTest.xaml?mode=" + mode, UriKind.Relative));
            }
            else
            {
                this.NavigationService.Navigate(new Uri("/ResultPage.xaml?mode=" + mode + "&result=" + combination_error, UriKind.Relative));
            }
        }
Example #2
0
        void display_result()
        {
            DateTime time_end = DateTime.Now;
            TimeSpan difference = time_end.Subtract(timer);
            time_stamp = difference.ToString("c");
            bool combination_error = true;

            for (int i = 0; i < MAX_INPUT; i++)
            {
                if (user_input[i] != combination[i])
                {
                    combination_error = false;
                    break;
                }
            }

            if (mode.Equals("calibrate") && combination_error == true)
            {
                Cognitiv_Test_Info newCognitiveInfo = new Cognitiv_Test_Info{cognitiv_calibrate = time_stamp,
                                                                              cognitiv_time = time_stamp};
                Cognitiv_Info_Items.Add(newCognitiveInfo);
                cognitiveDB.Cognitiv_Test_Information.InsertOnSubmit(newCognitiveInfo);

                this.NavigationService.Navigate(new Uri("/MotionTest.xaml?mode=" + mode, UriKind.Relative));
            }
            else if (mode.Equals("calibrate") && combination_error == false)
            {
                MessageBox.Show("Wrong combination input. Please try again");

                this.NavigationService.Navigate(new Uri("/CognitivTest.xaml?mode=" + mode, UriKind.Relative));
            }
            else
            {
                this.NavigationService.Navigate(new Uri("/ResultPage.xaml?mode=" + mode + "&result=" + combination_error, UriKind.Relative));
            }
        }