} // public void NormalExit (6 of 8) /// <summary> /// Exit the program normally, returning the status code stored in this /// instance, and optionally call WaitForCarbonUnit to suspend execution /// until the operator has a chance to read the output or capture it /// into the clipboard. If WaitForCarbonUnit is called, its default /// message is used. /// </summary> /// <param name="penmNormalExitAction"> /// This member of the NormalExitAction enumeration controls whether to /// use WaitForCarbonUnit to suspend execution until an operator has a /// chance to read the output. See the NormalExitAction enumeration for /// details. /// </param> /// <remarks> /// This method calls the fourth overload, the most coprehensive /// implementation, passing in the return code stored in the instance, /// which I explicitly cast to the unsigned integer type of its first /// argument, and a null reference for the carbon unit prompt message, /// forcing it to use its default message. /// </remarks> public void NormalExit ( NormalExitAction penmNormalExitAction ) { NormalExit ( ( uint ) _me.AppReturnCode , // Use the exit code stored in the instance. null , // A null pstrOperatorPrompt means use default message. penmNormalExitAction ); // Pass along the caller's instructions. } // public void NormalExit (7 of 8)
} // public void NormalExit (4 of 8) /// <summary> /// Exit the program normally, optionally returning a nonzero status /// code, and optionally calling WaitForCarbonUnit to suspend execution /// until the operator has a chance to read the output or capture it /// into the clipboard. /// </summary> /// <param name="pstrOperatorPrompt"> /// This string specifies an alternative message for method /// WaitForCarbonUnit to display. If this is an empty string or null /// reference, a default message, "Please press the ENTER (Return) key /// to exit the program." is shown. /// </param> /// <param name="penmNormalExitAction"> /// This member of the NormalExitAction enumeration controls whether to /// use WaitForCarbonUnit to suspend execution until an operator has a /// chance to read the output. See the NormalExitAction enumeration for /// details. /// </param> /// <remarks> /// This method calls the fourth overload, the most coprehensive /// implementation, passing in the return code stored in the instance, /// which I explicitly cast to the unsigned integer type of its first /// argument. /// </remarks> public void NormalExit ( string pstrOperatorPrompt , NormalExitAction penmNormalExitAction ) { NormalExit ( ( uint ) _me.AppReturnCode , // Use the exit code stored in the instance. pstrOperatorPrompt , // Pass along the caller's message for WaitForCarbonUnit. penmNormalExitAction ); // Pass along the caller's instructions. } // public void NormalExit (5 of 8)
} // public void NormalExit (5 of 8) /// <summary> /// Exit the program normally, optionally returning a nonzero status /// code, and optionally calling WaitForCarbonUnit to suspend execution /// until the operator has a chance to read the output or capture it /// into the clipboard. If WaitForCarbonUnit is called, its default /// message is used. /// </summary> /// <param name="puintStatusCode"> /// This unsigned integer specifies the program's exit code. /// </param> /// <param name="penmNormalExitAction"> /// This member of the NormalExitAction enumeration controls whether to /// use WaitForCarbonUnit to suspend execution until an operator has a /// chance to read the output. See the NormalExitAction enumeration for /// details. /// </param> /// <remarks> /// This method calls the fourth overload, the most coprehensive /// implementation, passing in a null reference for the carbon unit /// prompt message, forcing it to use its default message. /// </remarks> public void NormalExit ( uint puintStatusCode , NormalExitAction penmNormalExitAction ) { NormalExit ( puintStatusCode , // Pass along the caller's exit code. null , // A null pstrOperatorPrompt means use default message. penmNormalExitAction ); // Pass along the caller's instructions. } // public void NormalExit (6 of 8)
} // public void NormalExit (3 of 8) /// <summary> /// Exit the program normally, optionally returning a nonzero status /// code, and optionally calling WaitForCarbonUnit to suspend execution /// until the operator has a chance to read the output or capture it /// into the clipboard. /// </summary> /// <param name="puintStatusCode"> /// This unsigned integer specifies the program's exit code. /// </param> /// <param name="pstrOperatorPrompt"> /// This string specifies an alternative message for method /// WaitForCarbonUnit to display. If this is an empty string or null /// reference, a default message, "Please press the ENTER (Return) key /// to exit the program." is shown. /// </param> /// <param name="penmNormalExitAction"> /// This member of the NormalExitAction enumeration controls whether to /// use WaitForCarbonUnit to suspend execution until an operator has a /// chance to read the output. See the NormalExitAction enumeration for /// details. /// </param> /// <remarks> /// This method differs sufficiently from overload 2 that it stands on /// its own. Theoretically, every other overload could call this one. /// </remarks> public void NormalExit ( uint puintStatusCode , string pstrOperatorPrompt , NormalExitAction penmNormalExitAction ) { NormalExit ( puintStatusCode , pstrOperatorPrompt , penmNormalExitAction , TIMED_WAIT_DEFAULT_SECONDS , TIMED_WAIT_WAITING_FOR_DEFAULT , TIMED_WAIT_TEXT_COLOR_DEFAULT , TIMED_WAIT_BACKGROUND_COLOR_DEFAULT , TIMED_WAIT_INTERRUPT_CRITERION ); } // public void NormalExit (4 of 8)
} // public void NormalExit (7 of 8) /// <summary> /// Exit the program normally, optionally returning a nonzero status /// code, and optionally calling WaitForCarbonUnit to suspend execution /// until the operator has a chance to read the output or capture it /// into the clipboard. /// </summary> /// <param name="puintStatusCode"> /// This unsigned integer specifies the program's exit code. /// </param> /// <param name="pstrOperatorPrompt"> /// This string specifies an alternative message for method /// WaitForCarbonUnit to display. If this is an empty string or null /// reference, a default message, "Please press the ENTER (Return) key /// to exit the program." is shown. /// </param> /// <param name="penmNormalExitAction"> /// This member of the NormalExitAction enumeration controls whether to /// use WaitForCarbonUnit to suspend execution until an operator has a /// chance to read the output. See the NormalExitAction enumeration for /// details. /// </param> /// <param name="puintSecondsToWait"> /// Specify the number of seconds to wait, which must be a whole number /// greater than or equal to zero. Setting this value to zero causes the /// method to wait for 30 seconds. /// </param> /// <param name="pstrCountdownWaitingFor"> /// Specify the text to display along with the remaining time. If this /// argument is null (Nothing in Visual Basic) or the empy string, the /// method uses a default message. /// /// Currently, the default description is "Program ending," which is /// taken from a resource string in the WizardWrx.ConsoleAids class that /// implements this feature. /// </param> /// <param name="pclrTextColor"> /// Specify a member of the ConsoleColor enumeration to control the text /// color used to display the countdown message. /// /// To use the default (current) screen colors, specify the same /// ConsoleColor value for pclrTextColor and pclrTextBackgroundColor. /// </param> /// <param name="pclrTextBackgroundColor"> /// Specify a member of the ConsoleColor enumeration to control the /// background color used to display the countdown message. /// /// To use the default (current) screen colors, specify the same /// ConsoleColor value for pclrTextColor and pclrTextBackgroundColor. /// </param> /// <param name="penmInterruptCriterion"> /// Specify a member of the DisplayAids.InterruptCriterion enumeration /// to indicate whether you want the timed wait to be interruptible, and /// under what conditions. /// </param> /// <remarks> /// This method differs sufficiently from overload 2 that it stands on /// its own. Theoretically, every other overload could call this one. /// </remarks> public void NormalExit ( uint puintStatusCode , string pstrOperatorPrompt , NormalExitAction penmNormalExitAction , uint puintSecondsToWait , string pstrCountdownWaitingFor , ConsoleColor pclrTextColor , ConsoleColor pclrTextBackgroundColor , DisplayAids.InterruptCriterion penmInterruptCriterion ) { if ( penmNormalExitAction != NormalExitAction.Silent ) { this.DisplayEOJMessage ( ); } // if ( penmNormalExitAction != NormalExitAction.Silent ) switch ( penmNormalExitAction ) { case NormalExitAction.ExitImmediately: case NormalExitAction.Silent: Environment.Exit ( ( int ) puintStatusCode ); break; case NormalExitAction.Timed: Console.WriteLine ( pstrOperatorPrompt ); DisplayAids.TimedWait ( puintSecondsToWait , // puintWaitSeconds pstrCountdownWaitingFor , // pstrCountdownWaitingFor ConsoleColor.Black , // pclrTextColor ConsoleColor.Black , // pclrTextBackgroundColor penmInterruptCriterion ); // penmInterruptCriterion Environment.Exit ( ( int ) puintStatusCode ); break; case NormalExitAction.HaltOnError: if ( puintStatusCode == MagicNumbers.ERROR_SUCCESS ) { // No news is good news. Keep going. Environment.Exit ( MagicNumbers.ERROR_SUCCESS ); } // TRUE block, if ( puintStatusCode == MagicNumbers.ERROR_SUCCESS ) else { // There was an error. Halt the script. DisplayAids.WaitForCarbonUnit ( pstrOperatorPrompt ); Environment.Exit ( ( int ) puintStatusCode ); } // FALSE block, if ( puintStatusCode == MagicNumbers.ERROR_SUCCESS ) break; case NormalExitAction.WaitForOperator: DisplayAids.WaitForCarbonUnit ( pstrOperatorPrompt ); Environment.Exit ( ( int ) puintStatusCode ); break; default: Console.WriteLine ( Properties.Resources.NORMAL_EXIT_INTERNAL_ERROR , // Message template penmNormalExitAction , // Token 0 NormalExitAction.WaitForOperator , // Token 1 Environment.NewLine ); // Token 2 DisplayAids.WaitForCarbonUnit ( pstrOperatorPrompt ); Environment.Exit ( ( int ) puintStatusCode ); break; } // switch ( penmNormalExitAction ) } // public void NormalExit (8 of 8)