Inheritance: System.Web.UI.Page
Exemplo n.º 1
0
        /// <summary>
        /// 坐标系转换
        /// </summary>
        /// <param name="IN"></param>
        /// <param name="T"></param>
        /// <param name="OUT"></param>
        public LocationMap Calculation(LocationMap IN, CoordinateTransformation T)
        {
            LocationMap Loc = new LocationMap();


            return(Loc);
        }
Exemplo n.º 2
0
        /// <summary>
        ///  极坐标系   笛卡尔坐标系
        /// </summary>
        /// <param name="laser"></param>
        /// <param name="car"></param>
        public LocationMap Calculation(LocationMap laser)
        {
            LocationMap Tran = new LocationMap();


            return(Tran);
        }
Exemplo n.º 3
0
        /// <summary>
        /// Format error string
        /// </summary>
        /// <param name="diagnostic">Diagnostic message</param>
        public string GetErrorString(Diagnostic diagnostic, LocationMap locationMap)
        {
            DiagnosticSeverity errorSeverity = diagnostic.Severity;
            int    errorCode    = diagnostic.Code;
            var    errorSpan    = diagnostic.Location.SourceSpan; //get error Roslyn's span
            var    arguments    = diagnostic.Arguments;
            string errorMessage = errorList.GetErrorMessage(diagnostic, arguments);

            if (errorMessage.Length > 0)
            {
                errorMessage = ": " + errorMessage;
            }

            var(errorSpanStart, errorSpanEnd) = (errorSpan.Start, errorSpan.End);
            try
            {
                var(locationStart, locationEnd) = (locationMap[errorSpanStart], locationMap[errorSpanEnd]);
                LexLocation errorLocation = new LexLocation(locationStart, locationEnd);
                return($"{errorLocation} {errorSeverity} {errorCode}{errorMessage}");
            }
            catch
            {
                //when we can't get source position
                return($"{errorSeverity} {errorCode}{errorMessage}");
            }
        }
Exemplo n.º 4
0
        /// <summary>
        /// 从匹配完成的 局部坐标系中选取 4 个合适点 用于计算三点定位   1个做验证
        /// </summary>
        /// <param name="IN"></param>
        /// <param name="OUT"></param>
        public LocationMap Calculation(LocationMap IN)
        {
            LocationMap Loc = new LocationMap();


            return(Loc);
        }
Exemplo n.º 5
0
        public void Movemap(Position position)
        {
            var center = new Xamarin.Forms.Maps.Position(position.Latitude, position.Longitude);
            var span   = new Xamarin.Forms.Maps.MapSpan(center, 1, 1);

            LocationMap.MoveToRegion(span);
        }
Exemplo n.º 6
0
        /// <summary>
        /// 车体局部坐标地图 匹配 全局地图   输出在全局坐标下的新坐标系
        /// </summary>
        /// <param name="locationMap"></param>
        /// <param name="globleMap"></param>
        /// <param name="OUT"></param>
        public LocationMap Calculation(LocationMap locationMap, GlobleMap globleMap)
        {
            LocationMap Loc = new LocationMap();


            return(Loc);
        }
Exemplo n.º 7
0
        private void MoveMap(Plugin.Geolocator.Abstractions.Position position)
        {
            var center = new Position(position.Latitude, position.Longitude);
            var span   = new Xamarin.Forms.Maps.MapSpan(center, 1, 1);

            LocationMap.MoveToRegion(span);
        }
Exemplo n.º 8
0
        private void SetMapStartPoint()
        {
            var center = new Xamarin.Forms.Maps.Position(ChosenLocation.Latitude, ChosenLocation.Longitude);
            var span   = new Xamarin.Forms.Maps.MapSpan(center, 2, 2);

            LocationMap.MoveToRegion(span);
        }
