Esempio n. 1
0
        static void Main(string[] args)
        {
            ExampleSetBuilder exampleSetBuilder = new ExampleSetBuilder();

            exampleSetBuilder.AddExampleToSet(5, ExampleSetBuilder.ExampleType.Random);
            Training training = new Training(exampleSetBuilder, 3);

            training.TrainingStarted += (sender, dateTime) => Console.WriteLine($"Тренировка начата {dateTime.ToShortTimeString()}");
            training.TrainingEnded   += (sender, dateTime) => Console.WriteLine($"Тренировка окончена {dateTime.ToShortTimeString()}");
            training.Tick            += (sender, time) => Console.WriteLine($"Осталось: {time} секунд!");
            training.TakeNextExample += (sender, ex) => Console.WriteLine($"Выдан новый пример! {ex.ToString()}");
            training.StartTraining();
            Console.ReadKey();
        }
Esempio n. 2
0
        public frmMainForm()
        {
            InitializeComponent();
            butAnswer.Enabled = false;
            ExampleSetBuilder builder = new ExampleSetBuilder();

            builder.AddExampleToSet(2, ExampleSetBuilder.ExampleType.Random);
            training                  = new Training(builder, 2);
            butStart.Click           += (sender, e) => training.StartTraining();
            training.Tick            += Training_Tick;
            training.TakeNextExample += Training_TakeNextExample;
            training.TrainingStarted += (sender, date) => Invoke((Action)(() => SetButtonState()));
            training.TrainingEnded   += (sender, date) => Invoke((Action)(() => SetButtonState()));
        }