/// <summary> /// Event Listener for the Play Button on the main screen /// Toggles the video between play and pause /// </summary> private void PlayButton_Click(object sender, RoutedEventArgs e) { if (isPlaying) //If the current flag is set to true { ClipPlayer.Pause(); //pause the video isPlaying = false; PlayButton.Visibility = Visibility.Hidden; //Hide the play button graphic PauseButton.Visibility = Visibility.Visible; //show the pause button graphic } else { ClipPlayer.Play(); //play the video isPlaying = true; ClipPlayer.Position = TimeSpan.FromSeconds(0); //Reset the clip PlayButton.Visibility = Visibility.Visible; //Show the play button graphic PauseButton.Visibility = Visibility.Hidden; //hide the pause button graphic } }
/// <summary> /// Event Listener that fires when the file drop down changes /// </summary> private void ClipDropDown_SelectionChanged(object sender, SelectionChangedEventArgs e) { if (ClipDropDown.SelectedIndex != -1) //as long as your not on a null selection { string text = ClipDropDown.SelectedItem.ToString(); //store the selected item out to a string foreach (FileElement info in fileList) //check through all the files { if (info.Title.Equals(text)) //If you find one that matches { ClipDes.Text = info.Description; //set the main page description to the selected items description ClipPlayer.Source = new Uri(ClipFolder + "/" + info.FileName, UriKind.RelativeOrAbsolute); //set the source of the media player to the selected item ClipPlayer.Play(); //play the video clip ClipPlayer.ScrubbingEnabled = true; //allow scrubbing ClipPlayer.Position = TimeSpan.FromSeconds(2); //move the video forward two seconds. This allows for a really basic thumbnail ClipPlayer.Pause(); //pause the video } } } }