Edits a GeneralUserSettings object.
Pass a GeneralUserSettings object to the constructor. If the user edits the object, Form.ShowDialog() returns DialogResult.OK. Otherwise, the object is not modified and returns DialogResult.Cancel.
상속: ExcelTemplateForm
    btnOptions_Click
    (
        object sender,
        EventArgs e
    )
    {
        AssertValid();

        // These are shared by several cases below.

        Form oUserSettingsDialog = null;
        NodeXLApplicationSettingsBase oUserSettings = null;

        switch ( (AutomationTasks)clbTasksToRun.SelectedValue )
        {
            case AutomationTasks.MergeDuplicateEdges:

                oUserSettings = new MergeDuplicateEdgesUserSettings();

                oUserSettingsDialog =
                    new MergeDuplicateEdgesUserSettingsDialog(
                    MergeDuplicateEdgesUserSettingsDialog.DialogMode.EditOnly,
                    (MergeDuplicateEdgesUserSettings)oUserSettings,
                    m_oThisWorkbook.InnerObject);

                break;

            case AutomationTasks.CalculateClusters:

                oUserSettings = new ClusterUserSettings();

                oUserSettingsDialog = new ClusterUserSettingsDialog(
                    ClusterUserSettingsDialog.DialogMode.EditOnly,
                    (ClusterUserSettings)oUserSettings);

                break;

            case AutomationTasks.CalculateGraphMetrics:

                ( new GraphMetricsDialog(
                    GraphMetricsDialog.DialogMode.EditOnly,
                    m_oThisWorkbook.InnerObject) ).ShowDialog();

                break;

            case AutomationTasks.AutoFillWorkbook:

                // ThisWorkbook manages the modeless AutoFillWorkbookDialog, so
                // tell ThisWorkbook to open the dialog.

                m_oThisWorkbook.AutoFillWorkbook(
                    AutoFillWorkbookDialog.DialogMode.EditOnly);

                break;

            case AutomationTasks.CreateSubgraphImages:

                ( new CreateSubgraphImagesDialog(
                    CreateSubgraphImagesDialog.DialogMode.EditOnly, null,
                    null) ).ShowDialog();

                break;

            case AutomationTasks.ReadWorkbook:

                oUserSettings = new GeneralUserSettings();

                oUserSettingsDialog = new GeneralUserSettingsDialog(
                    (GeneralUserSettings)oUserSettings,
                    m_oThisWorkbook.InnerObject);

                break;

            case AutomationTasks.SaveWorkbookIfNeverSaved:

                EditFolderToSaveWorkbookTo();

                break;

            case AutomationTasks.SaveGraphImageFile:

                oUserSettings = new AutomatedGraphImageUserSettings();

                oUserSettingsDialog =
                    new AutomatedGraphImageUserSettingsDialog(
                    (AutomatedGraphImageUserSettings)oUserSettings);

                break;

            case AutomationTasks.ExportToNodeXLGraphGallery:

                ( new ExportToNodeXLGraphGalleryDialog(
                    ExportToNodeXLGraphGalleryDialog.DialogMode.EditOnly,
                    m_oThisWorkbook.InnerObject, null) ).ShowDialog();

                break;

            case AutomationTasks.ExportToEmail:

                ( new ExportToEmailDialog(
                    ExportToEmailDialog.DialogMode.EditOnly,
                    m_oThisWorkbook.InnerObject, null) ).ShowDialog();

                break;

            default:

                Debug.Assert(false);
                break;
        }

        if (oUserSettingsDialog != null)
        {
            Debug.Assert(oUserSettings != null);

            if (oUserSettingsDialog.ShowDialog() == DialogResult.OK)
            {
                oUserSettings.Save();
            }
        }
    }