Exemplo n.º 9
0
        public MapPage()
        {
            InitializeComponent();

            BindingContext = new MapViewModel();
            LocationMap.MoveToRegion(MapSpan.FromCenterAndRadius(new Position(51.661518, 39.190122), Distance.FromMiles(5)));
        }
Exemplo n.º 10
0
        private void Locator_PositionChanged(object sender, Plugin.Geolocator.Abstractions.PositionEventArgs e)
        {
            var center = new Xamarin.Forms.Maps.Position(e.Position.Latitude, e.Position.Longitude);
            //var span = new Xamarin.Forms.Maps.MapSpan(center, 1, 1);
            //locationMap.MoveToRegion(span);

            //zoom differently
            double zoomLevel      = 16;
            double latlongDegrees = 360 / (Math.Pow(2, zoomLevel));
            var    span           = new Xamarin.Forms.Maps.MapSpan(center, latlongDegrees, latlongDegrees);

            LocationMap.MoveToRegion(span);

            var elapsedDistanceNumber = Location.CalculateDistance(
                ChosenLocation.Latitude,
                ChosenLocation.Longitude,
                e.Position.Latitude, e.Position.Longitude,
                DistanceUnits.Kilometers);

            //ElapsedDistanceMeters = "Distance moved " + elapsedDistanceNumber * 1000 + " meters";

            //var elapsedDistanceMetersDouble = elapsedDistanceNumber * 1000;

            ElapsedDistanceMeters = elapsedDistanceNumber * 1000;



            CheckDistanceViolation();
        }
Exemplo n.º 11
0
 public BadgeData(GroupMap groupMap, LocationMap locationMap, string badgeData)
 {
     _groupMap    = groupMap;
     _locationMap = locationMap;
     Parse(badgeData);
     _swipeList.Process();
 }
Exemplo n.º 12
0
        /// <summary>
        /// Build location map
        /// </summary>
        /// <param name="root">Root of Roslyn tree</param>
        /// <param name="annotations">List of location annotations</param>
        /// <returns>Matching of Roslyn's positions and locations in source code</returns>
        static LocationMap GetLocationMap(SyntaxNode root, List <SyntaxAnnotation> annotations)
        {
            LocationMap result = new LocationMap();

            foreach (var annotation in annotations)
            {
                var node = root.GetAnnotatedNodes(annotation).FirstOrDefault();
                if (node == null)
                {
                    continue;
                }

                var nodeSpan            = node.FullSpan;
                var nodeAnnotationParts = annotation.Data.Split(';');

                if (!result.ContainsKey(nodeSpan.Start))
                {
                    result.Add(nodeSpan.Start, ParseAnnotationPart(nodeAnnotationParts[0]));
                }
                if (!result.ContainsKey(nodeSpan.End))
                {
                    result.Add(nodeSpan.End, ParseAnnotationPart(nodeAnnotationParts[1]));
                }
            }

            return(result);
        }
Exemplo n.º 13
0
        /// <summary>
        /// 三点定位算法
        /// </summary>
        /// <param name="A"></param>
        /// <param name="B"></param>
        /// <param name="C"></param>
        /// <param name="OUT"></param>

        public LocationMap Calculation(LocationMap locationMap)
        {
            LocationMap carpLocationMap = new LocationMap();



            return(carpLocationMap);
        }
Exemplo n.º 14
0
 /// <summary>
 /// Center map code.
 /// </summary>
 private void CenterMap()
 {
     if (Pushpins != null)
     {
         var locations = Pushpins.Select(model => model.Location);
         LocationMap.SetView(LocationRect.CreateLocationRect(locations));
     }
 }
