示例#1
0
        public void ShowSizeSingleSelectAndMakeAction(Action <ClothSize> actionOnSelect, string selectedItemName = null)
        {
            var allSizesNames = GetClothSizeNames();

            AlertsService.ShowSingleSelectListString(ctx, allSizesNames, (s) => actionOnSelect(s.GetEnumValueByDisplayName <ClothSize>()), selectedItemName, "Wybierz rozmiar");
        }
        public Location GetLocation()
        {
            try
            {
                locationManager = (LocationManager)mContext.GetSystemService("location");

                // Getting GPS status
                isGPSEnabled = locationManager.IsProviderEnabled(LocationManager.GpsProvider);

                // Getting network status
                isNetworkEnabled = locationManager.IsProviderEnabled(LocationManager.NetworkProvider);

                if (!isGPSEnabled && !isNetworkEnabled)
                {
                    //showalert in activity
                }
                else
                {
                    if (isNetworkEnabled)
                    {
                        if (locationManager != null)
                        {
                            locationManager.RequestLocationUpdates(
                                LocationManager.NetworkProvider,
                                MIN_TIME_BW_UPDATES,
                                MIN_DISTANCE_CHANGE_FOR_UPDATES, this);
                            location = locationManager.GetLastKnownLocation(LocationManager.NetworkProvider);
                            if (location != null)
                            {
                                latitude  = location.Latitude;
                                longitude = location.Longitude;
                            }
                        }
                    }
                    if (isGPSEnabled)
                    {
                        if (location == null)
                        {
                            locationManager.RequestLocationUpdates(
                                LocationManager.GpsProvider,
                                MIN_TIME_BW_UPDATES,
                                MIN_DISTANCE_CHANGE_FOR_UPDATES, this);
                            if (locationManager != null)
                            {
                                location = locationManager.GetLastKnownLocation(LocationManager.GpsProvider);
                                if (location != null)
                                {
                                    latitude  = location.Latitude;
                                    longitude = location.Longitude;
                                }
                            }
                        }
                    }
                }
            }
            catch (Exception e)
            {
                AlertsService.ShowLongToast(this.mContext, "Nie masz w³¹czonej lokalizacji!");
            }

            return(location);
        }