1. start visual studio 2010
2. create a new console application.
3. add reference to “Microsoft.Smartdevice.Connectivity” which is found in the path
“c:\Windows\Microsoft.NET\assembly\GAC_MSIL\Microsoft.SmartDevice.Connectivity\v4.0_10.0.0.0__b03f5f7f11d50a3a\Microsoft.Smartdevice.Connectivity.dll”
// ----- Select this path according to your system.
Note : Please keep in mind for this sample to work you should have windows phone sdk installed on your pc.
Paste this code in Program.cs which is created by default in your project.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.SmartDevice.Connectivity;
using System.Globalization;
namespace emulatorplay
{
class Program
{
static void Main(string[] args)
{
DatastoreManager manager = new DatastoreManager(CultureInfo.CurrentCulture.LCID);
var platforms = manager.GetPlatforms();// will list all the connectable platforms on your machine
var devices = platforms.First().GetDevices();// will contain all the devices available debut and check for better visiblity
var device = devices.Last();// this i have choosen because phone emulator came last in my system
device.Connect();// will start the emulator and connect
var applications = device.GetInstalledApplications();
try
{
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.SmartDevice.Connectivity;
using System.Globalization;
namespace emulatorplay
{
class Program
{
static void Main(string[] args)
{
DatastoreManager manager = new DatastoreManager(CultureInfo.CurrentCulture.LCID);
var platforms = manager.GetPlatforms();// will list all the connectable platforms on your machine
var devices = platforms.First().GetDevices();// will contain all the devices available debut and check for better visiblity
var device = devices.Last();// this i have choosen because phone emulator came last in my system
device.Connect();// will start the emulator and connect
var applications = device.GetInstalledApplications();
String j = i < 10 ? 0 + i.ToString() : i.ToString();
for (int i = 0; i < 100; i++)try
{
String j = i < 10 ? 0 + i.ToString() : i.ToString();
device.GetApplication(new Guid("5B04B775-356B-4AA0-AAF8-6491FFEA56"+j)).Launch();
}
catch { }
Console.Read();
}
}
}
Play with Guid here you will come to know which guid belongs to which application in win phone. here i have just looped through 1-100 and appended to “5B04B775-356B-4AA0-AAF8-6491FFEA56” + j(j will contain 1-100 in loop) and start the applications with the corresponding guids.
No comments:
Post a Comment
Thank you for Commenting Will reply soon ......