Esempio n. 1
0
        protected async override void OnAppearing()
        {
            base.OnAppearing();

            if (_conferenceInfo == null)
            {
                var cd = new ConferenceData();
                _conferenceInfo = await cd.GetConferenceInfoAsync();

                Title.Text       = _conferenceInfo.Name;
                Description.Text = _conferenceInfo.Description;

                var geoCoder = await new Geocoder().GetPositionsForAddressAsync(_conferenceInfo.Location);

                Map.MoveToRegion(MapSpan.FromCenterAndRadius(geoCoder.FirstOrDefault(), new Distance(100)));
            }
        }
Esempio n. 2
0
        public async Task <ConferenceInfoModel> GetConferenceInfoAsync()
        {
            var ConferenceInformation = new ConferenceInfoModel();

            try
            {
                var uri = new Uri(string.Format(Uri, string.Empty));

                var response = await client.GetAsync(uri + "/conference");

                if (response.IsSuccessStatusCode)
                {
                    var content = await response.Content.ReadAsStringAsync();

                    var tempConferenceInfo = JsonConvert.DeserializeObject <ConferenceInfo>(content);

                    ConferenceInformation = new ConferenceInfoModel
                    {
                        Name        = tempConferenceInfo.Name,
                        Description = tempConferenceInfo.Description,
                        Dates       = "1/1/2017",
                        Location    = string.Format("{0} {1} {2} {3}, {4} {5}", tempConferenceInfo.Location.Line1,
                                                    tempConferenceInfo.Location.Line2,
                                                    tempConferenceInfo.Location.Line3,
                                                    tempConferenceInfo.Location.City,
                                                    tempConferenceInfo.Location.StateOrProvince,
                                                    tempConferenceInfo.Location.PostalCode)
                    };

                    response.Dispose();
                    content            = null;
                    tempConferenceInfo = null;
                }
            }
            catch (Exception ex)
            {
                Debug.WriteLine(@"ERROR {0}", ex.Message);
            }
            finally
            {
                client.Dispose();
            }

            return(ConferenceInformation);
        }