We're building this MediaPlayerControl:
Image may be NSFW.
Clik here to view.
It has no logic. We will use this control in some parts of application. We defined Commands for it and bound them to the buttons of the control:
public static class MediaPlayerCommands { public static readonly RoutedUICommand TogglePlay = new RoutedUICommand("Tocar/Pause", "TogglePlay", typeof(MediaPlayerControl)); public static readonly RoutedUICommand ForwardFive = new RoutedUICommand("Avançar 5 segundos", "ForwardFive", typeof(MediaPlayerControl)); public static readonly RoutedUICommand ForwardTen = new RoutedUICommand("Avançar 10 segundos", "ForwardTen", typeof(MediaPlayerControl)); public static readonly RoutedUICommand RewindFive = new RoutedUICommand("Retroceder 5 segundos", "RewindFive", typeof(MediaPlayerControl)); public static readonly RoutedUICommand RewindTen = new RoutedUICommand("Retroceder 10 segundos", "RewindTen", typeof(MediaPlayerControl)); public static readonly RoutedUICommand StartPosition = new RoutedUICommand("Posição inicial", "StartPosition", typeof(MediaPlayerControl)); public static readonly RoutedUICommand EndPosition = new RoutedUICommand("Posição final", "EndPosition", typeof(MediaPlayerControl)); public static readonly RoutedUICommand ToggleLoop = new RoutedUICommand("Continuamente", "ToggleLoop", typeof(MediaPlayerControl)); }
So, when the user click the "play" ToggleButton, wherever the command is implemented, it will be executed. However, if for some reason, the actually media (some video) is paused, how can I "untoggle" the play ToggleButton? You see, it was not the user that clicked to pause... it was some event in the application that occured, and we need to "untoggle" the play button
Take a look at WPF FlashMessage
About.me