Smrf.NodeXL.ExcelTemplate.AnalyzeEmailNetworkDialog.OnAnalysisCompleted C# (CSharp) Method

OnAnalysisCompleted() protected method

protected OnAnalysisCompleted ( RunWorkerCompletedEventArgs e ) : void
e System.ComponentModel.RunWorkerCompletedEventArgs
return void
    OnAnalysisCompleted
    (
        RunWorkerCompletedEventArgs e
    )
    {
        AssertValid();

        EnableControls();

        if (e.Cancelled)
        {
            // (Do nothing.)
        }
        else if (e.Error != null)
        {
            Exception oException = e.Error;

            if (oException is WdsConnectionFailureException)
            {
                this.ShowWarning(WdsConnectionFailureMessage);
            }
            else
            {
                throw oException;
            }
        }
        else
        {
            if (m_bClearTablesFirst)
            {
                NodeXLWorkbookUtil.ClearAllNodeXLTables(m_oWorkbook);
            }

            // Populate the edge table with participant pairs.

            Debug.Assert(e.Result is EmailParticipantPair[]);

            EmailParticipantPair[] aoEmailParticipantPairs =
                ( EmailParticipantPair[] )e.Result;

            if (aoEmailParticipantPairs.Length > 0)
            {
                // Note: PopulateEdgesTable modifies the participant pairs.

                PopulateEdgesTable(aoEmailParticipantPairs);
                this.DialogResult = DialogResult.OK;
                this.Close();
            }
            else
            {
                this.ShowInformation("No such emails were found.");
            }
        }
    }