Esempio n. 1
0
        public MapPage(ISampleBase sample, Func <MapView?, MapClickedEventArgs, bool>?c = null)
        {
            InitializeComponent();
            Refs.AddRef(this);
            Refs.AddRef(mapView);

            Title = sample.Name;

            mapView.RotationLock          = false;
            mapView.UnSnapRotationDegrees = 30;
            mapView.ReSnapRotationDegrees = 5;

            mapView.PinClicked += OnPinClicked;
            mapView.MapClicked += OnMapClicked;

            Compass.ReadingChanged += Compass_ReadingChanged;

            mapView.MyLocationLayer.UpdateMyLocation(new UI.Forms.Position());
            mapView.MyLocationLayer.CalloutText = "My location!\n";
            mapView.MyLocationLayer.Clicked    += MyLocationClicked;

            mapView.Renderer.WidgetRenders[typeof(CustomWidget.CustomWidget)] = new CustomWidgetSkiaRenderer();

            _ = Task.Run(() => StartGPSAsync());

            try
            {
                if (!Compass.IsMonitoring)
                {
                    Compass.Start(SensorSpeed.Default);
                }
            }
            catch (Exception) { }

            _ = Task.Run(async() =>
            {
                try
                {
                    await sample.SetupAsync(mapView);
                }
                catch (Exception e)
                {
                    Logger.Log(LogLevel.Error, e.Message, e);
                }
            });

            Clicker = c;
        }
Esempio n. 2
0
        private void LeakAction_Clicked(object sender, EventArgs e)
        {
            string report = Refs.Inspect();

            NavigateToPage(new LeaksPage(report));
        }