Пример #1
0
        public TrainerWindow()
        {
            InitializeComponent();

            _jsonSettingsIo = new JsonSettingsIO();
            _trainingProgressBox = new TrainingProgressBox(TrainingProgressTextBlock);
            _sessionStatistics = new SessionStatistics(this);

            _dispatcherTimer = new DispatcherTimer
            {
                Interval = TimeSpan.FromMinutes(5)
            };

            _dispatcherTimer.Tick += (sender, args) => TriggerAutoSave();

            TrainerViewModel = new TrainerViewModel
            {
                TrainingGameSettings = _jsonSettingsIo.ReadTrainingGameSettings(),
                ExperimentSettings = _jsonSettingsIo.ReadExperimentSettings(),
                NeatEvolutionAlgorithmParameters = _jsonSettingsIo.ReadEvolutionAlgorithmParameters()
            };

            DataContext = TrainerViewModel;

            _trainingState = TrainingState.Uninitialised;
            _settingsMinimised = false;
        }
Пример #2
0
        private void RestoreDefaultButton_Click(object sender, RoutedEventArgs e)
        {
            TrainerViewModel = new TrainerViewModel
            {
                TrainingGameSettings = _jsonSettingsIo.ReadDefaultTrainingGameSettings(),
                ExperimentSettings = _jsonSettingsIo.ReadDefaultExperimentSettings(),
                NeatEvolutionAlgorithmParameters = _jsonSettingsIo.ReadDefaultEvolutionAlgorithmParameters()
            };

            DataContext = TrainerViewModel;

            _trainingProgressBox.WriteLine("Default settings have been restored.");
        }