Help Developers Please

AhmedtSadek

Senior Member
Feb 20, 2012
94
50
0
Cairo
i am trying to build a music player app that can play in any orientation (zune doesnt rotate !) my build is so basic and got few functions
i am completely new to building apps but i got this code from microsoft sdk and added the any orientation code from a website but cant find a code that makes the player reads the library also i wish any one help me :D or if anybody know how to make zune run in horizontal mode it will be great :D
 

SimzzDev

Senior Member
Jan 29, 2011
203
35
0
simzz.com
i am trying to build a music player app that can play in any orientation (zune doesnt rotate !) my build is so basic and got few functions
i am completely new to building apps but i got this code from microsoft sdk and added the any orientation code from a website but cant find a code that makes the player reads the library also i wish any one help me :D or if anybody know how to make zune run in horizontal mode it will be great :D
Not sure if you know how to make the app play music or not, but ask if you need help. For the orientation, in your XAML code, you are going to need the following to support landscape:
Code:
SupportedOrientations="PortraitOrLandscape"
That goes in your XAML page, above the '>' character near the top.

Additionally, this can be used to default it to portrait or landscape:
Code:
Orientation="Portrait"
or
Code:
Orientation="Landscape"
With that said, that doesn't mean it will look good. No offense :) Layout can be very tricky and in many cases additional code is needed to handle the orientation change. Although, if you use proper layout (in this case meaning horizontal/vertical alignment correctly and not relying too much on margins), then your app may end up working fine in both orientations. If you use Expression Blend, it makes it a lot easier to do this stuff if you go into the devices window.
 

SimzzDev

Senior Member
Jan 29, 2011
203
35
0
simzz.com
i am asking for codes that make the app read my music library i already did what you said!
Okay, you are going to need a reference to the assembly 'Microsoft.Xna.Framework'.

Then add the using statement:
Code:
using Microsoft.Xna.Framework.Media;
Initialize your library:
Code:
MediaLibrary library = new MediaLibrary();
Then to play, for example, the first song in the library:
Code:
MediaPlayer.Play(library.Songs[0]);
Also, try getting albums (or genres, artists, etc.)
This shows how to play the first song from the 11 album:
Code:
Album album = library.Albums[10];
MediaPlayer.Play(album.Songs[0]);
Of course, I would recommend showing them in a listbox or something.