コード例 #1
0
ファイル: Scenario4.xaml.cs プロジェクト: Team01/Win81App
        /// <summary>
        /// Click handler for the "Play" button.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void PlayButton_Click(object sender, RoutedEventArgs e)
        {
            Scenario4MediaElement.PlaybackRate = 1.0;

            Scenario4MediaElement.Play();
            SetupTimer();
        }
コード例 #2
0
ファイル: Scenario4.xaml.cs プロジェクト: Team01/Win81App
        /// <summary>
        /// Click handler for the "Select a media file" button.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private async void OpenFileButton_Click(object sender, RoutedEventArgs e)
        {
            FileOpenPicker fileOpenPicker = new FileOpenPicker();

            // Filter to include a sample subset of file types
            fileOpenPicker.FileTypeFilter.Add(".wmv");
            fileOpenPicker.FileTypeFilter.Add(".mp4");
            fileOpenPicker.FileTypeFilter.Add(".mp3");
            fileOpenPicker.FileTypeFilter.Add(".wma");
            fileOpenPicker.SuggestedStartLocation = PickerLocationId.VideosLibrary;

            // Prompt user to select a file
            StorageFile file = await fileOpenPicker.PickSingleFileAsync();

            // Ensure a file was selected
            if (file != null)
            {
                // Open the selected file and set it as the MediaElement's source
                IRandomAccessStream stream = await file.OpenAsync(FileAccessMode.Read);

                Scenario4MediaElement.SetSource(stream, file.ContentType);
            }
        }
コード例 #3
0
ファイル: Scenario4.xaml.cs プロジェクト: Team01/Win81App
 /// <summary>
 /// Click handler for the "Stop" button.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void StopButton_Click(object sender, RoutedEventArgs e)
 {
     Scenario4MediaElement.Stop();
 }
コード例 #4
0
ファイル: Scenario4.xaml.cs プロジェクト: Team01/Win81App
 /// <summary>
 /// Click handler for the "Pause" button.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void PauseButton_Click(object sender, RoutedEventArgs e)
 {
     Scenario4MediaElement.Pause();
 }