Beispiel #1
0
        private List <FavoritePlace> updatePlacesRating()
        {
            List <FavoritePlace> places = new List <FavoritePlace>();
            bool exists = false;

            foreach (User currentFriend in friendsListBox.Items)
            {
                foreach (Checkin checkin in currentFriend.Checkins)
                {
                    if (checkin.Place != null)
                    {
                        exists = false;

                        foreach (FavoritePlace place in places)
                        {
                            if (place.Place.Name == checkin.Place.Name)
                            {
                                exists = true;
                                place.Rating++;
                                break;
                            }
                        }

                        if (!exists)
                        {
                            FavoritePlace newPlace = new FavoritePlace(checkin.Place);
                            places.Add(newPlace);
                        }
                    }
                }
            }

            return(places);
        }
Beispiel #2
0
        private void displaySelectedPlace(ListBox i_CurrentListBox)
        {
            this.Size = new Size(1000, Size.Height);
            try
            {
                string selectedPlaceStr = string.Empty;

                if (i_CurrentListBox.SelectedItem is FavoritePlace)
                {
                    FavoritePlace selectedPlace = i_CurrentListBox.SelectedItem as FavoritePlace;
                    selectedPlaceStr = selectedPlace.Place.Name;
                }
                else
                {
                    selectedPlaceStr = i_CurrentListBox.Text;
                }

                navigateToSearchEngine(selectedPlaceStr);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message.ToString(), "Error");
            }
        }