Esempio n. 1
0
        public async void Init(string location)
        {
            await Task.Delay(100);

            //if user has edited parking spot address
            if (!string.IsNullOrEmpty(mCacheService.SpotAddress))
            {
                Address = mCacheService.SpotAddress;
                return;
            }

            //if we are editing a parking spot
            if (!string.IsNullOrEmpty(location))
            {
                Address = location;
                return;
            }

            //if we are adding a new parking spot
            if (mCacheService.CurrentLat != 0 && mCacheService.CurrentLng != 0)
            {
                if (BaseView != null && BaseView.CheckInternetConnection())
                {
                    Mvx.Resolve <IMvxMessenger>().Publish(new ProgressMessage(this, true));

                    var result = await mApiService.AddressOf(mCacheService.CurrentLat, mCacheService.CurrentLng);

                    if (result != null)
                    {
                        Address = result.Address;
                    }

                    Mvx.Resolve <IMvxMessenger>().Publish(new ProgressMessage(this, false));
                }
                else
                {
                    Mvx.Resolve <IMvxMessenger>().Publish(new ToastMessage(this, SharedTextSource.GetText("TurnOnInternetText")));
                }
            }
        }