/// <summary> Executes the create view sheet demo operation. </summary>
        ///
        /// <param name="sheetName"> Name of the ViewSheet to create. </param>
        ///
        /// <returns> true if it succeeds, false if it fails. </returns>
        private bool RunCreateViewSheetDemo(string sheetName)
        {
            this.ShowMessage(LocalizationStrings.CreateViewSheets, LocalizationStrings.Title);

            // Now we'll create some new ViewSheets...
            // First a ViewSheet with a system generated name.
            // If ViewSheets are enabled, this really shouldn't fail.
            if (ViewSheets.CreateViewSheet())
            {
                // Now a ViewSheet with a name of our choosing.
                // If we specify an invalid name (e.g. one that's already used) this could return false.
                var result = ViewSheets.CreateViewSheet(sheetName);
                if (!result && !this.ShowMessage(LocalizationStrings.FailedCreateViewSheet, LocalizationStrings.Title, true))
                {
                    return(false);
                }

                // Now we'll determine the sheetIndex of the "named" ViewSheet in the sheet list.
                var sheetIndex = ViewSheets.GetViewSheet(sheetName);
                if (sheetIndex == -1 && !this.ShowMessage("Retrieving a sheet named '" + sheetName + "' failed!", LocalizationStrings.Title, true))
                {
                    return(false);
                }

                // Now we'll create another sheet with a system generated name and then rename it.
                // This will demonstrate the RenameViewSheet method.
                if (ViewSheets.CreateViewSheet())
                {
                    // New sheets are added to the end of the (zero-based) list, so we can determine it's sheetIndex this way.
                    sheetIndex = ViewSheets.GetSheetCount() - 1;
                    var oldName = ViewSheets.GetViewSheetName(sheetIndex);
                    this.ShowMessage($"Now we'll rename the ViewSheet {oldName} we just created.", LocalizationStrings.Title);

                    result = ViewSheets.RenameViewSheet(sheetIndex, sheetName + " #2");
                    if (!result && !this.ShowMessage($"Renaming {oldName} to {sheetName} #2 failed", LocalizationStrings.Title, true))
                    {
                        return(false);
                    }

                    this.ShowMessage($"We've now added 3 new sheets to the list of {ViewSheets.GetSheetCount()} total sheets.", LocalizationStrings.Title);
                }
            }

            return(true);
        }
        /// <summary> Cycle through the sheets making each to *active* sheet . </summary>
        private void CycleActiveSheet()
        {
            MessageBox.Show(
                LocalizationStrings.CycleActiveSheetMessage,
                LocalizationStrings.Title,
                MessageBoxButtons.OKCancel,
                MessageBoxIcon.Information);

            var sheetCount = ViewSheets.GetSheetCount();

            for (var i = 0; i < sheetCount; i++)
            {
                if (ViewSheets.SetActiveViewSheet(i))
                {
                    GraphicsManager.Repaint();
                    this.ShowLevels();
                }
            }
        }