private void Init(int Rate) { StackPage.Children.Clear(); if (Rate >= 0 && Rate < 6) { if (FillStarImageSource == null) { FillStarImageSource = ImageSource.FromFile(FillStarImage); } if (EmptyStarImageSource == null) { EmptyStarImageSource = ImageSource.FromFile(EmptyStarImage); } for (int i = 0; i < 5; i++) { if (Rate-- > 0) { StackPage.Children.Add(new FFImageLoading.Svg.Forms.SvgCachedImage { Source = FillStarImageSource, WidthRequest = SetterStyle.Maintain_WidthAspectRatio(15), HeightRequest = SetterStyle.Maintain_WidthAspectRatio(15) }); } else { StackPage.Children.Add(new FFImageLoading.Svg.Forms.SvgCachedImage { Source = EmptyStarImageSource, WidthRequest = SetterStyle.Maintain_WidthAspectRatio(15), HeightRequest = SetterStyle.Maintain_WidthAspectRatio(15) }); } } } }
private async void OpenMap(object sender, EventArgs e) { try { var CurrentUserLocation = await Xamarin.Essentials.Geolocation.GetLastKnownLocationAsync(); var Latitude = CheckoutProperty.InfoLocation.Location.Latitude; var Longitude = CheckoutProperty.InfoLocation.Location.Longitude; Position position = new Position(Latitude, Longitude); if (CurrentUserLocation != null) { position = new Position(CurrentUserLocation.Latitude, CurrentUserLocation.Longitude); } //Create New Map and Add it to page after Get Permission MapView = new Map( MapSpan.FromCenterAndRadius( position, Distance.FromMiles(0.3))) { IsShowingUser = true, VerticalOptions = LayoutOptions.FillAndExpand, HorizontalOptions = LayoutOptions.FillAndExpand, }; //MapView.MoveToRegion(new MapSpan(position, position.Latitude, position.Longitude)); var PinMapImage = new FFImageLoading.Svg.Forms.SvgCachedImage { Source = "PinMap.svg", Margin = (Thickness)SetterStyle.GetMargin(bottom: 3).Value, Style = StyleViews.Styles.GeneralStyles.FFImage32X32Style, VerticalOptions = LayoutOptions.Center, HorizontalOptions = LayoutOptions.Center }; ContentMap.Children.Add(MapView); ContentMap.Children.Add(PinMapImage); //Countinue Down 5 => 0 and then select location and Get it's name DateTime originalTime = DateTime.Now.AddSeconds(2); TimeSpan Time = new TimeSpan(); Device.StartTimer(TimeSpan.FromSeconds(1), () => { Time = originalTime.Subtract(DateTime.Now); var Countdown = Time.ToString(@"hh\:mm\:ss"); if (Countdown == Convert.ToString(TimeSpan.Zero)) { GetLocation(); if (PlaceMark != null) { CheckoutProperty.InfoLocation = new Property.ReciveLocation { LocationName = $"Near {PlaceMark.FeatureName}, {PlaceMark.Locality}, {PlaceMark.CountryCode}", Location = new Xamarin.Essentials.Location { Latitude = PlaceMark.Location.Latitude, Longitude = PlaceMark.Location.Longitude } } } ; HintText.Text = CheckoutProperty.InfoLocation.LocationName; originalTime = DateTime.Now.AddSeconds(2); } return(MapContentView.IsVisible); }); MapView.PropertyChanged += (s, eM) => { try { if (eM.PropertyName == nameof(MapView.VisibleRegion)) { //Reset Timer timer = 5; HintText.Text = string.Empty; HintRefresh.IsRunning = true; originalTime = DateTime.Now.AddSeconds(2); } } catch { } }; MapContentView.IsVisible = true; } catch (Xamarin.Essentials.PermissionException) { var boolean = await App._nav.DisplayAlert(MultiLanguage.MLResource.Permission, MultiLanguage.MLResource.PermissionGetLocation, MultiLanguage.MLResource.Allow, MultiLanguage.MLResource.Denied); if (boolean) { DependencyService.Get <Interface.IAuthorizeCamera>().Authorized(); } else { MapContentView.IsVisible = false; _ = App._nav.DisplayAlert(MultiLanguage.MLResource.Error, MultiLanguage.MLResource.FailedMessage, MultiLanguage.MLResource.Ok); } } catch { MapContentView.IsVisible = false; _ = App._nav.DisplayAlert(MultiLanguage.MLResource.Error, MultiLanguage.MLResource.FailedMessage, MultiLanguage.MLResource.Ok); } }
private async void ShowFilter(object sender, EventArgs e) { HolderFilter.IsVisible = !HolderFilter.IsVisible; if (!HolderFilter.IsVisible) { var DefualtHeight = App.ScreenHeight; await FilterView.TranslateTo(0, (FilterView.Height == -1 ? DefualtHeight : FilterView.Height) + SetterStyle.Maintain_HeightAspectRatio(15), 250); } else { await FilterView.TranslateTo(0, 0, 250); } }