Exemplo n.º 15
0
        protected async override void OnAppearing()
        {
            base.OnAppearing();
            try
            {
                var PermissionStatus = await CrossPermissions.Current.CheckPermissionStatusAsync(Permission.Location);

                if (PermissionStatus != PermissionStatus.Granted)
                {
                    if (await CrossPermissions.Current.ShouldShowRequestPermissionRationaleAsync(Permission.Location))
                    {
                        var Result = await CrossPermissions.Current.RequestPermissionsAsync(Permission.Location);

                        if (Result.ContainsKey(Permission.Location))
                        {
                            PermissionStatus          = Result[Permission.Location];
                            LocationMap.IsShowingUser = true;
                        }
                        else
                        {
                            await DisplayAlert("Location Permission Denied ", "We are unable to open the map without your location", "Ok");

                            LocationMap.IsShowingUser = false;
                        }
                    }

                    else
                    {
                        await DisplayAlert("Location Permission Denied ", "We are unable to open the map without your location", "Ok");

                        LocationMap.IsShowingUser = false;
                    }
                }
                else
                {
                    LocationMap.IsShowingUser = true;
                }

                var Locator  = CrossGeolocator.Current;
                var Position = await Locator.GetPositionAsync();

                Locator.PositionChanged += Locator_PositionChanged;
                await Locator.StartListeningAsync(TimeSpan.FromSeconds(0), 100);

                LocationMap.MoveToRegion(new Xamarin.Forms.Maps.MapSpan(new Xamarin.Forms.Maps.Position(Position.Latitude, Position.Longitude), .005f, .005f));
                using (SQLiteConnection Connection = new SQLiteConnection(App.DBLocation))
                {
                    Connection.CreateTable <TravelPost>();
                    var TravelPosts = Connection.Table <TravelPost>().ToList();
                    DisplayInMap(TravelPosts);
                }
            }
            catch (Exception)
            {
                OnDisappearing();
            }
        }
Exemplo n.º 16
0
        public ActionResult UpdateLocation(long LocationID)
        {
            LocationVM      updateVM = new LocationVM();
            ILocationInfoDO location = _LocationAccess.ViewLocationByID(LocationID);

            updateVM.Location = LocationMap.MapDOtoPO(location);

            return(View(updateVM));
        }
Exemplo n.º 17
0
        public ActionResult GetLadLon(string address)
        {
            GeoCoordinate LadLonAddress = GetLatitudeLongitudeFromAddress.FindLocation(address);
            LocationMap   Location      = new LocationMap {
                Latitude = LadLonAddress.Latitude, Longitude = LadLonAddress.Longitude, Description = "Hallo", Title = "Blabla"
            };

            return(Json(Location, JsonRequestBehavior.AllowGet));
        }
