Example #1
0
        public override bool FinishedLaunching(UIApplication uiApplication, NSDictionary launchOptions)
        {
            Forms.Init();

            CarouselViewRenderer.Init();
            AnimationViewRenderer.Init();
            CachedImageRenderer.Init();

            // TODO dummy to prevent the dll being trashed by the linker.
            // Should be a better solution...
            var foo = new FFImageLoading.Svg.Forms.SvgCachedImage();

            UIApplication.SharedApplication.SetStatusBarHidden(false, false);
            LoadApplication(new BeenPwnedApp());

            UIApplication.SharedApplication.SetStatusBarStyle(UIStatusBarStyle.LightContent, false);

#if !DEBUG
            // Periodically let the app ask for a review
            if (UIDevice.CurrentDevice.CheckSystemVersion(10, 3))
            {
                SKStoreReviewController.RequestReview();
            }
#endif
            return(base.FinishedLaunching(uiApplication, launchOptions));
        }
        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);
            }
        }
Example #3
0
        private void InitializeComponent()
        {
            ZXReader = new ZXingScannerView
            {
                AutomationId     = "ZXingScannerView",
                InputTransparent = true,
                IsAnalyzing      = ViewModel.IsAnalyzing,
                IsScanning       = ViewModel.IsScanning,
                IsTorchOn        = true
            };
            ZXOverlay = new ZXingDefaultOverlay
            {
                AutomationId    = "ZXingDefaultOverlay",
                BackgroundColor = Color.Transparent,
                BottomText      = "Aponte para o Qr Code",
                TopText         = "Registrar ponto"
            };
            GrdLeitor = new Grid
            {
                HorizontalOptions = LayoutOptions.FillAndExpand,
                VerticalOptions   = LayoutOptions.FillAndExpand,
                Children          = { ZXReader, ZXOverlay }
            };

            LblMensager = new Label
            {
                HorizontalOptions = LayoutOptions.CenterAndExpand,
                VerticalOptions   = LayoutOptions.Start,
                Text = "kiko"
            };
            ImageLoad = new FFImageLoading.Svg.Forms.SvgCachedImage
            {
                Source            = "loading.gif",
                HorizontalOptions = LayoutOptions.CenterAndExpand,
                VerticalOptions   = LayoutOptions.Start,
                Scale             = 3
            };
            BtnTentarNovamente = new Button
            {
                HorizontalOptions = LayoutOptions.Center,
                VerticalOptions   = LayoutOptions.Start,
                BackgroundColor   = Color.Transparent,
                IsVisible         = false,
                Text = "Tentar Novamente"
            };
            StlLoader = new StackLayout
            {
                IsVisible         = false,
                VerticalOptions   = LayoutOptions.StartAndExpand,
                HorizontalOptions = LayoutOptions.CenterAndExpand,
                Children          =
                {
                    LblMensager,
                    new AbsoluteLayout
                    {
                        VerticalOptions   = LayoutOptions.CenterAndExpand,
                        HorizontalOptions = LayoutOptions.CenterAndExpand,
                        Children          = { ImageLoad }
                    },
                    BtnTentarNovamente
                }
            };

            StlLeitor = new StackLayout()
            {
                BackgroundColor = Color.Transparent,
                Children        = { GrdLeitor, StlLoader }
            };
        }