This is a migrated thread and some comments may be shown as answers.

RadWindow.Alert - sound?

6 Answers 171 Views
Window
This is a migrated thread and some comments may be shown as answers.
Jeff
Top achievements
Rank 1
Jeff asked on 23 Jan 2014, 03:37 PM
I'm replacing some calls to MessageBox.Show() with calls to RadWindow.Alert so that the message dialogs match the theme of my application.  However, I noticed that the Alert dialog doesn't play any sort of system sound like MessageBox.Show.  Digging through the docs and the forum, I don't see any mention of this.  I'd definitely think the pre-defined dialogs should have some built-in system sound support., right?

Input appreciated.

Jeff

6 Answers, 1 is accepted

Sort by
0
Rosen Vladimirov
Telerik team
answered on 24 Jan 2014, 11:46 AM
Hi Jeff,

You can easily add sound to RadWindow.Alert dialog by using Opened event handler:
private MediaPlayer player;
 
private void RadButton_Click(object sender, RoutedEventArgs e)
{
 
    var dialogParams = new DialogParameters();
    dialogParams.Opened = Opened;
    dialogParams.Closed = AlertClosed;
    dialogParams.Content = "Content";
    RadWindow.Alert(dialogParams);
}
 
private void AlertClosed(object sender, WindowClosedEventArgs e)
{
    this.player.Stop();
}
 
private void Opened(object sender, EventArgs e)
{
    this.PlaySound();
}
 
private void PlaySound()
{
    Uri uri = new Uri("../../MyWave.wav", UriKind.RelativeOrAbsolute);
    if (this.player == null)
    {
        this.player = new MediaPlayer();
        this.player.Open(uri);
    }
 
    this.player.Play();
}

The idea of code above is to play the wave when RadWindow.Alert is opened and stop it when the alert is closed.

Hope this helps.

Regards,
Rosen Vladimirov
Telerik
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WPF.
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
0
Jeff
Top achievements
Rank 1
answered on 24 Jan 2014, 02:23 PM
Thanks for the sample code.  While it (or something similar) may very well be the best solution to my problem, I want to make sure I was clear about the issue.

As mentioned above, I'm replacing MessageBox.Show() calls with RadWindow.Alert() calls in order to get proper themeing.  However, I immediately noticed that when a RadWindow.Alert is opened (in place of an Error or Warning style MessageBox), that it's "silent".  That is, it doesn't play the standard Windows sounds normally associated with the various MessageBox styles.

That strikes me as odd as I presume replacing MessageBox.Show calls is a typical use-case for RadWindow.Alert, right?  I assumed that I had somehow missed some built-in mechanism to play standard system sounds via RadWindow.Alert, but maybe that's not the case?

Based on the above, is the sample code still my best route?  If so, I guess I'll just need to wrap this all up into a reusable component to better mimic a typical MessageBox.

Assuming there is no "built-in" support for playing standard system sounds, might you consider that for a future enhancement, as it seems like a natural fit.

Thanks,

Jeff

0
Jeff
Top achievements
Rank 1
answered on 24 Jan 2014, 09:16 PM
So, with some additional research, it looks like I can do what I want using something like this:

RadWindow.Alert(new DialogParameters()
{
    Content = new System.Windows.Controls.TextBlock {
        Text = ex.Message, Width = 250, TextWrapping = TextWrapping.Wrap },
    Header = "Update Error",
    Opened = (alertDialog, eventArgs) => System.Media.SystemSounds.Exclamation.Play()
});

That'll work, but it would be nice if some of the default dialogs had built-in system sound support.

Thanks,

Jeff
0
Rosen Vladimirov
Telerik team
answered on 27 Jan 2014, 08:47 AM
Hi Jeff,

Thank you for your valuable feedback. You can add this feature request in our feedback portal and if there is customer demand, we'll consider adding it to our Alert dialog.

Hope this helps.

Regards,
Rosen Vladimirov
Telerik
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WPF.
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
0
Jeff
Top achievements
Rank 1
answered on 27 Jan 2014, 02:33 PM
As requested, this enhancement has been requested on the feed back portal.  That suggestion can be seen here:

http://feedback.telerik.com/Project/143/Feedback/Details/101789-add-system-sound-support-to-radwindow-alert-and-radwindow-confirm

Jeff
0
Rosen Vladimirov
Telerik team
answered on 27 Jan 2014, 03:44 PM
Hi Jeff,

Thank you very much for the fast response. We have reviewed it and it has been approved as a possible future improvement of our controls. If there is enough customer demand, we'll consider implementing this functionality.

Regards,
Rosen Vladimirov
Telerik
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WPF.
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
Tags
Window
Asked by
Jeff
Top achievements
Rank 1
Answers by
Rosen Vladimirov
Telerik team
Jeff
Top achievements
Rank 1
Share this question
or