public MainForm()
        {
            InitializeComponent();
            WinApi.TimeBeginPeriod(1);

            _codeCompiler = new CodeCompiler(SynchronizationContext.Current);
            _codeCompiler.Compiled += CodeCompilerOnCompiled;
            _codeCompiler.CompilationError += CodeCompilerOnCompilationError;

            SettingsForm.Instance.StoreLastFramesParamChanged += SettingsFormOnStoreLastFramesParamChanged;

            _graphics = new GraphicsControl();
            elementHost1.Child = _graphics;
            _graphics.KeyDown += GraphicsOnKeyDown;
            _graphics.KeyUp += GraphicsOnKeyUp;

            codeEditor.Text = CodeSnippets.HelloWorld;
            codeEditor.TextChanged += CodeEditorOnTextChanged;

            _dynamicGame = new DynamicGame(_graphics, toolStripStatusLabel1)
            {
                CurrentTrackBarValue = trackBar1.Value
            };
            _dynamicGame.CurrentTrackBarValueChanged += DynamicGameOnCurrentTrackBarValueChanged;
            _dynamicGame.FieldsChanged += DynamicGameOnFieldsChanged;
            _dynamicGame.PausedChanged += DynamicGameOnPausedChanged;
            _graphics.MouseDown += (sender, args) => _graphics.Focus();

            UpdateFormTitle();
        }
 /// <summary>
 ///     Initializes a new instance of the DynamicGameSimulator class.
 /// </summary>
 public DynamicGameSimulator(DynamicGame game)
 {
     _game = game;
 }