Smrf.NodeXL.ExcelTemplate.TaskPane.oNodeXLControl_KeyDown C# (CSharp) Method

oNodeXLControl_KeyDown() private method

private oNodeXLControl_KeyDown ( object sender, System e ) : void
sender object
e System
return void
    oNodeXLControl_KeyDown
    (
        object sender,
        System.Windows.Input.KeyEventArgs e
    )
    {
        AssertValid();

        Key eKey = e.Key;

        // Check for one of these keys, which can be repeated:
        //
        // Ctrl+R reads the workbook.
        // Ctrl+L lays out the graph and draws it.

        if ( !( Keyboard.IsKeyDown(Key.LeftCtrl) ||
            Keyboard.IsKeyDown(Key.RightCtrl) ) )
        {
            return;
        }

        switch (eKey)
        {
            case Key.R:

                ReadWorkbook();
                return;

            case Key.L:

                ForceLayout();
                return;

            default:

                break;
        }

        // Now check for one of these keys, as long as the key isn't repeating:
        //
        // Ctrl+A selects all vertices and edges.
        // Ctrl+V selects all vertices.
        // Ctrl+E selects all edges.
        // Ctrl+D deselects all.
        // Ctrl+T inverts the selection.
        // Ctrl+P edits the selected vertex attributes.
        // Ctrl+C copies the graph bitmap to the clipboard.
        // Ctrl+I saves the graph image to a file.

        if (e.IsRepeat)
        {
            return;
        }

        switch (eKey)
        {
            case Key.A:

                SelectAllVerticesAndEdges(true);
                break;

            case Key.V:

                SelectAllVertices(true);
                break;

            case Key.E:

                SelectAllEdges(true);
                break;

            case Key.D:

                SelectAllVerticesAndEdges(false);
                break;

            case Key.T:

                InvertSelection();
                break;

            case Key.P:

                EditVertexAttributes();
                break;

            case Key.C:

                CopyGraphBitmap();
                break;

            case Key.I:

                SaveImage();
                break;

            default:

                break;
        }

        // Some of the calls above open a dialog.  Return focus to the
        // NodeXLControl.

        oNodeXLControl.Focus();
    }
TaskPane