示例#1
0
 public override void OnLocationResult(LocationResult result)
 {
     if (result.Locations.Any())
     {
         var location = result.Locations.First();
     }
 }
示例#2
0
        public override void OnLocationResult(LocationResult result)
        {
            if (result.Locations.Any())
            {
                var location = result.Locations.First();
                if (_location != null)
                {
                    var delta = (long)location.DistanceTo(_location);
                    activity.distance = delta;
                    if (delta > 0)
                    {
                        activity.distanceparcourue += delta;

                        double km = (double)activity.distanceparcourue / (double)1000;
                        activity.textdistancecourse.Text = $"{km} Km";
                    }
                }
                _location                = location;
                activity.coordonnées     = location;
                activity.latitude2.Text  = activity.Resources.GetString(Resource.String.latitude_string, location.Latitude);
                activity.longitude2.Text = activity.Resources.GetString(Resource.String.longitude_string, location.Longitude);
            }
            else
            {
                activity.latitude2.SetText(Resource.String.location_unavailable);
                activity.longitude2.SetText(Resource.String.location_unavailable);
            }
        }
 private void OnInterstitialCloseResult(LocationResult result)
 {
     popupHandle.Closed.RemoveListener(OnInterstitialCloseResult);
     //soundManager.UnPauseAllLayers();
     interstitialDoneSignal.Dispatch(result);
     Release();
 }
示例#4
0
        public void FromLocationResultToAddressInfoConverter_HouseNumberWithLetters()
        {
            string       houseNumber       = string.Empty;
            const string buildingName      = "145C";
            const string streetDescription = "The Road";

            string[] addressLines = { "145C", "145 The Road" };

            var locationResult = new LocationResult()
            {
                HouseNumber        = houseNumber,
                BuildingName       = buildingName,
                AddressLines       = addressLines,
                StreetDescription  = streetDescription,
                PostTown           = TEST_CITY,
                AdministrativeArea = TEST_COUNTY,
                Postcode           = TEST_POSTCODE,
                UPRN = TEST_UPRN
            };

            var result = Mapper.Map <AddressInfoViewModel>(locationResult);

            Assert.AreEqual(houseNumber, result.HouseNumber);
            Assert.AreEqual(buildingName + " " + streetDescription, result.AddressLine1);
            Assert.AreEqual(string.Empty, result.AddressLine2);
            Assert.AreEqual(TEST_CITY, result.City);
            Assert.AreEqual(TEST_COUNTY, result.County);
            Assert.AreEqual(TEST_POSTCODE, result.Postcode);
            Assert.AreEqual(TEST_UPRN, result.UPRN);
        }
示例#5
0
        public void FromLocationResultToAddressInfoConverter_SameCityAndCounty()
        {
            string administrativeArea = "Leeds";
            string postTown           = "Leeds";

            var locationResult = new LocationResult()
            {
                HouseNumber        = TEST_HOUSE_NUMBER,
                AddressLines       = new[] { TEST_ADDRESS_LINE_1, TEST_ADDRESS_LINE_2 },
                PostTown           = postTown,
                AdministrativeArea = administrativeArea,
                Postcode           = TEST_POSTCODE,
                UPRN = TEST_UPRN
            };

            var result = Mapper.Map <AddressInfoViewModel>(locationResult);

            Assert.AreEqual(TEST_HOUSE_NUMBER, result.HouseNumber);
            Assert.AreEqual(TEST_ADDRESS_LINE_1, result.AddressLine1);
            Assert.AreEqual(TEST_ADDRESS_LINE_2, result.AddressLine2);
            Assert.AreEqual(postTown, result.City);
            Assert.AreEqual(string.Empty, result.County);
            Assert.AreEqual(TEST_POSTCODE, result.Postcode);
            Assert.AreEqual(TEST_UPRN, result.UPRN);
        }
示例#6
0
 void OnLocationClosed(LocationResult result)
 {
     popupHandle.Closed.RemoveListener(OnLocationClosed);
     Debug.Log("ShowSessionStartCommand - SessionStart Location closed");
     //soundManager.UnMuteAllLayers();
     ShowBanners();
 }
示例#7
0
 public override void OnLocationResult(LocationResult result)
 {
     foreach (var location in result.Locations)
     {
         this.OnLocationChanged(location);
     }
 }
