Esempio n. 1
0
        public MainPage()
        {
            State = MainPageStatus.ShowMap;
            InitializeComponent();
            Task.Run(async() =>
            {
                SKCanvasView canvasViewRecordLbl  = new SKCanvasView();
                canvasViewRecordLbl.PaintSurface += OnCanvasViewPaintSurface;
                gridMenu.Children.Add(canvasViewRecordLbl, 2, 0);

                var locator  = CrossGeolocator.Current;
                var position = await locator.GetLastKnownLocationAsync();
                if (position == null)
                {
                    position = await locator.GetPositionAsync(new TimeSpan(10000));
                }
                map.MoveToRegion(MapSpan.FromCenterAndRadius(new Position(position.Latitude, position.Longitude),
                                                             Distance.FromMeters(500)));
                map.MapClicked      += OnMapClicked;
                map.PropertyChanged += OnMapChangeProperty;
                mapChangers          = new List <object>();
                locker = new object();
            });
            NavigationPage.SetHasNavigationBar(this, false);
        }
Esempio n. 2
0
        async void OnRecordClicked(object sender, EventArgs e)
        {
            var locator  = CrossGeolocator.Current;
            var position = await locator.GetPositionAsync(new TimeSpan(10000));

            map.MoveToRegion(MapSpan.FromCenterAndRadius(new Position(position.Latitude - 0.0015, position.Longitude),
                                                         Distance.FromMeters(150)));

            gridMenu.Children.ForEach(x => x.IsEnabled = false);
            State = MainPageStatus.MakeRecord;
            var recorderView = new Recorder()
            {
                Position = new Position(position.Latitude, position.Longitude)
            };

            relBox.HeightRequest = gridMenu.Height + (MapPage.Height - gridMenu.Height) / 2;
            relBox.Children.Add(recorderView
                                , Constraint.Constant(0),
                                Constraint.Constant(0),
                                Constraint.RelativeToParent((parent) => parent.Width),
                                Constraint.RelativeToView(gridMenu, (parent, menu) =>
            {
                return(parent.HeightRequest - menu.Height);
            })
                                );
            await recorderView.StartRecord();

            recorderView.PageState    = State;
            recorderView.RecordReady += OnRecordReady;
        }
Esempio n. 3
0
        async void OnPinClicked(object sender, PinClickedEventArgs e)
        {
            map.PropertyChanged -= OnMapChangeProperty;
            var pin = sender as PinWithEntity;

            pin.Label = "";
            var   d    = Task.Delay(700);
            var   recs = map.Pins.Where(p => pin.Position.Distance(p.Position) <= 90).Select(p => (p as PinWithEntity).Entity as Record).OrderBy(x => pin.Position.Distance(x.Point));
            var   len  = recs.Count();
            await d;
            var   position = pin.Position;

            map.MoveToRegion(MapSpan.FromCenterAndRadius(new Position(position.Latitude - 0.0015, position.Longitude),
                                                         Distance.FromMeters(150)));
            State = MainPageStatus.ShowRecord;
            var playerView = new RecordPlayer(recs);

            relBox.HeightRequest = gridMenu.Height + (MapPage.Height - gridMenu.Height) / 2;
            relBox.Children.Add(playerView
                                , Constraint.Constant(0),
                                Constraint.Constant(0),
                                Constraint.RelativeToParent((parent) => parent.Width),
                                Constraint.RelativeToView(gridMenu, (parent, menu) =>
            {
                return(parent.HeightRequest - menu.Height);
            })
                                );

            map.PropertyChanged += OnMapChangeProperty;
        }
Esempio n. 4
0
 async void OnMapClicked(object sender, MapClickedEventArgs e)
 {
     if (State != MainPageStatus.ShowMap)
     {
         var trash = relBox.Children.Where(x => x.ClassId != "def");
         trash.ToList().ForEach(x => relBox.Children.Remove(x));
         State = MainPageStatus.ShowMap;
         gridMenu.Children.ForEach(x => x.IsEnabled = true);
     }
     var position = map.VisibleRegion;
 }