Ejemplo n.º 1
0
        private void GetListeners(string range)
        {
            try
            {
                var reqGet = new HttpRequestGet();
                ListListeners = new ObservableCollection<Listenings>();
                ListUser = new ObservableCollection<User>();
                var listListeners = reqGet.GetListenerAroundMe(new List<Listenings>(), UserLocation.Latitude.ToString(),
                    UserLocation.Longitude.ToString(), range);
                listListeners.ContinueWith(delegate(Task<object> tmp)
                {
                    var res = tmp.Result as List<Listenings>;
                    if (res != null)
                    {
                        foreach (var item in res)
                        {
                            CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync(CoreDispatcherPriority.Normal,
                                () =>
                                {
                                    ListListeners.Add(item);
                                    ListUser.Add(item.user);
                                });
                        }
                        CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync(CoreDispatcherPriority.Normal,
                            AddMappElements);
                    }
                });
            }
            catch (Exception)
            {
                new MessageDialog(loader.GetString("WaitGeo")).ShowAsync();
            }

        }