Exemplo n.º 1
0
 /// <summary>
 /// Creates the locations manager if it has not already been instanciated
 /// </summary>
 /// <returns> a new instances of the locationManger if its currently not
 ///             instanciated. else returns current instance
 /// </returns>
 public static LocationsManager GetInstance()
 {
     if (instance == null)
     {
         instance = new LocationsManager();
     }
     return(instance);
 }
Exemplo n.º 2
0
        /// <summary>
        /// attempts to find and set a possible location origin to the article
        /// </summary>
        /// <param name="articles"></param>
        /// <returns></returns>
        private void FindCordinates(List <Article> articles)
        {
            string latitude  = "";
            string longitude = "";

            Controllers.LocationsManager myManager = Controllers.LocationsManager.GetInstance();
            foreach (Article article in articles)
            {
                if (article.Latitude == "" || article.Longitude == "")
                {
                    latitude = myManager.SearchCordinates(article.Title, out longitude);
                    if (latitude == "" && longitude == "")
                    {
                        latitude = myManager.SearchCordinates(article.Summary, out longitude);
                    }
                    article.Latitude  = latitude;
                    article.Longitude = longitude;
                }
            }
        }