Exemplo n.º 18
0
        private async void CardsView_OnItemAppearing(CardsView view, ItemAppearingEventArgs args)
        {
            _viewModel.IsZoomed = false;
            _viewModel.IsBusy   = true;

            if (_viewModel.CanLoadMore && _viewModel.CurrentIndex < 1)
            {
                await LoadNewer();
            }

            if (_viewModel.CanLoadMore && _viewModel.CurrentIndex > _viewModel.VideoItems.Count - 2)
            {
                await LoadOlder();
            }

            _viewModel.CurrentVideoViewModel = _viewModel.VideoItems[_viewModel.CurrentIndex];
            _viewModel.CurrentVideoId        = _viewModel.CurrentVideoViewModel.VideoId;
            await UpdateEditInfo();

            if (_viewModel.CurrentVideoViewModel.VideoTime != null && _viewModel.Progeny.BirthDay.HasValue)
            {
                DateTime picTimeBirthday = new DateTime(_viewModel.Progeny.BirthDay.Value.Ticks, DateTimeKind.Unspecified);

                PictureTime picTime = new PictureTime(picTimeBirthday, _viewModel.CurrentVideoViewModel.VideoTime, TimeZoneInfo.FindSystemTimeZoneById(_viewModel.Progeny.TimeZone));
                _viewModel.PicTimeValid = true;
                _viewModel.PicYears     = picTime.CalcYears();
                _viewModel.PicMonths    = picTime.CalcMonths();
                _viewModel.PicWeeks     = picTime.CalcWeeks();
                _viewModel.PicDays      = picTime.CalcDays();
                _viewModel.PicHours     = picTime.CalcHours();
                _viewModel.PicMinutes   = picTime.CalcMinutes();
            }

            LocationMap.Pins.Clear();
            if (!string.IsNullOrEmpty(_viewModel.CurrentVideoViewModel.Latitude) &&
                !string.IsNullOrEmpty(_viewModel.CurrentVideoViewModel.Longtitude))
            {
                LocationMap.IsVisible = true;
                bool latParsed = double.TryParse(_viewModel.CurrentVideoViewModel.Latitude, NumberStyles.Any, CultureInfo.GetCultureInfo("en-US"), out double lat);
                bool lonParsed = double.TryParse(_viewModel.CurrentVideoViewModel.Longtitude, NumberStyles.Any, CultureInfo.GetCultureInfo("en-US"), out double lon);
                if (latParsed && lonParsed)
                {
                    Position position = new Position(lat, lon);
                    Pin      pin      = new Pin();
                    pin.Position = position;
                    pin.Label    = _viewModel.CurrentVideoViewModel.Location;
                    pin.Type     = PinType.SavedPin;
                    LocationMap.Pins.Add(pin);
                    LocationMap.MoveToRegion(MapSpan.FromCenterAndRadius(position, Distance.FromKilometers(2)));
                }
            }
            else
            {
                LocationMap.IsVisible = false;
            }
            _viewModel.IsBusy = false;
        }
Exemplo n.º 19
0
        public void GivenRecognizedLocationName_WhenAskingForLocation_ThenItShouldReturnCorrectValue()
        {
            // arrange
            LocationMap locationMap = new LocationMap(LocationName.Bedrock);

            // act
            ILocation location = locationMap.DomainLocation();

            // assert
            location.Should().BeOfType <BedrockLocation>();
        }
Exemplo n.º 20
0
        protected override void Context()
        {
            var venueName       = new LocationName(LOCATION_NAME);
            var address         = new Address(STREET_NUMBER, STREET, CITY, POSTAL_CODE);
            var map             = new LocationMap(new Uri(MAP_URI));
            var locationContact = new LocationContact(new ContactName(CONTACT_NAME),
                                                      new EmailAddress(EMAIL_ADDRESS),
                                                      new PhoneNumber(PHONE_NUMBER));

            location = new LocationFactory().Create(venueName, address, map, locationContact);
        }
Exemplo n.º 21
0
        public Invoice Invoice()
        {
            ILocation domainLocation = new LocationMap(Enum.Parse <LocationName>(Location)).DomainLocation();

            foreach (ProductRequest product in Products)
            {
                _products = _orderStrategy.Add(product, domainLocation);
            }

            return(new Invoice(_products.Select(p => new LineItem(p.Description(), domainLocation.LocalizedPrice(p.Price()))).ToList()));
        }
Exemplo n.º 22
0
        private void SetMap(double latitude, double longitude)
        {
            var pin = new Pin()
            {
                Position = new Position(latitude, longitude),
                Label    = vm.Name
            };

            LocationMap.Pins.Add(pin);
            LocationMap.MoveToRegion(MapSpan.FromCenterAndRadius(new Position(latitude, longitude), Distance.FromMiles(0.3)));
        }
