Пример #1
0
        public Form1()
        {
            InitializeComponent();
            rng = new Random();
            micro_expressions      = new List <MicroExpression>();
            buttons                = new Dictionary <Button, ExpressionAnswer>();
            todo_micro_expressions = new List <MicroExpression>();
            button_list            = new List <Button>();

            button_list.Add(button1);
            button_list.Add(button2);
            button_list.Add(button3);
            button_list.Add(button4);
            button_list.Add(button5);
            button_list.Add(button6);
            button_list.Add(button7);

            foreach (Button button in button_list)
            {
                button.Click += answer_button_Click;
            }

            int i      = 0;
            int errors = 0;

            while (true)
            {
                ++i;
                try
                {
                    MicroExpression expression = new MicroExpression(i, facebox);
                    micro_expressions.Add(expression);
                    expression.ImageShowStarted   += Expression_ImageShowStarted;
                    expression.ImageShowCompleted += Expression_ImageShowCompleted;
                }
                catch (Exception)
                {
                    if (++errors == 16)
                    {
                        break;
                    }
                }
            }

            correct_answers    = 0;
            wrong_answers      = 0;
            chosen_language    = 0;
            current_expression = null;

            ChaneButtonsStatus(false);
            RandomizeButtons();
        }
Пример #2
0
 private void StartShowingImage()
 {
     if (todo_micro_expressions.Count > 0)
     {
         int num = rng.Next(todo_micro_expressions.Count);
         current_expression = todo_micro_expressions[num];
         todo_micro_expressions.RemoveAt(num);
         current_expression.Show(1000, 3000, time_counter.Value);
     }
     else
     {
         facebox.Image = null;
         facebox.Refresh();
         ChaneButtonsStatus(false);
     }
 }
Пример #3
0
 private void Expression_ImageShowCompleted(MicroExpression sender, EventArgs e)
 {
     ChaneButtonsStatus(true);
 }
Пример #4
0
 private void Expression_ImageShowStarted(MicroExpression sender, EventArgs e)
 {
     ChaneButtonsStatus(false);
 }