mirror of
https://github.com/farcasclaudiu/myfriendsaround.git
synced 2026-06-29 15:01:45 +03:00
map issue fixed
This commit is contained in:
Binary file not shown.
|
Before Width: | Height: | Size: 1.7 KiB After Width: | Height: | Size: 1.8 KiB |
@@ -216,12 +216,17 @@
|
|||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
</Content>
|
</Content>
|
||||||
<Content Include="icons\appbar.publish.png">
|
<Content Include="icons\appbar.publish.png">
|
||||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
</Content>
|
</Content>
|
||||||
<Content Include="icons\appbar.questionmark.rest.png">
|
<Content Include="icons\appbar.questionmark.rest.png">
|
||||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</Content>
|
||||||
|
<Content Include="icons\appbar.sync.rest.png">
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</Content>
|
||||||
|
<Content Include="icons\appbar.location.png">
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
</Content>
|
</Content>
|
||||||
<Content Include="icons\appbar.sync.rest.png" />
|
|
||||||
<Content Include="icons\Penguins.jpg">
|
<Content Include="icons\Penguins.jpg">
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
</Content>
|
</Content>
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ using Hammock;
|
|||||||
using Hammock.Serialization;
|
using Hammock.Serialization;
|
||||||
using Microsoft.Phone;
|
using Microsoft.Phone;
|
||||||
using Microsoft.Phone.Controls;
|
using Microsoft.Phone.Controls;
|
||||||
|
using Microsoft.Phone.Controls.Maps;
|
||||||
using Microsoft.Silverlight.Testing;
|
using Microsoft.Silverlight.Testing;
|
||||||
using MyFriendsAround.Common.Entities;
|
using MyFriendsAround.Common.Entities;
|
||||||
using MyFriendsAround.WP7.Service;
|
using MyFriendsAround.WP7.Service;
|
||||||
@@ -47,6 +48,41 @@ namespace MyFriendsAround.WP7.ViewModel
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public class MainViewModel : ViewModelBase
|
public class MainViewModel : ViewModelBase
|
||||||
{
|
{
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Initializes a new instance of the MainViewModel class.
|
||||||
|
/// </summary>
|
||||||
|
public MainViewModel()
|
||||||
|
{
|
||||||
|
//
|
||||||
|
MainLoadCommand = new RelayCommand(() => MainLoad());
|
||||||
|
PublishLocationCommand = new RelayCommand(() => PublishLocationAction());
|
||||||
|
DisplayAboutCommand = new RelayCommand(() => DisplayAbout());
|
||||||
|
NavigateToSettingsCommand = new RelayCommand(() => NavigateToSettings());
|
||||||
|
RefreshFriendsCommand = new RelayCommand(() => RefreshFriends());
|
||||||
|
ShowAboutCommand = new RelayCommand(() => ShowAbout());
|
||||||
|
SaveMySettingsCommand = new RelayCommand(() => SaveMySettings());
|
||||||
|
CancelMySettingsCommand = new RelayCommand(() => CancelMySettings());
|
||||||
|
ChoosePhotoCommand = new RelayCommand(() => ChoosePhoto());
|
||||||
|
CropSaveCommand = new RelayCommand(() => CropSave());
|
||||||
|
CropCancelCommand = new RelayCommand(() => CropCancel());
|
||||||
|
MapViewChangedCommand = new RelayCommand<LocationRect>(boundRectangle => MapViewChanged(boundRectangle));
|
||||||
|
ShowMyLocationCommand = new RelayCommand(() => ShowMyLocation());
|
||||||
|
|
||||||
|
if (IsInDesignMode)
|
||||||
|
{
|
||||||
|
// Code runs in Blend --> create design time data.
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Code runs "for real"
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#region Properties
|
||||||
|
|
||||||
public string ApplicationTitle
|
public string ApplicationTitle
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
@@ -55,6 +91,10 @@ namespace MyFriendsAround.WP7.ViewModel
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#region PageTitles
|
||||||
|
|
||||||
public string PageName
|
public string PageName
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
@@ -79,33 +119,305 @@ namespace MyFriendsAround.WP7.ViewModel
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Initializes a new instance of the MainViewModel class.
|
/// The <see cref="MyPicture" /> property's name.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public MainViewModel()
|
public const string MyPicturePropertyName = "MyPicture";
|
||||||
|
private ImageSource _myPicture = new BitmapImage(new Uri("/icons/anonymousIcon.png", UriKind.RelativeOrAbsolute));
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the MyPicture property.
|
||||||
|
/// </summary>
|
||||||
|
public ImageSource MyPicture
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return _myPicture;
|
||||||
|
}
|
||||||
|
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if (_myPicture == value)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
_myPicture = value;
|
||||||
|
|
||||||
|
// Update bindings, no broadcast
|
||||||
|
RaisePropertyChanged(MyPicturePropertyName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The <see cref="MyName" /> property's name.
|
||||||
|
/// </summary>
|
||||||
|
public const string MyNamePropertyName = "MyName";
|
||||||
|
private string _myName = "Guest";
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the MyName property.
|
||||||
|
/// </summary>
|
||||||
|
public string MyName
|
||||||
|
{
|
||||||
|
get { return _myName; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if (_myName == value)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
var oldValue = _myName;
|
||||||
|
_myName = value;
|
||||||
|
// Update bindings, no broadcast
|
||||||
|
RaisePropertyChanged(MyNamePropertyName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public string AppBarTextAbout
|
||||||
|
{
|
||||||
|
get { return "About"; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public string AppBarTextSettings
|
||||||
|
{
|
||||||
|
get { return "Settings"; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public string AppBarTextPublish
|
||||||
|
{
|
||||||
|
get { return "Publish"; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public string AppBarTextRefresh
|
||||||
|
{
|
||||||
|
get { return "Refresh"; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public string AppBarTextMyLocation
|
||||||
|
{
|
||||||
|
get { return "My Location"; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public string AppBarTextSaveSettings
|
||||||
|
{
|
||||||
|
get { return "Save"; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public string AppBarTextCancelSettings
|
||||||
|
{
|
||||||
|
get { return "Cancel"; }
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The <see cref="PushPins" /> property's name.
|
||||||
|
/// </summary>
|
||||||
|
public const string PushPinsPropertyName = "PushPins";
|
||||||
|
private ObservableCollection<PushPinModel> _PushPins = new ObservableCollection<PushPinModel>();
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the PushPins property.
|
||||||
|
/// </summary>
|
||||||
|
public ObservableCollection<PushPinModel> PushPins
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return _PushPins;
|
||||||
|
}
|
||||||
|
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if (_PushPins == value)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
_PushPins = value;
|
||||||
|
|
||||||
|
// Update bindings, no broadcast
|
||||||
|
RaisePropertyChanged(PushPinsPropertyName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The <see cref="VisiblePushPins" /> property's name.
|
||||||
|
/// </summary>
|
||||||
|
public const string VisiblePushPinsPropertyName = "VisiblePushPins";
|
||||||
|
private ObservableCollection<PushPinModel> _VisiblePushPins = new ObservableCollection<PushPinModel>();
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the PushPins property.
|
||||||
|
/// </summary>
|
||||||
|
public ObservableCollection<PushPinModel> VisiblePushPins
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return _VisiblePushPins;
|
||||||
|
}
|
||||||
|
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if (_VisiblePushPins == value)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
_VisiblePushPins = value;
|
||||||
|
|
||||||
|
// Update bindings, no broadcast
|
||||||
|
RaisePropertyChanged(VisiblePushPinsPropertyName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The <see cref="MapZoom" /> property's name.
|
||||||
|
/// </summary>
|
||||||
|
public const string MapZoomPropertyName = "MapZoom";
|
||||||
|
|
||||||
|
private int _mapZoom = 1;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the MapZoom property.
|
||||||
|
/// </summary>
|
||||||
|
public int MapZoom
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return _mapZoom;
|
||||||
|
}
|
||||||
|
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if (_mapZoom == value)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
_mapZoom = value;
|
||||||
|
|
||||||
|
// Update bindings, no broadcast
|
||||||
|
RaisePropertyChanged(MapZoomPropertyName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The <see cref="IsBusy" /> property's name.
|
||||||
|
/// </summary>
|
||||||
|
public const string IsBusyPropertyName = "IsBusy";
|
||||||
|
|
||||||
|
private bool _isBusy = false;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the IsBusy property.
|
||||||
|
/// </summary>
|
||||||
|
public bool IsBusy
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return _isBusy;
|
||||||
|
}
|
||||||
|
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if (_isBusy == value)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var oldValue = _isBusy;
|
||||||
|
_isBusy = value;
|
||||||
|
|
||||||
|
// Update bindings, no broadcast
|
||||||
|
RaisePropertyChanged(IsBusyPropertyName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The <see cref="MapCenter" /> property's name.
|
||||||
|
/// </summary>
|
||||||
|
public const string MapCenterPropertyName = "MapCenter";
|
||||||
|
|
||||||
|
private GeoCoordinate _mapCenter = null;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the MapCenter property.
|
||||||
|
/// </summary>
|
||||||
|
public GeoCoordinate MapCenter
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return _mapCenter;
|
||||||
|
}
|
||||||
|
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if (_mapCenter == value)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var oldValue = _mapCenter;
|
||||||
|
_mapCenter = value;
|
||||||
|
|
||||||
|
// Update bindings, no broadcast
|
||||||
|
RaisePropertyChanged(MapCenterPropertyName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Commands
|
||||||
|
|
||||||
|
public ICommand MainLoadCommand { get; set; }
|
||||||
|
public ICommand PublishLocationCommand { get; set; }
|
||||||
|
public ICommand DisplayAboutCommand { get; set; }
|
||||||
|
public ICommand NavigateToSettingsCommand { get; set; }
|
||||||
|
public ICommand ShowMyLocationCommand { get; set; }
|
||||||
|
public ICommand RefreshFriendsCommand { get; set; }
|
||||||
|
public ICommand ShowAboutCommand { get; set; }
|
||||||
|
public ICommand SaveMySettingsCommand { get; set; }
|
||||||
|
public ICommand CancelMySettingsCommand { get; set; }
|
||||||
|
public ICommand ChoosePhotoCommand { get; set; }
|
||||||
|
public ICommand CropSaveCommand { get; set; }
|
||||||
|
public ICommand CropCancelCommand { get; set; }
|
||||||
|
public ICommand MapViewChangedCommand { get; set; }
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Implemented Commands & Methods
|
||||||
|
|
||||||
|
private void ShowMyLocation()
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
MainLoadCommand = new RelayCommand(() => MainLoad());
|
|
||||||
PublishLocationCommand = new RelayCommand(() => PublishLocationAction());
|
|
||||||
DisplayAboutCommand = new RelayCommand(() => DisplayAbout());
|
|
||||||
NavigateToSettingsCommand = new RelayCommand(() => NavigateToSettings());
|
|
||||||
RefreshFriendsCommand = new RelayCommand(() => RefreshFriends());
|
|
||||||
ShowAboutCommand = new RelayCommand(() => ShowAbout());
|
|
||||||
SaveMySettingsCommand = new RelayCommand(() => SaveMySettings());
|
|
||||||
CancelMySettingsCommand = new RelayCommand(() => CancelMySettings());
|
|
||||||
ChoosePhotoCommand = new RelayCommand(() => ChoosePhoto());
|
|
||||||
CropSaveCommand = new RelayCommand(() => CropSave());
|
|
||||||
CropCancelCommand = new RelayCommand(() => CropCancel());
|
|
||||||
|
|
||||||
if (IsInDesignMode)
|
|
||||||
{
|
|
||||||
// Code runs in Blend --> create design time data.
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// Code runs "for real"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void MapViewChanged(LocationRect boundRectangle)
|
||||||
|
{
|
||||||
|
ObservableCollection<PushPinModel> _newVisiblePushPins = new ObservableCollection<PushPinModel>();
|
||||||
|
//filter visible pushpins
|
||||||
|
foreach (PushPinModel pushPin in PushPins)
|
||||||
|
{
|
||||||
|
if (boundRectangle.Intersects(new LocationRect(pushPin.Location, .5, .5)))
|
||||||
|
{
|
||||||
|
_newVisiblePushPins.Add(pushPin);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
VisiblePushPins = _newVisiblePushPins;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void CropCancel()
|
public void CropCancel()
|
||||||
@@ -210,39 +522,6 @@ namespace MyFriendsAround.WP7.ViewModel
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// The <see cref="MyPicture" /> property's name.
|
|
||||||
/// </summary>
|
|
||||||
public const string MyPicturePropertyName = "MyPicture";
|
|
||||||
private ImageSource _myPicture = new BitmapImage(new Uri("/icons/anonymousIcon.png", UriKind.RelativeOrAbsolute));
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets the MyPicture property.
|
|
||||||
/// </summary>
|
|
||||||
public ImageSource MyPicture
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return _myPicture;
|
|
||||||
}
|
|
||||||
|
|
||||||
set
|
|
||||||
{
|
|
||||||
if (_myPicture == value)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
var oldValue = _myPicture;
|
|
||||||
_myPicture = value;
|
|
||||||
|
|
||||||
// Update bindings, no broadcast
|
|
||||||
RaisePropertyChanged(MyPicturePropertyName);
|
|
||||||
|
|
||||||
// Update bindings and broadcast change using GalaSoft.MvvmLight.Messenging
|
|
||||||
RaisePropertyChanged(MyPicturePropertyName, oldValue, value, true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
private void CancelMySettings()
|
private void CancelMySettings()
|
||||||
@@ -431,79 +710,6 @@ namespace MyFriendsAround.WP7.ViewModel
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public ICommand MainLoadCommand { get; set; }
|
|
||||||
public ICommand PublishLocationCommand { get; set; }
|
|
||||||
public ICommand DisplayAboutCommand { get; set; }
|
|
||||||
public ICommand NavigateToSettingsCommand { get; set; }
|
|
||||||
public ICommand RefreshFriendsCommand { get; set; }
|
|
||||||
public ICommand ShowAboutCommand { get; set; }
|
|
||||||
public ICommand SaveMySettingsCommand { get; set; }
|
|
||||||
public ICommand CancelMySettingsCommand { get; set; }
|
|
||||||
public ICommand ChoosePhotoCommand { get; set; }
|
|
||||||
public ICommand CropSaveCommand { get; set; }
|
|
||||||
public ICommand CropCancelCommand { get; set; }
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// The <see cref="MyName" /> property's name.
|
|
||||||
/// </summary>
|
|
||||||
public const string MyNamePropertyName = "MyName";
|
|
||||||
private string _myName = "Guest";
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets the MyName property.
|
|
||||||
/// </summary>
|
|
||||||
public string MyName
|
|
||||||
{
|
|
||||||
get { return _myName; }
|
|
||||||
set
|
|
||||||
{
|
|
||||||
if (_myName == value)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
var oldValue = _myName;
|
|
||||||
_myName = value;
|
|
||||||
// Update bindings, no broadcast
|
|
||||||
RaisePropertyChanged(MyNamePropertyName);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public string AppBarTextAbout
|
|
||||||
{
|
|
||||||
get { return "About"; }
|
|
||||||
}
|
|
||||||
|
|
||||||
public string AppBarTextSettings
|
|
||||||
{
|
|
||||||
get { return "Settings"; }
|
|
||||||
}
|
|
||||||
|
|
||||||
public string AppBarTextPublish
|
|
||||||
{
|
|
||||||
get { return "Publish"; }
|
|
||||||
}
|
|
||||||
|
|
||||||
public string AppBarTextRefresh
|
|
||||||
{
|
|
||||||
get { return "Refresh"; }
|
|
||||||
}
|
|
||||||
|
|
||||||
public string AppBarTextSaveSettings
|
|
||||||
{
|
|
||||||
get { return "Save"; }
|
|
||||||
}
|
|
||||||
|
|
||||||
public string AppBarTextCancelSettings
|
|
||||||
{
|
|
||||||
get { return "Cancel"; }
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
////public override void Cleanup()
|
////public override void Cleanup()
|
||||||
////{
|
////{
|
||||||
//// // Clean up if needed
|
//// // Clean up if needed
|
||||||
@@ -511,136 +717,8 @@ namespace MyFriendsAround.WP7.ViewModel
|
|||||||
//// base.Cleanup();
|
//// base.Cleanup();
|
||||||
////}
|
////}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// The <see cref="PushPins" /> property's name.
|
|
||||||
/// </summary>
|
|
||||||
public const string PushPinsPropertyName = "PushPins";
|
|
||||||
private ObservableCollection<PushPinModel> _PushPins = new ObservableCollection<PushPinModel>();
|
|
||||||
/// <summary>
|
|
||||||
/// Gets the PushPins property.
|
|
||||||
/// </summary>
|
|
||||||
public ObservableCollection<PushPinModel> PushPins
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return _PushPins;
|
|
||||||
}
|
|
||||||
|
|
||||||
set
|
|
||||||
{
|
|
||||||
if (_PushPins == value)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
_PushPins = value;
|
|
||||||
|
|
||||||
// Update bindings, no broadcast
|
|
||||||
RaisePropertyChanged(PushPinsPropertyName);
|
|
||||||
|
|
||||||
//// Update bindings and broadcast change using GalaSoft.MvvmLight.Messenging
|
|
||||||
//RaisePropertyChanged(PushPinsPropertyName, oldValue, value, true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// The <see cref="MapZoom" /> property's name.
|
|
||||||
/// </summary>
|
|
||||||
public const string MapZoomPropertyName = "MapZoom";
|
|
||||||
|
|
||||||
private int _mapZoom = 1;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets the MapZoom property.
|
|
||||||
/// </summary>
|
|
||||||
public int MapZoom
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return _mapZoom;
|
|
||||||
}
|
|
||||||
|
|
||||||
set
|
|
||||||
{
|
|
||||||
if (_mapZoom == value)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
_mapZoom = value;
|
|
||||||
|
|
||||||
// Update bindings, no broadcast
|
|
||||||
RaisePropertyChanged(MapZoomPropertyName);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// The <see cref="MapCenter" /> property's name.
|
|
||||||
/// </summary>
|
|
||||||
public const string MapCenterPropertyName = "MapCenter";
|
|
||||||
private GeoCoordinate _mapCenter = new GeoCoordinate(0, 0);
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets the MapCenter property.
|
|
||||||
/// </summary>
|
|
||||||
public GeoCoordinate MapCenter
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return _mapCenter;
|
|
||||||
}
|
|
||||||
|
|
||||||
set
|
|
||||||
{
|
|
||||||
if (_mapCenter == value)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
var oldValue = _mapCenter;
|
|
||||||
_mapCenter = value;
|
|
||||||
|
|
||||||
// Update bindings, no broadcast
|
|
||||||
RaisePropertyChanged(MapCenterPropertyName);
|
|
||||||
//// Update bindings and broadcast change using GalaSoft.MvvmLight.Messenging
|
|
||||||
//RaisePropertyChanged(MapCenterPropertyName, oldValue, value, true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// The <see cref="IsBusy" /> property's name.
|
|
||||||
/// </summary>
|
|
||||||
public const string IsBusyPropertyName = "IsBusy";
|
|
||||||
|
|
||||||
private bool _isBusy = false;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets the IsBusy property.
|
|
||||||
/// </summary>
|
|
||||||
public bool IsBusy
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return _isBusy;
|
|
||||||
}
|
|
||||||
|
|
||||||
set
|
|
||||||
{
|
|
||||||
if (_isBusy == value)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
var oldValue = _isBusy;
|
|
||||||
_isBusy = value;
|
|
||||||
|
|
||||||
// Update bindings, no broadcast
|
|
||||||
RaisePropertyChanged(IsBusyPropertyName);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
@@ -20,7 +20,7 @@
|
|||||||
DataContext="{Binding Main, Source={StaticResource Locator}}"
|
DataContext="{Binding Main, Source={StaticResource Locator}}"
|
||||||
xmlns:my="clr-namespace:Microsoft.Phone.Controls.Maps;assembly=Microsoft.Phone.Controls.Maps"
|
xmlns:my="clr-namespace:Microsoft.Phone.Controls.Maps;assembly=Microsoft.Phone.Controls.Maps"
|
||||||
xmlns:Preview="clr-namespace:Phone7.Fx.Preview;assembly=Phone7.Fx.Preview"
|
xmlns:Preview="clr-namespace:Phone7.Fx.Preview;assembly=Phone7.Fx.Preview"
|
||||||
xmlns:binding="clr-namespace:Coding4Fun.Phone.Controls.Binding;assembly=Coding4Fun.Phone.Controls">
|
xmlns:binding="clr-namespace:Coding4Fun.Phone.Controls.Binding;assembly=Coding4Fun.Phone.Controls" xmlns:Core="clr-namespace:Microsoft.Phone.Controls.Maps.Core;assembly=Microsoft.Phone.Controls.Maps">
|
||||||
|
|
||||||
<!--LayoutRoot contains the root grid where all other page content is placed-->
|
<!--LayoutRoot contains the root grid where all other page content is placed-->
|
||||||
|
|
||||||
@@ -41,18 +41,17 @@
|
|||||||
<Grid x:Name="ContentGrid">
|
<Grid x:Name="ContentGrid">
|
||||||
<StackPanel Orientation="Vertical">
|
<StackPanel Orientation="Vertical">
|
||||||
<Grid Background="{TemplateBinding Background}"
|
<Grid Background="{TemplateBinding Background}"
|
||||||
HorizontalAlignment="Left"
|
HorizontalAlignment="Left">
|
||||||
MinHeight="10"
|
|
||||||
MinWidth="29">
|
|
||||||
<Image x:Name="imgFriend"
|
<Image x:Name="imgFriend"
|
||||||
Source="{Binding PinImageUrl, Mode=OneWay}"
|
Source="{Binding PinImageUrl, Mode=OneWay}"
|
||||||
Margin="2, 2, 2, 24" Width="48" Height="48"
|
Margin="2, 2, 2, 24" Width="48" Height="48"
|
||||||
Stretch="Fill">
|
Stretch="Fill">
|
||||||
</Image>
|
</Image>
|
||||||
<TextBlock HorizontalAlignment="Left" Text="{Binding PinUserName}" VerticalAlignment="Bottom"
|
<TextBlock HorizontalAlignment="Left"
|
||||||
|
Text="{Binding PinUserName, Mode=OneWay}"
|
||||||
|
VerticalAlignment="Bottom"
|
||||||
Margin="1" Width="48" Height="24" />
|
Margin="1" Width="48" Height="24" />
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|
||||||
<Polygon Fill="{TemplateBinding Background}"
|
<Polygon Fill="{TemplateBinding Background}"
|
||||||
Points="0,0 29,0 0,29"
|
Points="0,0 29,0 0,29"
|
||||||
Width="29"
|
Width="29"
|
||||||
@@ -77,6 +76,21 @@
|
|||||||
</Grid.RowDefinitions>
|
</Grid.RowDefinitions>
|
||||||
|
|
||||||
|
|
||||||
|
<Grid.Resources>
|
||||||
|
<DataTemplate x:Key="LogoTemplate">
|
||||||
|
<my:Pushpin Location="{Binding Location}"
|
||||||
|
Background="{StaticResource PhoneAccentBrush}"
|
||||||
|
Template="{StaticResource PushpinControlTemplate2}">
|
||||||
|
</my:Pushpin>
|
||||||
|
</DataTemplate>
|
||||||
|
<my:MapItemsControl x:Name="GroupAPins"
|
||||||
|
ItemTemplate="{StaticResource LogoTemplate}"
|
||||||
|
ItemsSource="{Binding PushPins}"
|
||||||
|
>
|
||||||
|
</my:MapItemsControl>
|
||||||
|
</Grid.Resources>
|
||||||
|
|
||||||
|
|
||||||
<!--ContentPanel - place additional content here-->
|
<!--ContentPanel - place additional content here-->
|
||||||
<Grid x:Name="ContentGrid"
|
<Grid x:Name="ContentGrid"
|
||||||
Grid.Row="0" VerticalAlignment="Stretch"
|
Grid.Row="0" VerticalAlignment="Stretch"
|
||||||
@@ -102,18 +116,34 @@
|
|||||||
VerticalAlignment="Stretch"
|
VerticalAlignment="Stretch"
|
||||||
Center="{Binding Path=MapCenter, Mode=TwoWay}"
|
Center="{Binding Path=MapCenter, Mode=TwoWay}"
|
||||||
ZoomLevel="{Binding Path=MapZoom, Mode=TwoWay}"
|
ZoomLevel="{Binding Path=MapZoom, Mode=TwoWay}"
|
||||||
|
AnimationLevel="Full"
|
||||||
|
ViewChangeEnd="map_ViewChangeEnd"
|
||||||
>
|
>
|
||||||
<my:MapItemsControl ItemsSource="{Binding PushPins}">
|
<my:MapLayer x:Name="layerFriends">
|
||||||
<my:MapItemsControl.ItemTemplate>
|
<my:MapItemsControl ItemsSource="{Binding VisiblePushPins}"
|
||||||
<DataTemplate>
|
ItemTemplate="{StaticResource LogoTemplate}">
|
||||||
<my:Pushpin Location="{Binding Location}"
|
|
||||||
Background="{StaticResource PhoneAccentBrush}"
|
|
||||||
Template="{StaticResource PushpinControlTemplate2}">
|
|
||||||
</my:Pushpin>
|
|
||||||
</DataTemplate>
|
|
||||||
</my:MapItemsControl.ItemTemplate>
|
|
||||||
</my:MapItemsControl>
|
</my:MapItemsControl>
|
||||||
|
</my:MapLayer>
|
||||||
|
<my:MapLayer x:Name="layerMyLocation">
|
||||||
|
<my:MapItemsControl>
|
||||||
|
</my:MapItemsControl>
|
||||||
|
</my:MapLayer>
|
||||||
</my:Map>
|
</my:Map>
|
||||||
|
<StackPanel HorizontalAlignment="Right"
|
||||||
|
VerticalAlignment="Center"
|
||||||
|
Background="Black"
|
||||||
|
Opacity="0.5"
|
||||||
|
>
|
||||||
|
<Image Source="/icons/appbar.location.png"
|
||||||
|
Margin="10"
|
||||||
|
Width="64"
|
||||||
|
Height="64" />
|
||||||
|
<Image Source="/icons/appbar.location.png"
|
||||||
|
Margin="10"
|
||||||
|
Width="64"
|
||||||
|
Height="64" />
|
||||||
|
</StackPanel>
|
||||||
|
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|
||||||
|
|
||||||
@@ -138,7 +168,7 @@
|
|||||||
Background="Transparent"
|
Background="Transparent"
|
||||||
Opacity="1"
|
Opacity="1"
|
||||||
>
|
>
|
||||||
<Image x:Name="imgMine"
|
<Image x:Name="imgMine" Opacity="1"
|
||||||
Source="{Binding MyPicture, Mode=OneWay}" Margin="0" Stretch="Fill" >
|
Source="{Binding MyPicture, Mode=OneWay}" Margin="0" Stretch="Fill" >
|
||||||
</Image>
|
</Image>
|
||||||
<Border Background="{StaticResource PhoneAccentBrush}"
|
<Border Background="{StaticResource PhoneAccentBrush}"
|
||||||
@@ -146,7 +176,7 @@
|
|||||||
Height="25"
|
Height="25"
|
||||||
HorizontalAlignment="Stretch"
|
HorizontalAlignment="Stretch"
|
||||||
VerticalAlignment="Bottom"
|
VerticalAlignment="Bottom"
|
||||||
BorderThickness="0">
|
BorderThickness="0" Opacity="1">
|
||||||
<TextBlock x:Name="txtMyName"
|
<TextBlock x:Name="txtMyName"
|
||||||
Style="{StaticResource PhoneTextNormalStyle}"
|
Style="{StaticResource PhoneTextNormalStyle}"
|
||||||
FontSize="16"
|
FontSize="16"
|
||||||
@@ -154,7 +184,7 @@
|
|||||||
HorizontalAlignment="Left"
|
HorizontalAlignment="Left"
|
||||||
VerticalAlignment="Center"
|
VerticalAlignment="Center"
|
||||||
Margin="2"
|
Margin="2"
|
||||||
Text="{Binding MyName, Mode=OneWay}" />
|
Text="{Binding MyName, Mode=OneWay}" Opacity="1" />
|
||||||
</Border>
|
</Border>
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|
||||||
@@ -172,6 +202,10 @@
|
|||||||
|
|
||||||
<Preview:BindableApplicationBar x:Name="AppBar"
|
<Preview:BindableApplicationBar x:Name="AppBar"
|
||||||
BarOpacity="0.8">
|
BarOpacity="0.8">
|
||||||
|
<Preview:BindableApplicationBarIconButton Command="{Binding ShowMyLocationCommand}"
|
||||||
|
IconUri="/icons/appbar.location.png"
|
||||||
|
Text="{Binding AppBarTextMyLocation}"
|
||||||
|
IsEnabled="{Binding Path=IsBusy, Converter={StaticResource InvertValueConverter1}}" />
|
||||||
<Preview:BindableApplicationBarIconButton Command="{Binding RefreshFriendsCommand}"
|
<Preview:BindableApplicationBarIconButton Command="{Binding RefreshFriendsCommand}"
|
||||||
IconUri="/icons/appbar.sync.rest.png"
|
IconUri="/icons/appbar.sync.rest.png"
|
||||||
Text="{Binding AppBarTextRefresh}" IsEnabled="{Binding Path=IsBusy, Converter={StaticResource InvertValueConverter1}}" />
|
Text="{Binding AppBarTextRefresh}" IsEnabled="{Binding Path=IsBusy, Converter={StaticResource InvertValueConverter1}}" />
|
||||||
@@ -189,19 +223,4 @@
|
|||||||
</Preview:BindableApplicationBar>
|
</Preview:BindableApplicationBar>
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|
||||||
<!-- Sample code showing usage of ApplicationBar
|
|
||||||
<phone:PhoneApplicationPage.ApplicationBar>
|
|
||||||
<shell:ApplicationBar IsVisible="True" IsMenuEnabled="True">
|
|
||||||
<shell:ApplicationBarIconButton x:Name="appbar_button1" IconUri="/Images/appbar_button1.png" Text="Button 1"></shell:ApplicationBarIconButton>
|
|
||||||
<shell:ApplicationBarIconButton x:Name="appbar_button2" IconUri="/Images/appbar_button2.png" Text="Button 2"></shell:ApplicationBarIconButton>
|
|
||||||
<shell:ApplicationBar.MenuItems>
|
|
||||||
<shell:ApplicationBarMenuItem x:Name="menuItem1" Text="MenuItem 1"></shell:ApplicationBarMenuItem>
|
|
||||||
<shell:ApplicationBarMenuItem x:Name="menuItem2" Text="MenuItem 2"></shell:ApplicationBarMenuItem>
|
|
||||||
</shell:ApplicationBar.MenuItems>
|
|
||||||
</shell:ApplicationBar>
|
|
||||||
</phone:PhoneApplicationPage.ApplicationBar>
|
|
||||||
-->
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</phone:PhoneApplicationPage>
|
</phone:PhoneApplicationPage>
|
||||||
@@ -1,16 +1,22 @@
|
|||||||
using System;
|
using System;
|
||||||
|
using System.Device.Location;
|
||||||
using System.Security;
|
using System.Security;
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
|
using System.Windows.Data;
|
||||||
using GalaSoft.MvvmLight.Messaging;
|
using GalaSoft.MvvmLight.Messaging;
|
||||||
using GalaSoft.MvvmLight.Threading;
|
using GalaSoft.MvvmLight.Threading;
|
||||||
using Microsoft.Phone.Controls;
|
using Microsoft.Phone.Controls;
|
||||||
|
using Microsoft.Phone.Controls.Maps;
|
||||||
using Microsoft.Silverlight.Testing;
|
using Microsoft.Silverlight.Testing;
|
||||||
|
using MyFriendsAround.WP7.ViewModel;
|
||||||
using MyFriendsAround.WP7.Views;
|
using MyFriendsAround.WP7.Views;
|
||||||
|
|
||||||
namespace MyFriendsAround.WP7
|
namespace MyFriendsAround.WP7
|
||||||
{
|
{
|
||||||
public partial class MainPage : PhoneApplicationPage
|
public partial class MainPage : PhoneApplicationPage
|
||||||
{
|
{
|
||||||
|
//private Map MyMap;
|
||||||
|
|
||||||
// Constructor
|
// Constructor
|
||||||
public MainPage()
|
public MainPage()
|
||||||
{
|
{
|
||||||
@@ -37,6 +43,8 @@ namespace MyFriendsAround.WP7
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void MainPage_Loaded(object sender, RoutedEventArgs e)
|
void MainPage_Loaded(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
#if TESTING
|
#if TESTING
|
||||||
@@ -52,6 +60,16 @@ namespace MyFriendsAround.WP7
|
|||||||
{
|
{
|
||||||
bool navigateBackSuccessfull = imobileTPage.NavigateBack(); arg.Cancel = navigateBackSuccessfull;
|
bool navigateBackSuccessfull = imobileTPage.NavigateBack(); arg.Cancel = navigateBackSuccessfull;
|
||||||
}; (Application.Current.RootVisual as PhoneApplicationFrame).Content = testPage;
|
}; (Application.Current.RootVisual as PhoneApplicationFrame).Content = testPage;
|
||||||
|
|
||||||
|
map.SetView(LocationRect.CreateLocationRect());
|
||||||
|
}
|
||||||
|
|
||||||
|
private void map_ViewChangeEnd(object sender, MapEventArgs e)
|
||||||
|
{
|
||||||
|
//to workaround the issue
|
||||||
|
// https://connect.microsoft.com/VisualStudio/feedback/details/643990/wp7-bing-maps-control-throwing-unspecified-error-with-mapitemscontrol
|
||||||
|
//
|
||||||
|
(DataContext as MainViewModel).MapViewChangedCommand.Execute(map.BoundingRectangle);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Binary file not shown.
|
After Width: | Height: | Size: 578 B |
Reference in New Issue
Block a user