ATMLCommonLibrary.controls.awb.AWBEditor.OnKeyDown C# (CSharp) Method

OnKeyDown() protected method

protected OnKeyDown ( KeyEventArgs e ) : void
e System.Windows.Forms.KeyEventArgs
return void
        protected override void OnKeyDown(KeyEventArgs e)
        {
            try
            {
                if (e.Alt && e.KeyCode == Keys.F2)
                {
                    ToggleBookmark();
                }
                else if (e.KeyCode == Keys.F2)
                {
                    GotoNextBookmark();
                }
                else if (e.KeyCode == Keys.Up
                         || e.KeyCode == Keys.Down
                         || e.KeyCode == Keys.Left
                         || e.KeyCode == Keys.Right
                         || e.Control)
                {
                    //Check if valid guid
                    Guid result;
                    String attributeValue = "";

                    if (e.Control && e.KeyCode == Keys.O)
                    {
                        if (Guid.TryParse( Selection.Text, out result ))
                        {
                            attributeValue = GetAttributeValueFromPosition( Selection.Text );
                            var form = new DocumentForm();
                            form.Document = DocumentManager.GetDocument( attributeValue );
                            form.StartPosition = FormStartPosition.WindowsDefaultLocation;
                            form.ShowDialog();
                        }
                        //from current position go back upto 32 chars to see if there is a quote
                    }
                    else if (e.Control && e.Alt && e.KeyCode == Keys.Space)
                    {
                        Line line = Lines.Current;
                        if (line != null)
                            line.ToggleFoldExpanded();
                    }
                    else if (e.Control && e.Alt && e.KeyCode == Keys.M)
                    {
                        Commands.Execute( BindableCommand.ShowFind );
                    }
                    else if (e.Control && e.KeyCode == Keys.W)
                    {
                        ToggleWordWrap();
                    }
                    else
                    {
                        base.OnKeyDown( e );
                    }
                }
                else
                {
                    base.OnKeyDown( e );
                }
            }
            catch (Exception exception)
            {
                LogManager.Error( exception );
            }
        }