访问image资源
-----------------------------------------------------------------------------
BitmapImage bitmapImage = new BitmapImage();
img.Width = bitmapImage.DecodePixelWidth = 80; //natural px width of image source
// don't need to set Height, system maintains aspect ratio, and calculates the other
// dimension, so long as one dimension measurement is provided
bitmapImage.UriSource = new Uri(img.BaseUri, "xml/3.png");
img.Source = bitmapImage;
声音
------------------------------------------------------------------------------
MediaPlayer player = new MediaPlayer();
private void media_Click(object sender, RoutedEventArgs e)
{
player.Source = MediaSource.CreateFromUri(new Uri("ms-appx:///Assets/AlarmSound.wma"));
player.Play();
}
private void MainPage_Unloaded(object sender, RoutedEventArgs e)
{
player.Dispose();
// throw new NotImplementedException();
}