Exemplo n.º 23
0
        protected override void OnElementChanged(ElementChangedEventArgs <View> e)
        {
            base.OnElementChanged(e);

            if (e.OldElement != null)
            {
                var nativeMap = Control as MKMapView;
                nativeMap.GetViewForAnnotation           = null;
                nativeMap.OverlayRenderer                = null;
                nativeMap.CalloutAccessoryControlTapped -= OnCalloutAccessoryControlTapped;
                nativeMap.DidSelectAnnotationView       -= OnDidSelectAnnotationView;
                nativeMap.DidDeselectAnnotationView     -= OnDidDeselectAnnotationView;
            }

            if (e.NewElement != null)
            {
                formsMap  = (LocationMap)e.NewElement;
                nativeMap = Control as MKMapView;

                var circle = formsMap.Circle;
                nativeMap.OverlayRenderer = GetOverlayRenderer;


                if (circle.Position.Latitude != 0.0)
                {
                    _circle = MKCircle.Circle(new CoreLocation.CLLocationCoordinate2D(circle.Position.Latitude, circle.Position.Longitude), circle.Radius);
                    nativeMap.AddOverlay(_circle);
                }

                /* Listen for circle change events */
                MessagingCenter.Subscribe <CustomCircle>(this, "CircleChanged", (obj) =>
                {
                    if (_circle == null)
                    {
                        _circle = MKCircle.Circle(new CoreLocation.CLLocationCoordinate2D(obj.Position.Latitude, obj.Position.Longitude), obj.Radius);
                        nativeMap.AddOverlay(_circle);
                    }
                    else
                    {
                        nativeMap.RemoveOverlay(_circle);
                        _circle.Dispose();
                        _circle = MKCircle.Circle(new CoreLocation.CLLocationCoordinate2D(obj.Position.Latitude, obj.Position.Longitude), obj.Radius);
                        nativeMap.AddOverlay(_circle);
                    }
                });

                nativeMap.GetViewForAnnotation           = GetViewForAnnotation;
                nativeMap.CalloutAccessoryControlTapped += OnCalloutAccessoryControlTapped;
                nativeMap.DidSelectAnnotationView       += OnDidSelectAnnotationView;
                nativeMap.DidDeselectAnnotationView     += OnDidDeselectAnnotationView;
            }
        }
Exemplo n.º 24
0
        protected async override void OnAppearing()
        {
            base.OnAppearing();

            //var message = "You are directed to Map Page Upading Details";

            //DependencyService.Get<Imessage>().longTime(message);

            var locator = CrossGeolocator.Current;

            locator.PositionChanged += Locator_PositionChanged;

            //DateTime dt1 = DateTime.Now;
            //DateTime dt2 = DateTime.Now;
            //TimeSpan ts = dt1 - dt2;

            //await locator.StartListeningAsync(ts, 100);
            await locator.StartListeningAsync(TimeSpan.FromMinutes(0), 100);


            var postion = await locator.GetPositionAsync();

            //to avoid allredy listening exception here



            //var span = new Xama  rin.Forms.Maps.MapSpan(center, 2, 2);
            //var center = new Xamarin.Forms.Maps.Position(`position.Latitude,postion.Logitude);
            //LocationMap.MoveToRegion(span);


            LocationMap.MoveToRegion(new Xamarin.Forms.Maps.MapSpan(new Xamarin.Forms.Maps.Position(postion.Latitude, postion.Longitude), 2, 2));


            /*  using (SQLiteConnection conn = new SQLiteConnection(App.DatabaseLocation))
             * {
             *
             *    conn.CreateTable<Post>();
             *    var posts = conn.Table<Post>().ToList();
             *
             *    DisplayInMap(posts);
             *
             * }
             */
            //await locator.StopListeningAsync();
            //var posts = await App.MobileService.GetTable<Post>().Where(p => p.UserId == App.users.Id).ToListAsync();

            var posts = await Post.Read();

            DisplayInMap(posts);
        }
