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

oNodeXLControl_GraphLaidOut() private method

private oNodeXLControl_GraphLaidOut ( object sender, AsyncCompletedEventArgs e ) : void
sender object
e AsyncCompletedEventArgs
return void
    oNodeXLControl_GraphLaidOut
    (
        object sender,
        AsyncCompletedEventArgs e
    )
    {
        AssertValid();

        // Remove the keys that may have been added to the graph by
        // ForceLayoutSelected() and ForceLayoutSelectedWithinBounds().

        oNodeXLControl.Graph.RemoveKey(
            ReservedMetadataKeys.LayOutTheseVerticesOnly);

        oNodeXLControl.Graph.RemoveKey(
            ReservedMetadataKeys.LayOutTheseVerticesWithinBounds);

        if (e.Error == null && m_oEdgeRowIDDictionary != null)
        {
            // Forward the event.

            EventHandler<GraphLaidOutEventArgs> oGraphLaidOut =
                this.GraphLaidOut;

            if (oGraphLaidOut != null)
            {
                Debug.Assert(m_oVertexRowIDDictionary != null);

                try
                {
                    oGraphLaidOut( this, new GraphLaidOutEventArgs(
                        this.GraphRectangle, m_oEdgeRowIDDictionary,
                        m_oVertexRowIDDictionary, oNodeXLControl,
                        GetLegendControls() ) );
                }
                catch (Exception oException)
                {
                    ErrorUtil.OnException(oException);
                }
            }
        }

        EnableGraphControls(true);

        if (e.Error is OutOfMemoryException)
        {
            FormUtil.ShowError(
                "The computer does not have enough memory to lay out the"
                + " graph.  Try the following to fix the problem:"
                + "\r\n\r\n"
                + "1. Select a different layout algorithm."
                + "\r\n\r\n"
                + "2. Close other programs."
                + "\r\n\r\n"
                + "3. Restart the computer."
                + "\r\n\r\n"
                + "4. Reduce the number of edges in the graph."
                + "\r\n\r\n"
                + "5. Add more memory to the computer."
                );
        }
        else if (e.Error != null)
        {
            ErrorUtil.OnException(e.Error);
        }
    }
TaskPane