Archive for the ‘Windows Phone 7 & Mango’ Category


To play , you can try the following:

sing Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework;
using System.IO;

Stream stream = TitleContainer.OpenStream("MySoundFile.wav");
SoundEffect effect = SoundEffect.FromStream(stream);
FrameworkDispatcher.Update();
effect.Play();
Advertisements

To make a windows phone device vibrate, you can try the following:

using Microsoft.Devices;

VibrateController vibrate = VibrateController.Default;
vibrate.Start(TimeSpan.FromMilliseconds(1000));

To get a t of all songs from your Media Library and bind it to a ListBox control, first add the control in your XAML file as follows:

<ListBox x:Name="myListBox" />
using Microsoft.Xna.Framework.Media;

private void ListSongs()
{
  MediaLibrary myLib = new MediaLibrary();
  var mySongName = (from m in myLib.Songs select m.Name).ToList();
  myListBox.ItemsSource = mySongName;
}

Disable Lock Screen

Posted: March 14, 2012 in Windows Phone 7 & Mango

If you need to disable the lock screen while your app is running, you can try the following:

using Microsoft.Phone.Shell;

PhoneApplicationService phoneAppService = PhoneApplicationService.Current;
phoneAppService.UserIdleDetectionMode = IdleDetectionMode.Disabled;</code>

It is a good idea to add a Review My App button to your windows phone applications To do this, you can simply add the following to any button click event handler:

using Microsoft.Phone.Shell;
if (PhoneApplicationService.Current.State.ContainsKey("KeyName"))
{
  // Do something
}

It is a good idea to add a Review My App button to your windows phone applications To do this, you can simply add the following to any button click event handler:

using Microsoft.Phone.Tasks;
MarketplaceReviewTask marketplaceReviewTask = new MarketplaceReviewTask();
marketplaceReviewTask.Show();

To convert a color to a brush, you can do the following:

Brush myBrushColor = new SolidColorBrush(Colors.Red);