Implementing the Stop Button in Microsoft Word

Printing QR Code 2d barcode in Microsoft Word Implementing the Stop Button

Implementing the Stop Button
QR Drawer In None
Using Barcode generation for Office Word Control to generate, create Quick Response Code image in Microsoft Word applications.
www.OnBarcode.com
Quick Response Code Maker In None
Using Barcode generation for Office Word Control to generate, create QR Code image in Word applications.
www.OnBarcode.com
When the stop button is clicked, invoke MediaElement.Stop to stop the media player and then rewind the media player back to the beginning and update the Status label as Stopped. private void btnStop_Click(object sender, RoutedEventArgs e) { mediaPlayer.Stop();
Making ECC200 In None
Using Barcode maker for Word Control to generate, create Data Matrix image in Office Word applications.
www.OnBarcode.com
Generate ANSI/AIM Code 128 In None
Using Barcode generator for Microsoft Word Control to generate, create Code 128B image in Microsoft Word applications.
www.OnBarcode.com
CHAPTER 15 MEDIA
Encoding GTIN - 13 In None
Using Barcode maker for Word Control to generate, create EAN 13 image in Word applications.
www.OnBarcode.com
Print UCC-128 In None
Using Barcode printer for Microsoft Word Control to generate, create UCC - 12 image in Microsoft Word applications.
www.OnBarcode.com
mediaPlayer.Position = System.TimeSpan.FromSeconds(0); lblStatus.Text = "Stopped"; }
Generating Barcode In None
Using Barcode creator for Microsoft Word Control to generate, create Barcode image in Office Word applications.
www.OnBarcode.com
ISSN - 10 Printer In None
Using Barcode generator for Office Word Control to generate, create International Standard Serial Number image in Word applications.
www.OnBarcode.com
Implementing the Play Button
QR-Code Encoder In None
Using Barcode generation for Microsoft Excel Control to generate, create QR Code image in Excel applications.
www.OnBarcode.com
Draw Denso QR Bar Code In None
Using Barcode maker for Online Control to generate, create QR image in Online applications.
www.OnBarcode.com
When the play button is clicked, invoke MediaElement.Play to play the media player. private void btnPlay_Click(object sender, RoutedEventArgs e) { mediaPlayer.Play(); }
EAN13 Creation In None
Using Barcode printer for Font Control to generate, create GS1 - 13 image in Font applications.
www.OnBarcode.com
Code 128 Code Set A Printer In None
Using Barcode creation for Software Control to generate, create USS Code 128 image in Software applications.
www.OnBarcode.com
Implementing the Mute Button
Scanning Code 128 In C#.NET
Using Barcode recognizer for .NET Control to read, scan read, scan image in .NET applications.
www.OnBarcode.com
GS1-128 Printer In None
Using Barcode creator for Font Control to generate, create UCC-128 image in Font applications.
www.OnBarcode.com
When the Mute button is clicked, set MediaElement.IsMuted to true in order to mute the sound or set it to false to turn on the sound. private void btnMute_Click(object sender, RoutedEventArgs e) { if (lblSoundStatus.Text.Equals("Sound On", StringComparison.CurrentCultureIgnoreCase)) { lblSoundStatus.Text = "Sound Off"; mediaPlayer.IsMuted = true; } else { lblSoundStatus.Text = "Sound On"; mediaPlayer.IsMuted = false; } }
Recognize PDF-417 2d Barcode In None
Using Barcode recognizer for Software Control to read, scan read, scan image in Software applications.
www.OnBarcode.com
Code 39 Extended Printer In Java
Using Barcode generation for Android Control to generate, create Code 39 Full ASCII image in Android applications.
www.OnBarcode.com
Note To mute the player, you could have set MediaElement.Volume to zero instead of setting the IsMuted property to true, as we did in our example.
QR Code 2d Barcode Printer In None
Using Barcode generation for Online Control to generate, create QR image in Online applications.
www.OnBarcode.com
PDF 417 Reader In Java
Using Barcode scanner for Java Control to read, scan read, scan image in Java applications.
www.OnBarcode.com
Implementing Seek
Print EAN / UCC - 14 In Visual C#.NET
Using Barcode generation for Visual Studio .NET Control to generate, create GTIN - 128 image in .NET applications.
www.OnBarcode.com
Drawing Barcode In Objective-C
Using Barcode drawer for iPad Control to generate, create Barcode image in iPad applications.
www.OnBarcode.com
When the Slider control that displays the timeline of the media is clicked or dragged, MediaElement.Position moves either forward or backward, depending on the user s input on the Slider control. See Figure 15 3 for dragging the slider to the right in order to move forward in the video timeline. private void mediaTimeline_ValueChanged(object sender, RoutedPropertyChangedEventArgs<double> e)
CHAPTER 15 MEDIA
{ if (!_updatingMediaTimeline && mediaPlayer.CanSeek) { TimeSpan duration = mediaPlayer.NaturalDuration.TimeSpan; int newPosition = (int)(duration.TotalSeconds * mediaTimeline.Value); mediaPlayer.Position = new TimeSpan(0, 0, newPosition); } }
Figure 15 3. Dragging the slider to skip the video
Note Using MediaElement.Position you can jump to any part of the media. This is very useful when you want to create chapters in a movie similar to those you see in DVD players.
Implementing the MediaPlayerLauncher
When the MediaPlayerLauncher button is clicked, invoke the MediaPlayerLauncher task to launch the default Windows Phone media player.
CHAPTER 15 MEDIA
private void btnMediaPlayerLauncher_Click(object sender, RoutedEventArgs e) { MediaPlayerLauncher player = new MediaPlayerLauncher(); player.Media = new Uri("http://ecn.channel9.msdn.com/o9/ch9/7/8/2/9/1/5/ ARCastMDISilverlightGridComputing_ch9.wmv"); //player.Media = // new Uri("ARCastMDISilverlightGridComputing_ch9.wmv", // UriKind.Relative); //player.Location = MediaLocationType.Data; player.Show(); }
Note Notice the commented code where MediaPlayerLauncher is going to play the content that is part of the application. player.Location is set to MediaLocationType.Data, which means that it will look at the isolated storage for the file named ARCastMDISilverlightGridComputing_ch9.wmv. Refer to 13 for the isolated storage demo where the file was downloaded the first time and then saved into the isolated storage for later access. If you set player.Location to MediaLocationType.Install, the media file must be added to the application as the content and also the media source s Uri must have UriKind.Relative, which basically means the file is part of the application. The only problem with this is that the size of the application install will get much bigger.
Testing the Finished Application
To test the application, press F5. The result should resemble Figure 15 1. Try clicking each button: Play, Pause, Stop, and Mute. Also, as the movie plays, take note of the buffering and downloading progress status. You can also drag the slider back and forth to skip around the movie scenes. You can also put your own favorite movie link if you know of any. In this first demo, you learned to create a custom media player and then learned to launch the default Windows Phone media player. Both MediaElement and MediaPlayerLauncher accessed the video content on the Web because typically video files are very big. But if you are adding simple sound effects to an application, it is not always ideal to download the contents from the Web when you can simply package the sound along with the application. This is especially true if you are planning to create a game where all the graphical and media assets are packaged as the part of the application. In the next demo, you will learn to add sound effects to an application.
Copyright © OnBarcode.com . All rights reserved.