Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
275
UltraMessageBoxManager - No sound when message box is displayed
posted

Hi,

I have a static class that creates an UltraMessageBoxManager to display messages. I have set EnableSounds to true, but no sound is produced when the messagebpx is displayed.

using System;
using System.Drawing;
using System.Windows.Forms;

using Infragistics.Win;
using Infragistics.Win.UltraMessageBox;

namespace Test
{
    internal static class DialogBox
    {
        private const Int32 MaximumWidth = 500;
        private const Int32 MinimumWidth = 400;

        private static readonly Infragistics.Win.Appearance buttonAppearance         = new Infragistics.Win.Appearance();
        private static readonly Infragistics.Win.Appearance buttonAreaAppearance     = new Infragistics.Win.Appearance();
        private static readonly Infragistics.Win.Appearance buttonHotTrackAppearance = new Infragistics.Win.Appearance();
        private static readonly Infragistics.Win.Appearance buttonPressedAppearance  = new Infragistics.Win.Appearance();
        private static readonly Infragistics.Win.Appearance contentAreaAppearance    = new Infragistics.Win.Appearance();
        private static readonly Infragistics.Win.Appearance footerAppearance         = new Infragistics.Win.Appearance();
        private static readonly Infragistics.Win.Appearance headerAppearance         = new Infragistics.Win.Appearance();

        #region Documentation
        /// <summary>
        ///     Initialize the static appearances.
        /// </summary>
        #endregion
        static DialogBox()
        {
            // Set the various appearances
            buttonAppearance        .BackColor             = Color.FromArgb(100, 119, 130);
            buttonAppearance        .ForeColor             = Color.White;
            buttonAppearance        .ForegroundAlpha       = Alpha.Opaque;

            buttonAreaAppearance    .BackColor             = Color.White;
            buttonAreaAppearance    .BorderColor           = Color.FromArgb(219, 222, 223);
            buttonAreaAppearance    .ForeColor             = Color.FromArgb(102, 102, 102);
            buttonAreaAppearance    .ForeColorDisabled     = Color.FromArgb(187, 187, 187);

            buttonHotTrackAppearance.BackColor             = Color.FromArgb(66, 84, 94);
            buttonHotTrackAppearance.BorderAlpha           = Alpha.Transparent;
            buttonHotTrackAppearance.ForeColor             = Color.White;

            buttonPressedAppearance.BackColor              = Color.FromArgb(67, 168, 152);
            buttonPressedAppearance.BorderAlpha            = Alpha.Transparent;
            buttonPressedAppearance.ForeColor              = Color.White;

            contentAreaAppearance   .BackColor             = Color.White;
            contentAreaAppearance   .BorderColor           = Color.FromArgb(219, 222, 223);
            contentAreaAppearance   .ForeColor             = Color.FromArgb(102, 102, 102);
            contentAreaAppearance   .ForeColorDisabled     = Color.FromArgb(187, 187, 187);
            contentAreaAppearance   .FontData.SizeInPoints = 10;

            footerAppearance        .BackColor              = Color.FromArgb(180, 220, 214);
            footerAppearance        .BorderColor            = Color.FromArgb( 67, 168, 152);
            footerAppearance        .ForeColor              = Color.FromArgb( 85,  85,  85);

            headerAppearance        .BackColor              = Color.White;
            headerAppearance        .ForeColor              = Color.FromArgb(67, 168, 152);
        }

        internal static DialogResult Show(IWin32Window owner, String message, String header, String caption)
        {
            DialogResult dialogResult;

            UltraMessageBoxInfo ultraMessageBoxInfo;

            UltraMessageBoxManager ultraMessageBoxManager;

            Cursor.Current = Cursors.Default;

            ultraMessageBoxManager = new UltraMessageBoxManager
            {
                // Set the message box fields
                MaximumWidth             = MaximumWidth                       ,
                MinimumWidth             = MinimumWidth                       ,
                ButtonAppearance         = buttonAppearance                   ,
                ButtonAreaAppearance     = buttonAreaAppearance               ,
                ButtonHotTrackAppearance = buttonHotTrackAppearance           ,
                ButtonPressedAppearance  = buttonPressedAppearance            ,
                ContentAreaAppearance    = contentAreaAppearance              ,
                FooterAppearance         = footerAppearance                   ,
                HeaderAppearance         = headerAppearance                   ,
                UseAppStyling            = true                               ,
                UseFlatMode              = DefaultableBoolean.True            ,
                UseOsThemes              = DefaultableBoolean.False           ,
                EnableSounds             = DefaultableBoolean.True            ,
                Style                    = MessageBoxStyle.Standard           ,
                StartPosition            = DialogStartPosition.CenterOwnerForm
            };

            ultraMessageBoxInfo = new UltraMessageBoxInfo
            {
                // Set the message box fields
                Owner   = owner                              ,
                Header  = header                             ,
                Caption = caption                            ,
                Text    = message                            ,
                Buttons = MessageBoxButtons.OK               ,
                Footer  = Properties.Resources.ContactSupport
            };

            ultraMessageBoxInfo.ContentAreaAppearance.Image = GetImage(MessageBoxIcon.Error);

            dialogResult = ultraMessageBoxManager.ShowMessageBox(ultraMessageBoxInfo);

            ultraMessageBoxManager.Dispose();
            ultraMessageBoxInfo   .Dispose();

            return dialogResult;
        }

        private static Image GetImage(MessageBoxIcon icon)
        {
            Image image;

            switch (icon)
            {
                case MessageBoxIcon.Error:

                    image = Properties.Resources.button_cancel_32px;

                    break;

                case MessageBoxIcon.Question:

                    image = Properties.Resources.button_help_32px;

                    break;

                case MessageBoxIcon.Information:

                    image = Properties.Resources.button_info_32px;

                    break;

                case MessageBoxIcon.Warning:

                    image = Properties.Resources.warning_32px;

                    break;

                default:

                    image = null;

                    break;
            }

            return image;
        }
    }
}

Any idea what might be the problem?

Thank You