Axiom.Demos.Browser.CommandLine.ConfigDialog.ProcessKey C# (CSharp) Method

ProcessKey() private method

private ProcessKey ( int key ) : bool
key int
return bool
        private bool ProcessKey( int key )
        {

            if ( key == -1 ) //ESCAPE
            {
                if ( _currentOption == null )
                {
                    // ESC at main menu
                    _result = DialogResult.Cancel;
                    return false;
                }
                else
                {
                    // go back to main menu
                    _currentOption = null;
                    return true;
                }
            }

            if ( key == -2 ) //ENTER
            {
                if ( _currentOption == null )
                {
                    // at main menu
                    if ( _numericInput == -1 )
                    {
                        Axiom.Core.Root.Instance.RenderSystem = _currentSystem;

                        _result = DialogResult.Ok;
                        return false;
                    }
                    else if ( _numericInput >= 0 && _numericInput < _menuItems.Count )
                    {
                        _currentOption = (ConfigOption)_menuItems[ _numericInput ];
                        return true;
                    }

                    return true;
                }
                else if ( _numericInput >= 0 && _numericInput < _currentOption.PossibleValues.Count )
                {
                    // at options menu and having an entered number
                    _currentOption.Value = _currentOption.PossibleValues.Values[ _numericInput ].ToString();

                    if ( _currentOption.Name == "Render System" ) // About to change Renderers
                    {
                        _renderSystems = _currentOption;
                        _currentSystem = _renderSystemList[ _numericInput ];

                        BuildOptions();

                        _currentOption = null;

                        return true;
                    }

                    _currentOption = null;
                }

                return true;
            }

            return true;
        }