Smrf.NodeXL.ExcelTemplate.AutomateTasksDialog.clbTasksToRun_ItemCheck C# (CSharp) Method

clbTasksToRun_ItemCheck() private method

private clbTasksToRun_ItemCheck ( object sender, System.Windows.Forms.ItemCheckEventArgs e ) : void
sender object
e System.Windows.Forms.ItemCheckEventArgs
return void
    clbTasksToRun_ItemCheck
    (
        object sender,
        ItemCheckEventArgs e
    )
    {
        // AssertValid();

        if (!m_bIgnoreItemCheckEvents)
        {
            // Some tasks are dependent on other tasks.  Automatically check or
            // uncheck tasks as appropriate.

            AutomationTasks eTasksToRun = GetTasksToRun();
            Boolean bItemChecked = (e.NewValue == CheckState.Checked);

            switch ( ItemToAutomationTask( clbTasksToRun.Items[e.Index] ) )
            {
                case AutomationTasks.SaveGraphImageFile:
                case AutomationTasks.ExportToNodeXLGraphGallery:
                case AutomationTasks.ExportToEmail:

                    if (bItemChecked)
                    {
                        eTasksToRun |= (
                            AutomationTasks.ReadWorkbook
                            |
                            AutomationTasks.SaveWorkbookIfNeverSaved
                            );
                    }

                    break;

                case AutomationTasks.ReadWorkbook:
                case AutomationTasks.SaveWorkbookIfNeverSaved:

                    if (!bItemChecked)
                    {
                        eTasksToRun &= ~(
                            AutomationTasks.SaveGraphImageFile
                            |
                            AutomationTasks.ExportToNodeXLGraphGallery
                            |
                            AutomationTasks.ExportToEmail
                            );
                    }

                    break;

                default:

                    break;
            }

            SetTasksToRun(eTasksToRun);
        }
    }