示例#1
0
        public void OnSuccess(Object result)
        {
            try
            {
                var findCurrentPlaceResponse = (FindCurrentPlaceResponse)result;
                switch (findCurrentPlaceResponse)
                {
                case null:
                    return;
                }

                MAdapter.PlacesList = new ObservableCollection <MyPlace>();
                foreach (var placeLikelihood in findCurrentPlaceResponse.PlaceLikelihoods)
                {
                    MAdapter.PlacesList.Add(new MyPlace
                    {
                        Address           = placeLikelihood.Place.Address,
                        AddressComponents = placeLikelihood.Place.AddressComponents,
                        Attributions      = placeLikelihood.Place.Attributions,
                        Id               = placeLikelihood.Place.Id,
                        LatLng           = placeLikelihood.Place.LatLng,
                        Name             = placeLikelihood.Place.Name,
                        OpeningHours     = placeLikelihood.Place.OpeningHours,
                        PhoneNumber      = placeLikelihood.Place.PhoneNumber,
                        PhotoMetadatas   = placeLikelihood.Place.PhotoMetadatas,
                        PlusCode         = placeLikelihood.Place.PlusCode,
                        PriceLevel       = placeLikelihood.Place.PriceLevel,
                        Rating           = placeLikelihood.Place.Rating,
                        UserRatingsTotal = placeLikelihood.Place.UserRatingsTotal,
                        Viewport         = placeLikelihood.Place.Viewport,
                        WebsiteUri       = placeLikelihood.Place.WebsiteUri,
                    });
                }
                MAdapter.NotifyDataSetChanged();

                var dialogList = new MaterialDialog.Builder(this).Theme(AppSettings.SetTabDarkTheme ? AFollestad.MaterialDialogs.Theme.Dark : AFollestad.MaterialDialogs.Theme.Light);
                dialogList.Title(Resource.String.Lbl_NearBy).TitleColorRes(Resource.Color.primary);
                dialogList.Adapter(MAdapter, new LinearLayoutManager(this));
                dialogList.AutoDismiss(true);
                dialogList.NegativeText(GetText(Resource.String.Lbl_Close)).OnNegative(this);
                dialogList.AlwaysCallSingleChoiceCallback();
                dialogList.Build().Show();
            }
            catch (Exception e)
            {
                Methods.DisplayReportResultTrack(e);
            }
        }