Example #1
0
        private void ChooseIcons(MessageBoxIcon iconType, string sound = null)
        {
            switch (iconType)
            {
            case MessageBoxIcon.Asterisk:
                if (sound != null)
                {
                    player.Open(SoundHelper.GenerateSoundPath(sound));
                    player.Play();
                }
                else
                {
                    MessageBeep(MessageBeepSound.MB_ICONASTERISK);
                }
                image.Source = ImageHelper.GenerateImage("Asterisk.png");
                ImageType    = 8;
                break;

            case MessageBoxIcon.Error:
                if (sound != null)
                {
                    player.Open(SoundHelper.GenerateSoundPath(sound));
                    player.Play();
                }
                else
                {
                    MessageBeep(MessageBeepSound.MB_ICONERROR);
                }
                image.Source = ImageHelper.GenerateImage("Error.png");
                ImageType    = 2;
                break;

            case MessageBoxIcon.Exclamation:
                if (sound != null)
                {
                    player.Open(SoundHelper.GenerateSoundPath(sound));
                    player.Play();
                }
                else
                {
                    MessageBeep(MessageBeepSound.MB_ICONEXCLAMATION);
                }
                image.Source = ImageHelper.GenerateImage("Exclamation.png");
                ImageType    = 6;
                break;

            case MessageBoxIcon.Hand:
                if (sound != null)
                {
                    player.Open(SoundHelper.GenerateSoundPath(sound));
                    player.Play();
                }
                else
                {
                    MessageBeep(MessageBeepSound.MB_ICONHAND);
                }
                image.Source = ImageHelper.GenerateImage("Hand.png");
                ImageType    = 3;
                break;

            case MessageBoxIcon.Information:
                if (sound != null)
                {
                    player.Open(SoundHelper.GenerateSoundPath(sound));
                    player.Play();
                }
                else
                {
                    MessageBeep(MessageBeepSound.MB_ICONINFORMATION);
                }
                image.Source = ImageHelper.GenerateImage("Information.png");
                ImageType    = 9;
                break;

            case MessageBoxIcon.Question:
                if (sound != null)
                {
                    player.Open(SoundHelper.GenerateSoundPath(sound));
                    player.Play();
                }
                else
                {
                    MessageBeep(MessageBeepSound.MB_ICONQUESTION);
                }
                image.Source = ImageHelper.GenerateImage("Question.png");
                ImageType    = 5;
                break;

            case MessageBoxIcon.Stop:
                if (sound != null)
                {
                    player.Open(SoundHelper.GenerateSoundPath(sound));
                    player.Play();
                }
                else
                {
                    MessageBeep(MessageBeepSound.MB_ICONSTOP);
                }
                image.Source = ImageHelper.GenerateImage("Stop.png");
                ImageType    = 4;
                break;

            case MessageBoxIcon.Warning:
                if (sound != null)
                {
                    player.Open(SoundHelper.GenerateSoundPath(sound));
                    player.Play();
                }
                else
                {
                    MessageBeep(MessageBeepSound.MB_ICONWARNING);
                }
                image.Source = ImageHelper.GenerateImage("Warning.png");
                ImageType    = 7;
                break;

            case MessageBoxIcon.None:
                if (sound != null)
                {
                    player.Open(SoundHelper.GenerateSoundPath(sound));
                    player.Play();
                }
                else
                {
                    MessageBeep(MessageBeepSound.MB_ICONASTERISK);
                }
                image.Source = null;
                ImageType    = 1;
                break;

            default:
                if (sound != null)
                {
                    player.Open(SoundHelper.GenerateSoundPath(sound));
                    player.Play();
                }
                else
                {
                    MessageBeep(MessageBeepSound.MB_ICONASTERISK);
                }
                image.Source = null;
                ImageType    = 1;
                break;
            }
        }