Exemple #1
0
        private void SafeRecreate()
        {
            IOnTickActionContext srlActionContext = _srlAction.DisposeAndExportContext();
            IOnTickActionContext gepActionContext = _gepAction.DisposeAndExportContext();
            IOnTickActionContext rActionContext   = _rAction.DisposeAndExportContext();
            IOnTickActionContext cActionContext   = _cAction.DisposeAndExportContext();
            IOnTickActionContext sActionContext   = _sAction.DisposeAndExportContext();
            IOnTickActionContext spfActionContext = _spfAction.DisposeAndExportContext();

            _states.RemoveStateProviders();

            _render.Dispose();
            _devices.Dispose();

            _devices = new Mitosis.DxRender.DxDeviceContext(_owner.Handle, _renderArea, false);
            _render  = new DxRender.GeometricDxRenderer(_devices);

            _srlAction = new SimResultsLoadingAction(_states, srlActionContext);
            _gepAction = new GuiEventProcessingAction(_devices, _states, gepActionContext);
            _rAction   = new RenderAction(_devices, _render, _states, rActionContext);
            if (_recreateSavers)
            {
                cActionContext.Dispose();
                _cAction = new CaptureAction(_devices, _render, _states, SettingsManager.GetRef().CaptureSettings);
            }
            else
            {
                _cAction = new CaptureAction(_devices, _render, _states, cActionContext);
            }

            _sAction   = new SelectAction(_devices, _render, _states, sActionContext);
            _spfAction = new SelectionPopupFormAction(_states, spfActionContext);

            if (!_states.IsInitialized)
            {
                throw new ApplicationException("Internal error - failed to register all state providers");
            }
        }