Provides event information for the event.
Inheritance: System.EventArgs
Example #1
0
    WorksheetContextMenuManager_RequestEdgeCommandEnable
    (
        Object sender,
        RequestEdgeCommandEnableEventArgs e
    )
    {
        AssertValid();

        // Get the edge corresponding to the row the user right-clicked in the
        // edge worksheet.  This can be null.

        IEdge oClickedEdge =
            WorksheetContextMenuManagerRowIDToEdge(e.EdgeRowID);

        Boolean bEnableSelectAllEdges, bEnableDeselectAllEdges,
            bEnableSelectAdjacentVertices, bEnableDeselectAdjacentVertices,
            bEnableEditEdgeAttributes;

        GetEdgeCommandEnableFlags(oClickedEdge,
            out bEnableSelectAllEdges,
            out bEnableDeselectAllEdges,
            out bEnableSelectAdjacentVertices,
            out bEnableDeselectAdjacentVertices,
            out bEnableEditEdgeAttributes
            );

        e.EnableSelectAllEdges = bEnableSelectAllEdges;
        e.EnableDeselectAllEdges = bEnableDeselectAllEdges;
        e.EnableSelectAdjacentVertices = bEnableSelectAdjacentVertices;
        e.EnableDeselectAdjacentVertices = bEnableDeselectAdjacentVertices;
    }
    AddEdgeContextMenuItems
    (
        Microsoft.Office.Interop.Excel.Range oClickedRange
    )
    {
        Debug.Assert(oClickedRange != null);
        AssertValid();

        Int32 iClickedEdgeID;
        CommandBarPopup oTopLevelPopup;

        // Add a top-level NodeXL popup menu item.

        PrepareToAddChildMenuItems(oClickedRange, m_oEdgeTable,
            CommonTableColumnNames.ID, out iClickedEdgeID,
            out oTopLevelPopup);

        // Add child menu items.

        CommandBarButton oSelectAllEdgesButton = AddContextMenuItem(
            oTopLevelPopup, "Select &All Edges", iClickedEdgeID,
            new _CommandBarButtonEvents_ClickEventHandler(
                oSelectAllEdgesButton_Click) );

        CommandBarButton oDeselectAllEdgesButton = AddContextMenuItem(
            oTopLevelPopup, "&Deselect All Edges", iClickedEdgeID,
            new _CommandBarButtonEvents_ClickEventHandler(
                oDeselectAllEdgesButton_Click) );

        CommandBarButton oSelectAdjacentVerticesOfEdgeButton =
            AddContextMenuItem(oTopLevelPopup, "Select Ad&jacent Vertices",
            iClickedEdgeID,
            new _CommandBarButtonEvents_ClickEventHandler(
                oSelectAdjacentVerticesOfEdgeButton_Click) );

        CommandBarButton oDeselectAdjacentVerticesOfEdgeButton =
            AddContextMenuItem(oTopLevelPopup, "Deselect Adjace&nt Vertices",
            iClickedEdgeID,
            new _CommandBarButtonEvents_ClickEventHandler(
                oDeselectAdjacentVerticesOfEdgeButton_Click) );

        // The custom menu items are disabled by default.  To enable them, the
        // RequestEdgeCommandEnable event must be handled.

        RequestEdgeCommandEnableEventHandler oRequestEdgeCommandEnable =
            this.RequestEdgeCommandEnable;

        if (oRequestEdgeCommandEnable == null)
        {
            return;
        }

        RequestEdgeCommandEnableEventArgs oEventArgs =
            new RequestEdgeCommandEnableEventArgs(iClickedEdgeID);

        oRequestEdgeCommandEnable(this, oEventArgs);

        oSelectAllEdgesButton.Enabled = oEventArgs.EnableSelectAllEdges;

        oDeselectAllEdgesButton.Enabled = oEventArgs.EnableDeselectAllEdges;

        oSelectAdjacentVerticesOfEdgeButton.Enabled =
            oEventArgs.EnableSelectAdjacentVertices;

        oDeselectAdjacentVerticesOfEdgeButton.Enabled =
            oEventArgs.EnableDeselectAdjacentVertices;

        // Add a "set color" menu item if the clicked range is a color cell.

        AddSetColorContextMenuItem(m_oEdgeTable, oClickedRange,
            EdgeTableColumnNames.Color,
            EdgeTableColumnNames.LabelTextColor);
    }