Пример #1
0
        public TeleportSearchedCityDistrictScoresInfo GetSearchedCityDistrictScoresInfo(string urbanAreaScoresLink)
        {
            TeleportSearchedCityDistrictScoresInfo teleportSearchedCityDistrictScoresInfo = new TeleportSearchedCityDistrictScoresInfo();

            try
            {
                JObject jObject = GetJObject(urbanAreaScoresLink);

                String summary = jObject["summary"].Value <string>().Replace("<p>", "").Replace("</p>", "").Replace("<i>", "").Replace("</i>", "")
                                 .Replace("</b>", "").Replace("\n", "").Replace("<b>", "").Replace("  ", "").Replace(".", " . ").Replace("<br>", "").Replace("</br>", "");
                teleportSearchedCityDistrictScoresInfo.Summary   = summary;
                teleportSearchedCityDistrictScoresInfo.CityScore = jObject["teleport_city_score"].Value <int>();

                LinkedList <TeleportSearchedCityDistrictScore> teleportSearchedCityDistrictScores = new LinkedList <TeleportSearchedCityDistrictScore>();

                foreach (JObject category in jObject["categories"] as JArray)
                {
                    TeleportSearchedCityDistrictScore teleportSearchedCityDistrictScore = new TeleportSearchedCityDistrictScore();
                    teleportSearchedCityDistrictScore.Color           = category["color"].Value <String>();
                    teleportSearchedCityDistrictScore.Name            = category["name"].Value <String>();
                    teleportSearchedCityDistrictScore.Score_out_of_10 = category["score_out_of_10"].Value <int>();
                    teleportSearchedCityDistrictScores.AddLast(teleportSearchedCityDistrictScore);
                }

                teleportSearchedCityDistrictScoresInfo.TeleportSearchedCityDistrictScores = teleportSearchedCityDistrictScores;
            }
            catch (Exception)
            {
                return(null);
            }
            return(teleportSearchedCityDistrictScoresInfo);
        }
Пример #2
0
        public Cities1ViewModel()
        {
            teleportDestination_sCategoriesScoresService = new TeleportDestination_sCategoriesDetailsImagesServiceWebApi();
            destinationtSearchedCityDistrictModel        = CurrentTeleportSearchedCityDistrictModels.DestinationPointTeleportSearchedCityDistrictModel;
            DestinationtPointFullName = destinationtSearchedCityDistrictModel.FullName;

            ObservableCategoryTypes = new ObservableCollection <TeleportSearchedCityDistrictCategoriesModel>(
                teleportDestination_sCategoriesScoresService.GetTeleportSearchedCityDistrictCategoryModels(
                    destinationtSearchedCityDistrictModel.UrbanAreaDetailsLink));


            TeleportSearchedCityDistrictScoresInfo teleportSearchedCityDistrictScoresInfo = teleportDestination_sCategoriesScoresService.GetSearchedCityDistrictScoresInfo(destinationtSearchedCityDistrictModel.UrbanAreaScoresLink);

            DestinationtPointDescription = teleportSearchedCityDistrictScoresInfo.Summary;
            observableScoresToStore      = new ObservableCollection <TeleportSearchedCityDistrictScore>(teleportSearchedCityDistrictScoresInfo.TeleportSearchedCityDistrictScores);
            ObservableScores             = new ObservableCollection <TeleportSearchedCityDistrictScore>(observableScoresToStore);
        }