Пример #1
0
        //*************************************************************************
        //  Method: OnCreateSubgraphImagesClick()
        //
        /// <summary>
        /// Handles the Click event on the btnCreateSubgraphImages button.
        /// </summary>
        ///
        /// <param name="mode">
        /// Indicates the mode in which the CreateSubgraphImagesDialog is being
        /// used.
        /// </param>
        ///
        /// <remarks>
        /// This method can be called from outside the class to simulate a button
        /// click.
        /// </remarks>
        //*************************************************************************
        public void OnCreateSubgraphImagesClick(
            CreateSubgraphImagesDialog.DialogMode mode
            )
        {
            AssertValid();

            this.ThisWorkbook.CreateSubgraphImages(mode);
        }
Пример #2
0
        //*************************************************************************
        //  Method: CreateSubgraphImages()
        //
        /// <summary>
        /// Creates a subgraph of each of the graph's vertices and saves the images
        /// to disk or the workbook.
        /// </summary>
        ///
        /// <param name="mode">
        /// Indicates the mode in which the CreateSubgraphImagesDialog is being
        /// used.
        /// </param>
        //*************************************************************************
        public void CreateSubgraphImages(
            CreateSubgraphImagesDialog.DialogMode mode
            )
        {
            AssertValid();

            if ( !this.ExcelApplicationIsReady(true) )
            {
            return;
            }

            // Populate the vertex worksheet.  This is necessary in case the user
            // opts to insert images into the vertex worksheet.  Note that
            // PopulateVertexWorksheet() returns false if the vertex worksheet
            // or table is missing, and that it activates the vertex worksheet.

            if ( !PopulateVertexWorksheet(true, true) )
            {
            return;
            }

            ICollection<String> oSelectedVertexNames = new String[0];

            if (mode == CreateSubgraphImagesDialog.DialogMode.Normal)
            {
            // (PopulateVertexWorksheet() should have selected the vertex
            // worksheet.)

            Debug.Assert(this.Application.ActiveSheet is Worksheet);

            Debug.Assert( ( (Worksheet)this.Application.ActiveSheet ).Name ==
                WorksheetNames.Vertices);

            // Get an array of vertex names that are selected in the vertex
            // worksheet.

            oSelectedVertexNames = Globals.Sheet2.GetSelectedVertexNames();
            }

            CreateSubgraphImagesDialog oCreateSubgraphImagesDialog =
            new CreateSubgraphImagesDialog(this.InnerObject,
                oSelectedVertexNames, mode);

            oCreateSubgraphImagesDialog.ShowDialog();
        }