Patcher.UI.Windows.MainWindow.Window_KeyDown C# (CSharp) Method

Window_KeyDown() private method

private Window_KeyDown ( object sender, System.Windows.Input.KeyEventArgs e ) : void
sender object
e System.Windows.Input.KeyEventArgs
return void
        private void Window_KeyDown(object sender, KeyEventArgs e)
        {
            var choices = offeredChoices;
            if (!e.Handled && choices != null)
            {
                var choice = choices.Where(c => c.Key == e.Key).FirstOrDefault();
                if (choice != null)
                {
                    SelectChoice(choice);
                    e.Handled = true;
                }
            }

            if (!e.Handled)
            {
                switch (e.Key)
                {
                    case Key.Escape:
                        if (terminating)
                        {
                            Close();
                            e.Handled = true;
                        }
                        break;

                    case Key.Space:
                        if (!paused)
                        {
                            paused = true;
                        }
                        break;
                }
            }
        }