- App check if running on device or emulator

- LocationString on update
- web app markers icons
This commit is contained in:
2011-05-09 13:20:44 +03:00
parent 72c1bbdcfc
commit 1f79fa6349
9 changed files with 72 additions and 118 deletions
+11 -6
View File
@@ -14,6 +14,7 @@ using System.Windows.Media.Animation;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using Microsoft.Devices;
using Microsoft.Phone;
using Microsoft.Phone.Controls;
using Microsoft.Phone.Net.NetworkInformation;
@@ -84,9 +85,11 @@ namespace MyFriendsAround.WP7
// This code will not execute when the application is reactivated
private void Application_Launching(object sender, LaunchingEventArgs e)
{
#if GPS_EMULATOR
IsolatedStorageExplorer.Explorer.Start("localhost");
#endif
if (Microsoft.Devices.Environment.DeviceType == DeviceType.Emulator)
{
IsolatedStorageExplorer.Explorer.Start("localhost");
}
DispatcherHelper.Initialize();
LoadModel();
}
@@ -95,9 +98,11 @@ namespace MyFriendsAround.WP7
// This code will not execute when the application is first launched
private void Application_Activated(object sender, ActivatedEventArgs e)
{
#if GPS_EMULATOR
IsolatedStorageExplorer.Explorer.RestoreFromTombstone();
#endif
if (Microsoft.Devices.Environment.DeviceType == DeviceType.Emulator)
{
IsolatedStorageExplorer.Explorer.RestoreFromTombstone();
}
DispatcherHelper.Initialize();
LoadModel();
}
@@ -8,6 +8,7 @@ using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using Microsoft.Devices;
using MyFriendsAround.WP7.Model;
using System.Device.Location;
@@ -24,14 +25,18 @@ namespace MyFriendsAround.WP7.Service
public LocationService()
{
#if GPS_EMULATOR
_gpsWatcher = new GpsEmulatorClient.GeoCoordinateWatcher();
#else
_gpsWatcher = new GeoCoordinateWatcher(GeoPositionAccuracy.High)
if (Microsoft.Devices.Environment.DeviceType == DeviceType.Emulator)
{
_gpsWatcher = new GpsEmulatorClient.GeoCoordinateWatcher();
}
else
{
_gpsWatcher = new GeoCoordinateWatcher(GeoPositionAccuracy.High)
{
MovementThreshold = 10
};
#endif
}
_gpsWatcher.PositionChanged += new EventHandler<GeoPositionChangedEventArgs<GeoCoordinate>>(watcher_PositionChanged);
_gpsWatcher.StatusChanged += new EventHandler<GeoPositionStatusChangedEventArgs>(watcher_StatusChanged);
}
@@ -4,6 +4,7 @@ using System.Net;
using System.Text;
using Hammock;
using Hammock.Web;
using Microsoft.Devices;
using MyFriendsAround.Common.Entities;
namespace MyFriendsAround.WP7.Service
@@ -16,14 +17,16 @@ namespace MyFriendsAround.WP7.Service
static ServiceAgent()
{
#if GPS_EMULATOR
baseUrl = "http://127.0.0.1:80/myfriends";//running in local azure emulator
//baseUrl = "http://localhost.:55672/myfriends";//for local asp.net mvc use
#else
baseUrl = "http://myfriendsaround.cloudapp.net/myfriends";//live azure
//baseUrl = "http://localhost:80/myfriends";
#endif
if (Microsoft.Devices.Environment.DeviceType == DeviceType.Emulator)
{
baseUrl = "http://127.0.0.1:80/myfriends"; //running in local azure emulator
//baseUrl = "http://localhost.:55672/myfriends";//for local asp.net mvc use
}
else
{
baseUrl = "http://myfriendsaround.cloudapp.net/myfriends"; //live azure
//baseUrl = "http://localhost:80/myfriends";
}
}
#region GetFriends