示例#8
0
 public override void OnReceive(Context context, Intent intent)
 {
     try
     {
         if (intent != null)
         {
             string action = intent.Action;
             if (action.Equals(ACTION_PROCESS_LOCATION))
             {
                 LocationResult result = LocationResult.ExtractResult(intent);
                 if (result != null)
                 {
                     var location        = result.LastLocation;
                     var location_string = new StringBuilder("" + location.Latitude)
                                           .Append("/").Append(location.Longitude).ToString();
                     try
                     {
                         MainActivity.GetInstance().currentLocation(location_string);
                     }
                     catch (Exception)
                     {
                         //Toast.MakeText(context, location_string, ToastLength.Short).Show();
                     }
                 }
             }
         }
     }
     catch (Exception ex)
     {
     }
 }
 private void Init()
 {
     cps        = new ClosestPointsStrategy();
     calculator = new AverageClosestDistanceLocationCalculator(cps);
     result     = new LocationResult(new Point(-1, -1), Precision.NoTag);
     simPoint   = new SimPointDisplay(new Point(-1, -1), backgr);
 }
示例#10
0
        public override async void OnLocationResult(LocationResult result)///1111
        {
            base.OnLocationResult(result);

            StaticUser.Latitude  = result.LastLocation.Latitude;
            StaticUser.Longitude = result.LastLocation.Longitude;

            // Получаю информацию о клиенте.
            GPSLocationModel gpsLocation = new GPSLocationModel
            {
                UserId = StaticUser.UserId,
                Lat1   = StaticUser.Latitude,
                Lon1   = StaticUser.Longitude
            };

            var myHttpClient = new HttpClient();
            var uri          = new Uri("http://geometry.tmc-centert.ru/api/serviceapi/setuserlocation");

            //json структура.
            var formContent = new FormUrlEncodedContent(new Dictionary <string, string>
            {
                { "UserId", gpsLocation.UserId },
                { "Lon1", gpsLocation.Lon1.ToString() },
                { "Lat1", gpsLocation.Lat1.ToString() }
            });

            HttpResponseMessage response = await myHttpClient.PostAsync(uri.ToString(), formContent);
        }
示例#11
0
        public override void OnReceive(Context context, Intent intent)
        {
            if (intent != null)
            {
                string action = intent.Action;
                if (action.Equals(ACTION_PROCESS_LOCATION))
                {
                    LocationResult result = LocationResult.ExtractResult(intent);
                    if (result != null)
                    {
                        var location = result.LastLocation;

                        try
                        {
                            //when app in foreground
                            if (!StaticTask.IsStoppedGeo)
                            {
                                PostGeoData(location);
                            }
                            else
                            {
                                _gpsService = new GPSService(context);
                            }
                            _gpsService.RemoveLocation();
                        }
                        catch (Exception ex)
                        {
                            //when app is killed
                        }
                    }
                }
            }
        }
        public override void OnLocationResult(LocationResult result)
        {
            try
            {
                using var otherRealm = DatabaseHelper.GetDatabaseInstance();

                if (result.LastLocation != null)
                {
                    otherRealm.Write(() =>
                    {
                        otherRealm.Add(new AlertRealm
                        {
                            Id        = "1",
                            Event     = "location",
                            Date      = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"),
                            Latitude  = result.LastLocation.Latitude,
                            Longitude = result.LastLocation.Longitude
                        });
                    });
                }
            }
            catch (Exception e)
            {
                //Crashes.TrackError(e);
            }
        }
示例#13
0
        private async Task GetLocation()
        {
            latitude      = 0;
            longitude     = 0;
            errorLocation = null;

            bool permisionGranted = await PermissionValidator.LazyCheckLocationPermissions();

            if (permisionGranted)
            {
                LocationResult result = await LocationManager
                                        .Shared()
                                        .FindLocation(cached: false);

                if (result.IsSuccess && result.Position != null)
                {
                    latitude  = result.Position.Latitude;
                    longitude = result.Position.Longitude;
                    return;
                }
                errorLocation = result.Msg;
                return;
            }
            errorLocation = "Permisos de ubicación no otorgados";
        }
示例#14
0
        private void MouseDownSideButton(LocationResult where)
        {
            int delta = 0;

            switch (where)
            {
            case LocationResult.SideButton1:
                delta = -SmallChange;
                wlSideButton1.State = GMButtonState.Pressed;
                break;

            case LocationResult.SideButton2:
                wlSideButton2.State = GMButtonState.Pressed;
                delta = SmallChange;
                break;

            case LocationResult.AfterMiddleButton:
                delta = LargeChange;
                break;

            case LocationResult.BeforeMiddleButton:
                delta = -LargeChange;
                break;
            }
            if (delta != 0)
            {
                ValueAdd(delta);
            }
        }
