Smrf.NodeXL.ExcelTemplate.TaskAutomator.CheckTasksToRunArgument C# (CSharp) Method

CheckTasksToRunArgument() private static method

private static CheckTasksToRunArgument ( AutomationTasks &eTasksToRun ) : void
eTasksToRun AutomationTasks
return void
    CheckTasksToRunArgument
    (
        ref AutomationTasks eTasksToRun
    )
    {
        // Here are the various AutomationTasks flag dependencies:
        //
        // SaveGraphImageFile requires ReadWorkbook, because you can't save an
        // image of a graph that hasn't been shown yet.
        //
        // SaveGraphImageFile requires SaveWorkbookIfNeverSaved, because the
        // image is saved to a folder and the folder isn't determined until the
        // workbook is saved.
        //
        // ExportToNodeXLGraphGallery and ExportToEmail require ReadWorkbook,
        // because you can't export an image of a graph that hasn't been shown
        // yet.
        //
        // ExportToNodeXLGraphGallery and ExportToEmail require
        // SaveWorkbookIfNeverSaved, because the title or subject of the
        // exported graph is the workbook's file name.

        if ( ShouldRunTask(eTasksToRun,

            AutomationTasks.SaveGraphImageFile
            |
            AutomationTasks.ExportToNodeXLGraphGallery
            |
            AutomationTasks.ExportToEmail
            ) )
        {
            // The SaveWorkbookIfNeverSaved flag was introduced after the
            // SaveGraphImageFile flag, so it's possible to have an older
            // workbook that has SaveGraphImageFile set without the necessary
            // SaveWorkbookIfNeverSaved flag.  Fix this.
            //
            // The ExportToNodeXLGraphGallery and ExportToEmail flags were
            // introduced after all the others, so the dialogs that use this
            // class should ensure that ReadWorkbook and
            // SaveWorkbookIfNeverSaved are specified if
            // ExportToNodeXLGraphGallery is set.  Set it anyway, in case there
            // are any unforseen circumstances where this isn't done.

            eTasksToRun |=
                (
                AutomationTasks.ReadWorkbook
                |
                AutomationTasks.SaveWorkbookIfNeverSaved
                );
        }
    }