AutomateOneWorkbook() public static method

public static AutomateOneWorkbook ( ThisWorkbook thisWorkbook, NodeXLControl nodeXLControl, AutomationTasks tasksToRun, String folderToSaveWorkbookTo ) : void
thisWorkbook ThisWorkbook
nodeXLControl Smrf.NodeXL.Visualization.Wpf.NodeXLControl
tasksToRun AutomationTasks
folderToSaveWorkbookTo String
return void
コード例 #1
0
        btnOK_Click
        (
            object sender,
            System.EventArgs e
        )
        {
            if (!DoDataExchange(true))
            {
                return;
            }

            m_oAutomateTasksUserSettings.Save();

            try
            {
                if (m_eMode == DialogMode.EditOnly)
                {
                    // (Just close the dialog.)
                }
                else if (m_oAutomateTasksUserSettings.AutomateThisWorkbookOnly)
                {
                    Debug.Assert(m_oNodeXLControl != null);

                    TaskAutomator.AutomateOneWorkbook(m_oThisWorkbook,
                                                      m_oNodeXLControl, m_oAutomateTasksUserSettings.TasksToRun,
                                                      m_oAutomateTasksUserSettings.FolderToSaveWorkbookTo);
                }
                else
                {
                    // The user settings for this workbook will be used for and
                    // stored in each workbook in the specified folder.

                    CommandDispatcher.SendCommand(this,
                                                  new RunNoParamCommandEventArgs(
                                                      NoParamCommand.SaveUserSettings));

                    String sWorkbookSettings = (new PerWorkbookSettings(
                                                    m_oThisWorkbook.InnerObject)).WorkbookSettings;

                    TaskAutomator.AutomateFolder(
                        m_oAutomateTasksUserSettings.FolderToAutomate,
                        sWorkbookSettings);
                }
            }
            catch (UnauthorizedAccessException oUnauthorizedAccessException)
            {
                // This occurs when a workbook is read-only.

                this.ShowWarning(
                    "A problem occurred while running tasks.  Details:"
                    + "\r\n\r\n"
                    + oUnauthorizedAccessException.Message
                    );

                return;
            }
            catch (Exception oException)
            {
                ErrorUtil.OnException(oException);
                return;
            }

            this.DialogResult = DialogResult.OK;
            this.Close();
        }