示例#15
0
        public override void OnReceive(Context context, Intent intent)
        {
            if (!intent.Action.Equals(GpsManagerImpl.IntentAction))
            {
                return;
            }

            var result = LocationResult.ExtractResult(intent);

            if (result == null)
            {
                return;
            }

            this.Execute(async() =>
            {
                var gpsDelegate = ShinyHost.Resolve <IGpsDelegate>();
                foreach (var location in result.Locations)
                {
                    var reading = new GpsReading(location);
                    readingSubject.OnNext(reading);
                    if (gpsDelegate != null)
                    {
                        await gpsDelegate
                        .OnReading(reading)
                        .ConfigureAwait(false);
                    }
                }
            });
        }
示例#16
0
 public override async void OnReceive(Context context, Intent intent)
 {
     if (intent != null)
     {
         string action = intent.Action;
         if (action.Equals(ACTION_PROCESS_LOCATION))
         {
             LocationResult result = LocationResult.ExtractResult(intent);
             if (result != null)
             {
                 var      location = result.LastLocation;
                 Location pwsz     = new Location("PWSZ")
                 {
                     Latitude  = 49.609080,
                     Longitude = 20.704225
                 };
                 float[] results = new float[3];
                 Location.DistanceBetween(location.Latitude, location.Longitude, pwsz.Latitude, pwsz.Longitude, results);
                 var distance = results[0];
                 if (distance < 200)
                 {
                     await WebApiDataController.SetSendNotificationsAsync(true);
                 }
                 else
                 {
                     await WebApiDataController.SetSendNotificationsAsync(false);
                 }
             }
         }
     }
 }
        private void HandleShowResult(LocationResult result)
        {
            // if(result.success)
            // {
            //  if(bannerAds.IsShowing)
            //  {
            //      bannerAds.Hide();
            //      bannersWereShown = true;
            //  }
            //
            //  popupHandle.Closed.AddListener(HandleCloseResult);
            // }
            // else
            // {
            //  Release();
            // }

            if (!result.success)
            {
                return;
            }

            if (bannerAds.IsShowing)
            {
                bannerAds.Hide();
                bannersWereShown = true;
            }
        }
示例#18
0
 public override void OnLocationResult(LocationResult result)
 {
     if (result.Locations.Any())
     {
         var location = result.Locations.First();
         Console.WriteLine($"Location: {location}");
     }
 }
 public override void OnLocationResult(LocationResult result)
 {
     base.OnLocationResult(result);
     this.activity.RunOnUiThread(() => {
         this.posMarker.Position = new LatLng(result.LastLocation.Latitude, result.LastLocation.Longitude);
         this.gmap.AnimateCamera(CameraUpdateFactory.NewLatLng(this.posMarker.Position));
     });
 }
示例#20
0
 public override void OnLocationResult(LocationResult result)
 {
     if (result.Locations.Any())
     {
         var location = result.Locations.First();
         Lighthouse.SendGPSLocationUpdate(location.Latitude, location.Longitude, location.Altitude, location.Accuracy, location.Accuracy);
     }
 }
示例#21
0
        public override void OnLocationResult(LocationResult locationResult)
        {
            base.OnLocationResult(locationResult);

            Activity.mCurrentLocation = locationResult.LastLocation;
            Activity.mLastUpdateTime  = DateFormat.TimeInstance.Format(new Date());
            Activity.UpdateLocationUi();
        }
示例#22
0
            public override void OnLocationResult(LocationResult result)
            {
                base.OnLocationResult(result);
                StartLocationCall.UserLastLocation = result.LastLocation;

                //Console.WriteLine("Güncellendiiiiiiiiiiiiiii");
                //Toast.MakeText(AnaSayfaBaseFragment1, "Güncellendiiiiiiiiiiiiiii", ToastLength.Long).Show();
            }
示例#23
0
 public override void OnLocationResult(LocationResult result)
 {
     if (result.Locations.Any())
     {
         var location = result.Locations.First();
         Log.Debug("Sample", "The latitude is :" + location.Latitude);
     }
 }
 /*
  * Redirect location updates to the event
  */
 public void OnLocationUpdate(LocationResult result)
 {
     if (result == null)
     {
         LocationUpdated?.Invoke(this, null);
         return;
     }
     LocationUpdated?.Invoke(this, new LocationEventArgs(result.LastLocation.Longitude, result.LastLocation.Latitude));
 }
示例#25
0
 public override void OnLocationResult(LocationResult result)
 {
     if (result.Locations.Count != 0)
     {
         CurrentLocation?.Invoke(this, new OnLocationCapturedEventArgs {
             location = result.Locations[0]
         });
     }
 }