예제 #2
0
    EditGeneralUserSettings()
    {
        AssertValid();

        if (oNodeXLControl.IsLayingOutGraph)
        {
            return;
        }

        GeneralUserSettings oGeneralUserSettings = new GeneralUserSettings();

        GeneralUserSettingsDialog oGeneralUserSettingsDialog =
            new GeneralUserSettingsDialog(oGeneralUserSettings, m_oWorkbook);

        if (oGeneralUserSettingsDialog.ShowDialog() == DialogResult.OK)
        {
            oGeneralUserSettings.Save();
            ApplyGeneralUserSettings(oGeneralUserSettings);
            oNodeXLControl.DrawGraph();
        }
    }
예제 #3
0
        btnOptions_Click
        (
            object sender,
            EventArgs e
        )
        {
            AssertValid();

            // These are shared by several cases below.

            Form oUserSettingsDialog = null;
            NodeXLApplicationSettingsBase oUserSettings = null;

            switch ((AutomationTasks)clbTasksToRun.SelectedValue)
            {
            case AutomationTasks.MergeDuplicateEdges:

                oUserSettings = new MergeDuplicateEdgesUserSettings();

                oUserSettingsDialog =
                    new MergeDuplicateEdgesUserSettingsDialog(
                        MergeDuplicateEdgesUserSettingsDialog.DialogMode.EditOnly,
                        (MergeDuplicateEdgesUserSettings)oUserSettings,
                        m_oThisWorkbook.InnerObject);

                break;

            case AutomationTasks.CalculateClusters:

                oUserSettings = new ClusterUserSettings();

                oUserSettingsDialog = new ClusterUserSettingsDialog(
                    ClusterUserSettingsDialog.DialogMode.EditOnly,
                    (ClusterUserSettings)oUserSettings);

                break;

            case AutomationTasks.CalculateGraphMetrics:

                (new GraphMetricsDialog(
                     GraphMetricsDialog.DialogMode.EditOnly,
                     m_oThisWorkbook.InnerObject)).ShowDialog();

                break;

            case AutomationTasks.AutoFillWorkbook:

                // ThisWorkbook manages the modeless AutoFillWorkbookDialog, so
                // tell ThisWorkbook to open the dialog.

                m_oThisWorkbook.AutoFillWorkbook(
                    AutoFillWorkbookDialog.DialogMode.EditOnly);

                break;

            case AutomationTasks.CreateSubgraphImages:

                (new CreateSubgraphImagesDialog(
                     CreateSubgraphImagesDialog.DialogMode.EditOnly, null,
                     null)).ShowDialog();

                break;

            case AutomationTasks.ReadWorkbook:

                oUserSettings = new GeneralUserSettings();

                oUserSettingsDialog = new GeneralUserSettingsDialog(
                    (GeneralUserSettings)oUserSettings,
                    m_oThisWorkbook.InnerObject);

                break;

            case AutomationTasks.SaveWorkbookIfNeverSaved:

                EditFolderToSaveWorkbookTo();

                break;

            case AutomationTasks.SaveGraphImageFile:

                oUserSettings = new AutomatedGraphImageUserSettings();

                oUserSettingsDialog =
                    new AutomatedGraphImageUserSettingsDialog(
                        (AutomatedGraphImageUserSettings)oUserSettings);

                break;

            case AutomationTasks.ExportToNodeXLGraphGallery:

                (new ExportToNodeXLGraphGalleryDialog(
                     ExportToNodeXLGraphGalleryDialog.DialogMode.EditOnly,
                     m_oThisWorkbook.InnerObject, null)).ShowDialog();

                break;

            case AutomationTasks.ExportToEmail:

                (new ExportToEmailDialog(
                     ExportToEmailDialog.DialogMode.EditOnly,
                     m_oThisWorkbook.InnerObject, null)).ShowDialog();

                break;

            default:

                Debug.Assert(false);
                break;
            }

            if (oUserSettingsDialog != null)
            {
                Debug.Assert(oUserSettings != null);

                if (oUserSettingsDialog.ShowDialog() == DialogResult.OK)
                {
                    oUserSettings.Save();
                }
            }
        }