Beispiel #1
0
        /// <summary>
        /// Informs user with a message box.
        /// </summary>
        /// <param name="argUserInformType"></param>
        /// <param name="argTitle"></param>
        /// <param name="argMessage"></param>
        public static void fnInformUser(UserInformType argUserInformType, string argTitle, string argMessage)
        {
            MessageBoxIcon lcIconType = MessageBoxIcon.Error;

            switch (argUserInformType)
            {
            case UserInformType.Info:
                lcIconType = MessageBoxIcon.Information;
                break;

            case UserInformType.Warning:
                lcIconType = MessageBoxIcon.Warning;
                break;

            case UserInformType.Error:
                lcIconType = MessageBoxIcon.Error;
                break;
            }
            System.Windows.Forms.MessageBox.Show(argMessage, argTitle, MessageBoxButtons.OK, lcIconType);
        }
Beispiel #2
0
        /// <summary>
        /// Prompt user a confirmation.
        /// </summary>
        /// <param name="argUserInformType"></param>
        /// <param name="argTitle"></param>
        /// <param name="argMessage"></param>
        /// <returns></returns>
        public static UserConfirmResult fnAskToConfirmUser(UserInformType argUserInformType, string argTitle, string argMessage)
        {
            MessageBoxIcon lcIconType = MessageBoxIcon.Error;

            switch (argUserInformType)
            {
            case UserInformType.Info:
                lcIconType = MessageBoxIcon.Information;
                break;

            case UserInformType.Warning:
                lcIconType = MessageBoxIcon.Warning;
                break;

            case UserInformType.Error:
                lcIconType = MessageBoxIcon.Error;
                break;
            }
            var lcResult = System.Windows.Forms.MessageBox.Show(argMessage, argTitle, MessageBoxButtons.YesNo, lcIconType);

            return(lcResult == DialogResult.Yes ? UserConfirmResult.Confirmed : UserConfirmResult.Rejected);
        }