Inheritance: NodeXLApplicationSettingsBase
    //*************************************************************************
    //  Constructor: ClusterUserSettingsDialog()
    //
    /// <summary>
    /// Initializes a new instance of the <see cref="ClusterUserSettingsDialog"
    /// /> class.
    /// </summary>
    ///
    /// <param name="mode">
    /// Indicates the mode in which the dialog is being used.
    /// </param>
    ///
    /// <param name="clusterUserSettings">
    /// The object being edited.
    /// </param>
    //*************************************************************************

    public ClusterUserSettingsDialog
    (
        DialogMode mode,
        ClusterUserSettings clusterUserSettings
    )
    {
        Debug.Assert(clusterUserSettings != null);
        clusterUserSettings.AssertValid();

        m_oClusterUserSettings = clusterUserSettings;

        InitializeComponent();

        if (mode == DialogMode.EditOnly)
        {
            this.Text += " Options";
        }

        // Instantiate an object that saves and retrieves the user settings for
        // this dialog.  Note that the object automatically saves the settings
        // when the form closes.

        m_oClusterUserSettingsDialogUserSettings =
            new ClusterUserSettingsDialogUserSettings(this);

        DoDataExchange(false);

        AssertValid();
    }
Example #2
0
        //*************************************************************************
        //  Constructor: ClusterUserSettingsDialog()
        //
        /// <summary>
        /// Initializes a new instance of the <see cref="ClusterUserSettingsDialog"
        /// /> class.
        /// </summary>
        ///
        /// <param name="mode">
        /// Indicates the mode in which the dialog is being used.
        /// </param>
        ///
        /// <param name="clusterUserSettings">
        /// The object being edited.
        /// </param>
        //*************************************************************************

        public ClusterUserSettingsDialog
        (
            DialogMode mode,
            ClusterUserSettings clusterUserSettings
        )
        {
            Debug.Assert(clusterUserSettings != null);
            clusterUserSettings.AssertValid();

            m_oClusterUserSettings = clusterUserSettings;

            InitializeComponent();

            if (mode == DialogMode.EditOnly)
            {
                this.Text += " Options";
            }

            // Instantiate an object that saves and retrieves the user settings for
            // this dialog.  Note that the object automatically saves the settings
            // when the form closes.

            m_oClusterUserSettingsDialogUserSettings =
                new ClusterUserSettingsDialogUserSettings(this);

            DoDataExchange(false);

            AssertValid();
        }
    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();
            }
        }
    }
Example #4
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();
                }
            }
        }