Exemplo n.º 25
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            // Set our view from the "main" layout resource
            SetContentView(Resource.Layout.HomePage);

            SupportToolbar toolBar = FindViewById <SupportToolbar>(Resource.Id.toolBar);


            mLocationMap = new LocationMap();
            mOSMMap      = new BaseOSMMap();
            mHome        = new Home();

            mapWithLabel   = new SampleWithMinimapItemizedOverlayWithFocus();
            mStackFragment = new Stack <SupportFragment>();
            var trans = SupportFragmentManager.BeginTransaction();

            trans.Add(Resource.Id.fragmentContainer, mLocationMap, "mainPage");
            trans.Add(Resource.Id.fragmentContainer, mOSMMap, "OSMMAP");
            trans.Add(Resource.Id.fragmentContainer, mapWithLabel, "MapWithLabel");
            trans.Add(Resource.Id.fragmentContainer, mHome, "Home");
            trans.Hide(mLocationMap);
            trans.Hide(mOSMMap);
            trans.Hide(mapWithLabel);
            trans.Commit();
            mCurrentFragment = mHome;//mMainPage;


            SetSupportActionBar(toolBar);

            SupportActionBar ab = SupportActionBar;

            ab.SetHomeAsUpIndicator(Resource.Drawable.ic_menu);
            ab.SetDisplayHomeAsUpEnabled(true);

            mDrawerLayout = FindViewById <DrawerLayout>(Resource.Id.drawer_layout);
            NavigationView navigationView = FindViewById <NavigationView>(Resource.Id.nav_view);


            if (navigationView != null)
            {
                SetUpDrawerContent(navigationView);
            }
            LogInModule lg               = new LogInModule();
            View        header           = navigationView.GetHeaderView(0);
            TextView    _userNameTXTVIEW = header.FindViewById <TextView>(Resource.Id.nav_userName);

            /*View view=navigationView.inflateHeaderView(R.layout.nav_header_main);*/
            _userNameTXTVIEW.Text = lg.GetUserName();
        }
Exemplo n.º 26
0
        private SelectList PopulateLocationsDDL()
        {
            List <ILocationInfoDO> databaseLocations = _LocationAccess.ViewAllLocations();
            List <LocationPO>      mappedLocations   = LocationMap.MapDOtoPO(databaseLocations);
            List <LocationPO>      locationList      = new List <LocationPO>();

            //add dummy location for "default" on dropdown, otherwise it sets to ACTUAL location
            locationList.Add(new LocationPO()
            {
                LocationID = 0, LocationName = " -- Please choose a Location --"
            });
            locationList.AddRange(mappedLocations);
            return(new SelectList(locationList, "LocationID", "LocationName"));
        }
Exemplo n.º 27
0
        public ActionResult AddLocation(LocationVM viewModel)
        {
            ActionResult oResponse = null;

            if (Session["UserName"] != null && (int)Session["UserLevel"] == 1)
            {
                if (ModelState.IsValid)
                {
                    try
                    {
                        ILocationInfoDO locationform = LocationMap.MapPOtoDO(viewModel.Location);
                        _LocationAccess.InsertLocation(locationform);
                    }
                    catch (Exception e)
                    {
                        if (e.Message.Contains("duplicate"))
                        {
                            viewModel.ErrorMessage = String.Format("There is already a {0} in the database.", viewModel.Location.LocationName);
                        }
                        else
                        {
                            viewModel.ErrorMessage = "We apologize but we were unable to handle your request at this time.";
                        }
                    }
                    finally
                    {
                        //nothing to do here
                    }
                    if (viewModel.ErrorMessage == null)
                    {
                        oResponse = RedirectToAction("ViewLocations", "Location");
                    }
                    else
                    {
                        oResponse = View(viewModel);
                    }
                }
                else
                {
                    oResponse = View(viewModel);
                }
            }
            else
            {
                oResponse = RedirectToAction("Login", "User");
            }
            return(oResponse);
        }
        protected override void OnAppearing()
        {
            base.OnAppearing();


            LocationMap.MoveToRegion(MapSpan.FromCenterAndRadius(new Position(_incident.GPSLatitude, _incident.GPSLongitude),
                                                                 Distance.FromKilometers(5)));

            var pin = new Pin
            {
                Position = new Position(_incident.GPSLatitude, _incident.GPSLongitude),
                Label    = _incident.Heading
            };

            LocationMap.Pins.Add(pin);
        }
