From a9533b651cd28e7cf38a37a11f46372b778d9231 Mon Sep 17 00:00:00 2001 From: Claudiu Farcas Date: Mon, 4 Apr 2011 03:04:43 +0300 Subject: [PATCH] map issue fixed --- main/MyFriendsAround.WP7/ApplicationIcon.png | Bin 1732 -> 1839 bytes .../MyFriendsAround.WP7.csproj | 11 +- .../ViewModel/MainViewModel.cs | 660 ++++++++++-------- main/MyFriendsAround.WP7/Views/MainPage.xaml | 95 ++- .../Views/MainPage.xaml.cs | 18 + .../icons/appbar.location.png | Bin 0 -> 578 bytes 6 files changed, 452 insertions(+), 332 deletions(-) create mode 100644 main/MyFriendsAround.WP7/icons/appbar.location.png diff --git a/main/MyFriendsAround.WP7/ApplicationIcon.png b/main/MyFriendsAround.WP7/ApplicationIcon.png index 5d874b5957f46d933bdb7dcd77b128580cab8e80..88924ace1bbcef59fef659204412676fb67b3eb6 100644 GIT binary patch delta 1773 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 LNkvXXu0mjf2)`e2 diff --git a/main/MyFriendsAround.WP7/MyFriendsAround.WP7.csproj b/main/MyFriendsAround.WP7/MyFriendsAround.WP7.csproj index d48bc3d..714e45e 100644 --- a/main/MyFriendsAround.WP7/MyFriendsAround.WP7.csproj +++ b/main/MyFriendsAround.WP7/MyFriendsAround.WP7.csproj @@ -216,12 +216,17 @@ PreserveNewest - Always + PreserveNewest - Always + PreserveNewest + + + PreserveNewest + + + PreserveNewest - PreserveNewest diff --git a/main/MyFriendsAround.WP7/ViewModel/MainViewModel.cs b/main/MyFriendsAround.WP7/ViewModel/MainViewModel.cs index 43bdbe2..0e269ec 100644 --- a/main/MyFriendsAround.WP7/ViewModel/MainViewModel.cs +++ b/main/MyFriendsAround.WP7/ViewModel/MainViewModel.cs @@ -22,6 +22,7 @@ using Hammock; using Hammock.Serialization; using Microsoft.Phone; using Microsoft.Phone.Controls; +using Microsoft.Phone.Controls.Maps; using Microsoft.Silverlight.Testing; using MyFriendsAround.Common.Entities; using MyFriendsAround.WP7.Service; @@ -47,6 +48,41 @@ namespace MyFriendsAround.WP7.ViewModel /// public class MainViewModel : ViewModelBase { + + /// + /// Initializes a new instance of the MainViewModel class. + /// + 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(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 { get @@ -55,6 +91,10 @@ namespace MyFriendsAround.WP7.ViewModel } } + + + #region PageTitles + public string PageName { get @@ -79,33 +119,305 @@ namespace MyFriendsAround.WP7.ViewModel } } + #endregion + + + /// - /// Initializes a new instance of the MainViewModel class. + /// The property's name. /// - public MainViewModel() + public const string MyPicturePropertyName = "MyPicture"; + private ImageSource _myPicture = new BitmapImage(new Uri("/icons/anonymousIcon.png", UriKind.RelativeOrAbsolute)); + + /// + /// Gets the MyPicture property. + /// + public ImageSource MyPicture + { + get + { + return _myPicture; + } + + set + { + if (_myPicture == value) + { + return; + } + + _myPicture = value; + + // Update bindings, no broadcast + RaisePropertyChanged(MyPicturePropertyName); + } + } + + + + + + + + /// + /// The property's name. + /// + public const string MyNamePropertyName = "MyName"; + private string _myName = "Guest"; + + /// + /// Gets the MyName property. + /// + 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"; } + } + + /// + /// The property's name. + /// + public const string PushPinsPropertyName = "PushPins"; + private ObservableCollection _PushPins = new ObservableCollection(); + /// + /// Gets the PushPins property. + /// + public ObservableCollection PushPins + { + get + { + return _PushPins; + } + + set + { + if (_PushPins == value) + { + return; + } + + _PushPins = value; + + // Update bindings, no broadcast + RaisePropertyChanged(PushPinsPropertyName); + } + } + + + /// + /// The property's name. + /// + public const string VisiblePushPinsPropertyName = "VisiblePushPins"; + private ObservableCollection _VisiblePushPins = new ObservableCollection(); + /// + /// Gets the PushPins property. + /// + public ObservableCollection VisiblePushPins + { + get + { + return _VisiblePushPins; + } + + set + { + if (_VisiblePushPins == value) + { + return; + } + + _VisiblePushPins = value; + + // Update bindings, no broadcast + RaisePropertyChanged(VisiblePushPinsPropertyName); + } + } + + + /// + /// The property's name. + /// + public const string MapZoomPropertyName = "MapZoom"; + + private int _mapZoom = 1; + + /// + /// Gets the MapZoom property. + /// + public int MapZoom + { + get + { + return _mapZoom; + } + + set + { + if (_mapZoom == value) + { + return; + } + _mapZoom = value; + + // Update bindings, no broadcast + RaisePropertyChanged(MapZoomPropertyName); + } + } + + + + + /// + /// The property's name. + /// + public const string IsBusyPropertyName = "IsBusy"; + + private bool _isBusy = false; + + /// + /// Gets the IsBusy property. + /// + public bool IsBusy + { + get + { + return _isBusy; + } + + set + { + if (_isBusy == value) + { + return; + } + + var oldValue = _isBusy; + _isBusy = value; + + // Update bindings, no broadcast + RaisePropertyChanged(IsBusyPropertyName); + } + } + + + + /// + /// The property's name. + /// + public const string MapCenterPropertyName = "MapCenter"; + + private GeoCoordinate _mapCenter = null; + + /// + /// Gets the MapCenter property. + /// + 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) + private void MapViewChanged(LocationRect boundRectangle) + { + ObservableCollection _newVisiblePushPins = new ObservableCollection(); + //filter visible pushpins + foreach (PushPinModel pushPin in PushPins) { - // Code runs in Blend --> create design time data. + if (boundRectangle.Intersects(new LocationRect(pushPin.Location, .5, .5))) + { + _newVisiblePushPins.Add(pushPin); + } } - else - { - // Code runs "for real" - } - + VisiblePushPins = _newVisiblePushPins; } public void CropCancel() @@ -118,7 +430,7 @@ namespace MyFriendsAround.WP7.ViewModel { // } - + private void MainLoad() { @@ -189,7 +501,7 @@ namespace MyFriendsAround.WP7.ViewModel private void cameraTask_Completed(object sender, PhotoResult e) { - if (e.ChosenPhoto!=null && e.ChosenPhoto.Length>0) // e.TaskResult == TaskResult.OK) + if (e.ChosenPhoto != null && e.ChosenPhoto.Length > 0) // e.TaskResult == TaskResult.OK) { // Get the image temp file from e.OriginalFileName. // Get the image temp stream from e.ChosenPhoto. @@ -210,39 +522,6 @@ namespace MyFriendsAround.WP7.ViewModel } } - /// - /// The property's name. - /// - public const string MyPicturePropertyName = "MyPicture"; - private ImageSource _myPicture = new BitmapImage(new Uri("/icons/anonymousIcon.png", UriKind.RelativeOrAbsolute)); - - /// - /// Gets the MyPicture property. - /// - 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() @@ -289,16 +568,16 @@ namespace MyFriendsAround.WP7.ViewModel { ObservableCollection result = new ObservableCollection(); list.ForEach((f) => - { - //f.LocationStr - result.Add(new PushPinModel() - { - PinSource = "/ApplicationIcon.png", - Location = new GeoCoordinate(f.Latitude, f.Longitude), - PinUserName = f.FriendName, - PinImageUrl = string.Format("https://myfriendsaround.blob.core.windows.net/profiles/profile_{0}.jpg", f.Id) - }); - }); + { + //f.LocationStr + result.Add(new PushPinModel() + { + PinSource = "/ApplicationIcon.png", + Location = new GeoCoordinate(f.Latitude, f.Longitude), + PinUserName = f.FriendName, + PinImageUrl = string.Format("https://myfriendsaround.blob.core.windows.net/profiles/profile_{0}.jpg", f.Id) + }); + }); PushPins = result; } @@ -320,20 +599,20 @@ namespace MyFriendsAround.WP7.ViewModel { List list = args.Friends; DispatcherHelper.CheckBeginInvokeOnUI(() => - { - PopulatePushPins(list); - IsBusy = false; - } + { + PopulatePushPins(list); + IsBusy = false; + } ); } else { DispatcherHelper.CheckBeginInvokeOnUI(() => - { - IsBusy = false; - var exception = new ExceptionPrompt(); - exception.Show(args.Error); - } + { + IsBusy = false; + var exception = new ExceptionPrompt(); + exception.Show(args.Error); + } ); } } @@ -343,27 +622,27 @@ namespace MyFriendsAround.WP7.ViewModel if (args.Error != null) { DispatcherHelper.CheckBeginInvokeOnUI(() => - { - IsBusy = false; - var exception = new ExceptionPrompt(); - exception.Show(args.Error); - }); + { + IsBusy = false; + var exception = new ExceptionPrompt(); + exception.Show(args.Error); + }); } else { if (!args.IsSuccess) { DispatcherHelper.CheckBeginInvokeOnUI(() => - { - var message = new DialogMessage( - "Communication error!", DialogMessageCallback) - { - Button = MessageBoxButton.OK, - Caption = "Error!" - }; + { + var message = new DialogMessage( + "Communication error!", DialogMessageCallback) + { + Button = MessageBoxButton.OK, + Caption = "Error!" + }; - Messenger.Default.Send(message); - }); + Messenger.Default.Send(message); + }); } else { @@ -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; } - - - - - /// - /// The property's name. - /// - public const string MyNamePropertyName = "MyName"; - private string _myName = "Guest"; - - /// - /// Gets the MyName property. - /// - 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() ////{ //// // Clean up if needed @@ -511,136 +717,8 @@ namespace MyFriendsAround.WP7.ViewModel //// base.Cleanup(); ////} - - /// - /// The property's name. - /// - public const string PushPinsPropertyName = "PushPins"; - private ObservableCollection _PushPins = new ObservableCollection(); - /// - /// Gets the PushPins property. - /// - public ObservableCollection 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); - } - } - - - /// - /// The property's name. - /// - public const string MapZoomPropertyName = "MapZoom"; - - private int _mapZoom = 1; - - /// - /// Gets the MapZoom property. - /// - public int MapZoom - { - get - { - return _mapZoom; - } - - set - { - if (_mapZoom == value) - { - return; - } - _mapZoom = value; - - // Update bindings, no broadcast - RaisePropertyChanged(MapZoomPropertyName); - } - } - - - /// - /// The property's name. - /// - public const string MapCenterPropertyName = "MapCenter"; - private GeoCoordinate _mapCenter = new GeoCoordinate(0, 0); - - /// - /// Gets the MapCenter property. - /// - 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); - } - } - - - /// - /// The property's name. - /// - public const string IsBusyPropertyName = "IsBusy"; - - private bool _isBusy = false; - - /// - /// Gets the IsBusy property. - /// - public bool IsBusy - { - get - { - return _isBusy; - } - - set - { - if (_isBusy == value) - { - return; - } - - var oldValue = _isBusy; - _isBusy = value; - - // Update bindings, no broadcast - RaisePropertyChanged(IsBusyPropertyName); - } - } + #endregion } + } \ No newline at end of file diff --git a/main/MyFriendsAround.WP7/Views/MainPage.xaml b/main/MyFriendsAround.WP7/Views/MainPage.xaml index 12575aa..346f080 100644 --- a/main/MyFriendsAround.WP7/Views/MainPage.xaml +++ b/main/MyFriendsAround.WP7/Views/MainPage.xaml @@ -20,7 +20,7 @@ DataContext="{Binding Main, Source={StaticResource Locator}}" 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: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"> @@ -41,18 +41,17 @@ + HorizontalAlignment="Left"> - + - - + + + + + + + + + + + - - - - - - - - + + + + + + + + + + + + + @@ -131,14 +161,14 @@ Foreground="{StaticResource PhoneAccentBrush}" Style="{StaticResource PhoneTextNormalStyle}" /> + Height="80" > - + BorderThickness="0" Opacity="1"> + Text="{Binding MyName, Mode=OneWay}" Opacity="1" /> @@ -172,6 +202,10 @@ + @@ -189,19 +223,4 @@ - - - - \ No newline at end of file diff --git a/main/MyFriendsAround.WP7/Views/MainPage.xaml.cs b/main/MyFriendsAround.WP7/Views/MainPage.xaml.cs index 9675a1e..de0192e 100644 --- a/main/MyFriendsAround.WP7/Views/MainPage.xaml.cs +++ b/main/MyFriendsAround.WP7/Views/MainPage.xaml.cs @@ -1,16 +1,22 @@ using System; +using System.Device.Location; using System.Security; using System.Windows; +using System.Windows.Data; using GalaSoft.MvvmLight.Messaging; using GalaSoft.MvvmLight.Threading; using Microsoft.Phone.Controls; +using Microsoft.Phone.Controls.Maps; using Microsoft.Silverlight.Testing; +using MyFriendsAround.WP7.ViewModel; using MyFriendsAround.WP7.Views; namespace MyFriendsAround.WP7 { public partial class MainPage : PhoneApplicationPage { + //private Map MyMap; + // Constructor public MainPage() { @@ -37,6 +43,8 @@ namespace MyFriendsAround.WP7 } + + void MainPage_Loaded(object sender, RoutedEventArgs e) { #if TESTING @@ -52,6 +60,16 @@ namespace MyFriendsAround.WP7 { bool navigateBackSuccessfull = imobileTPage.NavigateBack(); arg.Cancel = navigateBackSuccessfull; }; (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); } } diff --git a/main/MyFriendsAround.WP7/icons/appbar.location.png b/main/MyFriendsAround.WP7/icons/appbar.location.png new file mode 100644 index 0000000000000000000000000000000000000000..41d7ecf8ac905beed5f5b97fbabb4d5f5849d353 GIT binary patch literal 578 zcmV-I0=@l-P)Px#1ZP1_K>z@;j|==^1poj532;bRa{vGi!vFvd!vV){sAK>D0oO@HK~!i%?N>cZ z#6S?eXeA=r+gVwOjg{Ki*xLA;ECf3d;d;T!e5-WF%nnTZ#4) zYTV4N>dDb;=CqgZ&vx3h8y)3#S`)E!py@dejPpRFw~IPbs)I~tWj|6nPtT#>Thnm! znbx*?&V$SbsI}D6#P*%mwt8z5pik_7ov=2=a$g(}2gCt!KpYSU#DRqazhe6{4iYKi QTmS$707*qoM6N<$f;t%d9RL6T literal 0 HcmV?d00001