예제 #1
0
        public Form1()
        {
            InitializeComponent();
            this.Size         = new Size(350, 500);
            QuestioningThread = new Thread(Questioning);

            inputFace.Size     = new Size(200, 200);
            inputFace.Location = new Point(75, 150);

            LoadQuestions();

            ValeriaDataBase vdb = new ValeriaDataBase();

            vdb.Days.Add(new DayInfo {
                Day = DateTime.Now, Q1 = 0, Q2 = 0, Q3 = 0, Q4 = 0, Q5 = 0, Q6 = 0, Q7 = 0, Q8 = 0, Q9 = 0, Q10 = 0, Q11 = 0, Q12 = 0, Q13 = 0, Total = 0
            });
            vdb.SaveChanges();

            Ss.SetOutputToDefaultAudioDevice();

            Sre = new SpeechRecognitionEngine(Ci);
            Sre.SetInputToDefaultAudioDevice();
            Sre.SpeechRecognized += Sre_SpeechRecognized;
            LoadGreetingGrammar();
            LoadAnswersGrammar();
            Sre.RecognizeAsync(RecognizeMode.Multiple);
        }
예제 #2
0
        private void AnswersAnalysing()
        {
            DayInfo cdi = new DayInfo();

            cdi.Day = DateTime.Now;
            int Qmark;

            //Question 1
            Qmark = 0;
            if (Answers[0] == "Yes" || Answers[0] == "Yeah" || Answers[0] == "Yep")
            {
                Qmark = 2;
            }
            else if (Answers[0] == "No" || Answers[0] == "Not")
            {
                Qmark = -2;
            }
            else if (Answers[0] == "A bit" || Answers[0] == "A little")
            {
                Qmark = 1;
            }
            else if (Answers[0] == "So so")
            {
                Qmark = 0;
            }
            cdi.Q1 = Qmark;

            //Question 2
            Qmark = 0;
            if (Answers[0] == "Yes" || Answers[0] == "Yeah" || Answers[0] == "Yep")
            {
                Qmark = 2;
            }
            else if (Answers[0] == "No" || Answers[0] == "Not")
            {
                Qmark = -2;
            }
            else if (Answers[0] == "A bit" || Answers[0] == "A little")
            {
                Qmark = 1;
            }
            else if (Answers[0] == "So so")
            {
                Qmark = 0;
            }
            cdi.Q2 = Qmark;

            //Question 3
            Qmark = 0;
            if (Answers[0] == "Yes" || Answers[0] == "Yeah" || Answers[0] == "Yep")
            {
                Qmark = -2;
            }
            else if (Answers[0] == "No" || Answers[0] == "Not")
            {
                Qmark = 2;
            }
            else if (Answers[0] == "A bit" || Answers[0] == "A little")
            {
                Qmark = -1;
            }
            else if (Answers[0] == "So so")
            {
                Qmark = 0;
            }
            cdi.Q3 = Qmark;

            //Question 4
            Qmark = 0;
            if (Answers[0] == "Yes" || Answers[0] == "Yeah" || Answers[0] == "Yep")
            {
                Qmark = 2;
            }
            else if (Answers[0] == "No" || Answers[0] == "Not")
            {
                Qmark = -2;
            }
            else if (Answers[0] == "A bit" || Answers[0] == "A little")
            {
                Qmark = 1;
            }
            else if (Answers[0] == "So so")
            {
                Qmark = 0;
            }
            cdi.Q4 = Qmark;

            //Question 5
            Qmark = 0;
            if (Answers[0] == "Yes" || Answers[0] == "Yeah" || Answers[0] == "Yep")
            {
                Qmark = -2;
            }
            else if (Answers[0] == "No" || Answers[0] == "Not")
            {
                Qmark = 2;
            }
            else if (Answers[0] == "A bit" || Answers[0] == "A little")
            {
                Qmark = -1;
            }
            else if (Answers[0] == "So so")
            {
                Qmark = 0;
            }
            cdi.Q5 = Qmark;

            //Question 6
            Qmark = 0;
            if (Answers[0] == "Yes" || Answers[0] == "Yeah" || Answers[0] == "Yep")
            {
                Qmark = -2;
            }
            else if (Answers[0] == "No" || Answers[0] == "Not")
            {
                Qmark = 2;
            }
            else if (Answers[0] == "A bit" || Answers[0] == "A little")
            {
                Qmark = -1;
            }
            else if (Answers[0] == "So so")
            {
                Qmark = 0;
            }
            cdi.Q6 = Qmark;

            //Question 7
            Qmark = 0;
            if (Answers[0] == "Yes" || Answers[0] == "Yeah" || Answers[0] == "Yep")
            {
                Qmark = 2;
            }
            else if (Answers[0] == "No" || Answers[0] == "Not")
            {
                Qmark = -2;
            }
            else if (Answers[0] == "A bit" || Answers[0] == "A little")
            {
                Qmark = 1;
            }
            else if (Answers[0] == "So so")
            {
                Qmark = 0;
            }
            cdi.Q7 = Qmark;

            //Question 8
            Qmark = 0;
            if (Answers[0] == "Yes" || Answers[0] == "Yeah" || Answers[0] == "Yep")
            {
                Qmark = -2;
            }
            else if (Answers[0] == "No" || Answers[0] == "Not")
            {
                Qmark = 2;
            }
            else if (Answers[0] == "A bit" || Answers[0] == "A little")
            {
                Qmark = -1;
            }
            else if (Answers[0] == "So so")
            {
                Qmark = 0;
            }
            cdi.Q8 = Qmark;

            //Question 9
            Qmark = 0;
            if (Answers[0] == "Yes" || Answers[0] == "Yeah" || Answers[0] == "Yep")
            {
                Qmark = 2;
            }
            else if (Answers[0] == "No" || Answers[0] == "Not")
            {
                Qmark = -2;
            }
            else if (Answers[0] == "A bit" || Answers[0] == "A little")
            {
                Qmark = 1;
            }
            else if (Answers[0] == "So so")
            {
                Qmark = 0;
            }
            cdi.Q9 = Qmark;

            //Question 10
            Qmark = 0;
            if (Answers[0] == "Yes" || Answers[0] == "Yeah" || Answers[0] == "Yep")
            {
                Qmark = -2;
            }
            else if (Answers[0] == "No" || Answers[0] == "Not")
            {
                Qmark = 2;
            }
            else if (Answers[0] == "A bit" || Answers[0] == "A little")
            {
                Qmark = -1;
            }
            else if (Answers[0] == "So so")
            {
                Qmark = 0;
            }
            cdi.Q10 = Qmark;

            //Question 11
            Qmark = 0;
            if (Answers[0] == "Yes" || Answers[0] == "Yeah" || Answers[0] == "Yep")
            {
                Qmark = 2;
            }
            else if (Answers[0] == "No" || Answers[0] == "Not")
            {
                Qmark = -2;
            }
            else if (Answers[0] == "A bit" || Answers[0] == "A little")
            {
                Qmark = 1;
            }
            else if (Answers[0] == "So so")
            {
                Qmark = 0;
            }
            cdi.Q11 = Qmark;

            //Question 12
            Qmark = 0;
            if (Answers[0] == "Yes" || Answers[0] == "Yeah" || Answers[0] == "Yep")
            {
                Qmark = 2;
            }
            else if (Answers[0] == "No" || Answers[0] == "Not")
            {
                Qmark = -2;
            }
            else if (Answers[0] == "A bit" || Answers[0] == "A little")
            {
                Qmark = 1;
            }
            else if (Answers[0] == "So so")
            {
                Qmark = 0;
            }
            cdi.Q12 = Qmark;

            //Question 13
            Qmark = 0;
            if (Answers[0] == "Yes" || Answers[0] == "Yeah" || Answers[0] == "Yep")
            {
                Qmark = -2;
            }
            else if (Answers[0] == "No" || Answers[0] == "Not")
            {
                Qmark = 2;
            }
            else if (Answers[0] == "A bit" || Answers[0] == "A little")
            {
                Qmark = -1;
            }
            else if (Answers[0] == "So so")
            {
                Qmark = 0;
            }
            cdi.Q13 = Qmark;

            int total = cdi.Q1 + cdi.Q2 + cdi.Q3 + cdi.Q4 + cdi.Q5 + cdi.Q6 + cdi.Q7 + cdi.Q8 + cdi.Q9 + cdi.Q10 + cdi.Q11 + cdi.Q12 + cdi.Q13;

            cdi.Total = total;

            ValeriaDataBase vdb = new ValeriaDataBase();

            vdb.Days.Add(cdi);
            vdb.SaveChanges();
        }