Exemplo n.º 29
0
        /// <summary>
        /// Handles the map tap event. This event is not routed to the ViewModel because we need to
        /// directly use the map control's ability to convert a tap-point to an actual GeoCoordinate.
        /// Once we have the necessary GeoCoordinate data we route it to a RelayCommand in the ViewModel
        /// to handle all futher process required
        /// </summary>
        private void LocationMapOnTap(object sender, System.Windows.Input.GestureEventArgs e)
        {
            try
            {
                // Will the ViewModel allow us to change the RoundUp point, or does the user want to close
                // the map controls overlay?
                if (ViewModel.AllowRoundUpPointLocationChange)
                {
                    // Get tap point relative to the map control
                    var p = e.GetPosition(LocationMap);

                    // Ask the map to convert this to a GeoCoordinate
                    var roundUpPointGeoCoordinate = LocationMap.ConvertViewportPointToGeoCoordinate(p);

                    // Now ask the ViewModel to handle the details for creating the new RoundUp point.
                    // It will only do this if the user has previously requested setting a new RoundUp point
                    // using the StartSetNewRoundUpPointCommand menu option. This prevents map taps in normal usage
                    // from accidentally setting a new RoundUp point
                    ViewModel.SetNewRoundUpPointCommand.Execute(roundUpPointGeoCoordinate);
                }
                else if (ViewModel.ShowMapControlPanel)
                {
                    ViewModel.ShowMapControlPanelCommand.Execute(null);                                     // Hide the map control panel
                }
                else if (ViewModel.ShowShareUI)
                {
                    ViewModel.ShowSharePanelCommand.Execute(null);                             // Hide the share panel
                }
                else if (ViewModel.ShowAcceptInviteUI)
                {
                    ViewModel.CancelAcceptInviteCommand.Execute(null);                                    // Hide the share panel
                }
                else if (ViewModel.ShowInviteesUI)
                {
                    ViewModel.ShowInviteesPanelCommand.Execute(null);                                // Hide the invitees panel
                }
                else if (ViewModel.ShowDirectionsUI)
                {
                    ViewModel.ShowDirectionsPanelCommand.Execute(null);                                  // Hide the directions panel
                }
            }
            catch (Exception ex)
            {
                Logger.Log(ex, new StackFrame(0, true));
            }
        }
Exemplo n.º 30
0
        async private Task UpdateCamera()
        {
            var lastLocation = await Geolocation.GetLastKnownLocationAsync();

            if (lastLocation != null)
            {
                var lastPosition = new Position(lastLocation.Latitude, lastLocation.Longitude);
                LocationMap.InitialCameraUpdate = CameraUpdateFactory.NewPositionZoom(lastPosition, 15);
            }
            else
            {
                var request         = new GeolocationRequest(GeolocationAccuracy.Low);
                var currentLocation = await Geolocation.GetLocationAsync(request);

                var currentPosition = new Position(currentLocation.Latitude, currentLocation.Longitude);
                LocationMap.MoveToRegion(MapSpan.FromCenterAndRadius(currentPosition, Distance.FromMiles(0.1)));
            }
        }
Exemplo n.º 31
0
        public List<Point> findBestPath(LocationMap allLocations)
        {
            Point startPoint = allLocations.start.position;
            endPoint = allLocations.end.position;

            int vertical = Path.GetVerticalDirection(startPoint, endPoint);
            int horizontal = Path.GetHorizontalDirection(startPoint, endPoint);

            Path pathA = new Path(this, null, vertical);
            Path pathB = new Path(this, null, horizontal);
            Thread threadA = new Thread(new ThreadStart(pathA.findPath));
            threadA.Join();
            Thread threadB = new Thread(new ThreadStart(pathB.findPath));
            threadB.Join();

            List<Point> bestPath = new List<Point>();
            return bestPath;
        }