示例#26
0
 public override void OnLocationResult(LocationResult result)
 {
     if (result.Locations.Count != 0)
     {
         MyLocation?.Invoke(this, new OnLocationCaptionEventArgs {
             Location = result.Locations[0]
         });
     }
 }
示例#27
0
        private void PopupFailed()
        {
            var result = new LocationResult {
                location = Location,
                success  = false
            };

            OnLocationShown(result);
        }
 public override void OnLocationResult(LocationResult result)
 {
     if (!result.Locations.Any())
     {
         return;
     }
     _locationEvents.OnLocationRequested(new LocationEventArgs {
         Location = result.Locations.First()
     });
 }
示例#29
0
        private void OnLocationLoaded(LocationResult result)
        {
            if (result.location != _location)
            {
                return;
            }

            Debug.LogFormat("PopupHandle for location: {0} - location was loaded", _location);
            locationLoaded = true;
        }
        private void OnLocationClosed(LocationResult result)
        {
            Debug.Log(String.Format("MoreAppsButtonView.OnLocationClosed {0} - Refreshing more apps button visibility", result.location.ToString()));

            // Refresh the button visibility when any location that is not more apps is closed
            if (result.location != ApplicationLocation.MoreApps)
            {
                RefreshButtonVisibility();
            }
        }
示例#31
0
        private static LocationResult CreateLocationResult(XmlNode resultNode, int index)
        {
            var locationResult = new LocationResult();
            try
            {
                var formattedAddressNode = resultNode.SelectSingleNode("formatted_address");
                var geometryNode = resultNode.SelectSingleNode("geometry");
                var locationNode = geometryNode.SelectSingleNode("location");
                var latitude = locationNode.SelectSingleNode("lat").InnerText;
                var longitude = locationNode.SelectSingleNode("lng").InnerText;

                locationResult.FormattedAddress = formattedAddressNode != null ? formattedAddressNode.InnerText : string.Empty;
                locationResult.Latitude = Double.Parse(latitude);
                locationResult.Longitude = Double.Parse(longitude);
                locationResult.Index = index;
            }
            catch
            {
                return null;
            }
            return locationResult;
        }
示例#32
0
 private void MouseDownSideButton(LocationResult where)
 {
     int delta = 0;
     switch (where)
     {
         case LocationResult.SideButton1:
             delta = -SmallChange;
             //wlSideButton1.State = GMButtonState.Pressed;
             break;
         case LocationResult.SideButton2:
             //wlSideButton2.State = GMButtonState.Pressed;
             delta = SmallChange;
             break;
         case LocationResult.AfterMiddleButton:
             delta = LargeChange;
             break;
         case LocationResult.BeforeMiddleButton:
             delta = -LargeChange;
             break;
     }
     if (delta != 0)
     {
         ValueAdd(delta);
     }
 }
示例#33
0
 public void SetSource(LocationResult selectedLocation)
 {
     lockButton.IsChecked = true;
     if (selectedLocation == null)
         ChromBrowser.ExecuteJavascript(string.Format("AddSource()"), "");
     else
         ChromBrowser.ExecuteJavascript(string.Format("SetSource({0},{1})", selectedLocation.Latitude, selectedLocation.Longitude), "");
 }
示例#34
0
 public LocationRadio(LocationResult locationResult)
 {
     this.InitializeComponent();
     Location = locationResult;
     radioButton.Checked += ButtonChecked;
 }
		public override void OnLocationResult (LocationResult result)
		{
			_owner.OnLocationUpdated (result.LastLocation);
		}
示例#36
0
 protected override void OnMouseUp(MouseEventArgs e)
 {
     base.OnMouseUp(e);
     if (e.Button == System.Windows.Forms.MouseButtons.Left)
     {
         isMouseDownInMiddleButton = false;
         isMouseDownInSideButton = false;
         sideButtonDownWhere = LocationResult.NoWhere;
         mouseDownTimer.Enabled = false;
         mouseDownTimer.Interval = TIMER_INTERVAL_SLOW;
     }
 }
示例#37
0
 private void DoOnMouseDown(Point p)
 {
     LocationResult where = CheckLocation(p);
     if (where == LocationResult.MiddleButton)
     {
         isMouseDownInMiddleButton = true;
         middleButtonMovePoint = p;
         //wlMiddleButton.State = GMButtonState.Pressed;
     }
     else if (where != LocationResult.NoWhere)
     {
         isMouseDownInSideButton = true;
         sideButtonDownWhere = where;
         sideButtonDownPoint = p;
         MouseDownSideButton(where);
         mouseDownTimer.Enabled = true;
     }
 }