Ejemplo n.º 1
0
 //Methods
 private void AddFriend()
 {
     if (this.SelectedFriendString != null)
     {
         Friend.All friend = this.Friends.Where(r => r.User2.ToString() == this.SelectedFriendString).First();
         if (VindRitFilterVM.SelectedFriends == null)
         {
             VindRitFilterVM.SelectedFriends = new List <Friend.All>();
         }
         VindRitFilterVM.SelectedFriends.Add(friend);
     }
 }
Ejemplo n.º 2
0
        private async Task GetFriends()
        {
            this.Loading = true;
            RaisePropertyChanged("Loading");

            friends_all = await FriendsRepository.GetFriends();

            //Try catch errond om te zorgen dat hij niet crasht bij lege bobs.
            if (this.friends_all != null)
            {
                for (int i = 0; i < friends_all.Count(); i++)
                {
                    try
                    {
                        Friend.All item = friends_all[i];
                        if (item.Location == null)
                        {
                            break;
                        }

                        item.VisibleShow      = Visibility.Collapsed;
                        item.ShowCommand      = new RelayCommand <object>(e => ShowFriend(e));
                        item.RouteCommand     = new RelayCommand <object>(e => mapItem_Friend(e));
                        item.RouteCommandText = "Toon route";

                        BasicGeoposition tempbasic = new BasicGeoposition();
                        //Locaties omzetten en in de tijdelijke posities opslaan.
                        tempbasic.Latitude  = ((Location)item.Location).Latitude;
                        tempbasic.Longitude = ((Location)item.Location).Longitude;

                        //Omzetten van tijdelijk punt naar echte locatie (anders krijg je die niet in de mapIconFeestLocation.Location)
                        Geopoint temppoint = new Geopoint(tempbasic);

                        MapIcon mapIconFeestLocation = new MapIcon();
                        mapIconFeestLocation.Location = temppoint; //Opgehaalde locatie
                                                                   //mapIconFeestLocation.Title = feest.Name; //Naam van het feestje;
                        mapIconFeestLocation.Image = MainViewVM.Pins.UserPin;
                        mapIconFeestLocation.Title = item.User1.ToString();
                        this.Map.MapElements.Add(mapIconFeestLocation);//Marker op de map zetten.
                    }
                    catch (Exception ex)
                    {
                    }
                }

                try
                {
                    var          newControl = new MapItemsControl();
                    ZoekVrienden vindrit    = MainViewVM.MainFrame.Content as ZoekVrienden;

                    newControl.ItemsSource  = friends_all;
                    newControl.ItemTemplate = (DataTemplate)vindrit.Resources["FriendsMapTemplate"] as DataTemplate;



                    AddOrUpdateChild(newControl);
                }
                catch (Exception)
                {
                }



                this.Friends = friends_all.Take(10).ToList();
                this.Loading = false;
                RaiseAll();
            }
        }