private void OnLocationUpdate(object sender, LocationEventArgs args) { Device dev = GetDevice(args.DeviceId); if (dev == null) { dev = new Device(args.DeviceId, "untitled", ""); Map map = GetMap(args.MapId); if (map != null) { map.Devices.Add(dev); } _devices.Add(dev); } dev.Location.MapId = args.MapId; dev.Location.X = args.X; dev.Location.Y = args.Y; if (_page == null) { return; } Action action = () => _page.UpdateDeviceLocation(dev); _page.Dispatcher.BeginInvoke(action); if (_ldapClient != null && !string.IsNullOrEmpty(dev.Number)) { _ldapClient.AsynDownloadPortrait(dev.Number); } }
public void ObtainMyLocation() { _locationManager = new CLLocationManager { DesiredAccuracy = CLLocation.AccuracyBest, DistanceFilter = CLLocationDistance.FilterNone }; _locationManager.LocationsUpdated += (object sender, CLLocationsUpdatedEventArgs e) => { var locations = e.Locations; var strLocation = locations[locations.Length - 1].Coordinate.Latitude.ToString(); strLocation = strLocation + "," + locations[locations.Length - 1].Coordinate.Longitude.ToString(); LocationEventArgs args = new LocationEventArgs { Latitude = locations[locations.Length - 1].Coordinate.Latitude, Longitude = locations[locations.Length - 1].Coordinate.Longitude }; LocationObtained(this, args); }; _locationManager.AuthorizationChanged += (object sender, CLAuthorizationChangedEventArgs e) => { if (e.Status == CLAuthorizationStatus.AuthorizedWhenInUse) { _locationManager.StartUpdatingLocation(); } }; _locationManager.RequestWhenInUseAuthorization(); }
public virtual bool SelectLocation(object sender, LocationEventArgs e) { bool result = false; if (e.Clear || (mCountry != null && !string.IsNullOrEmpty(e.Country))) { mCountry.ClearSelection(); ListItem country = mCountry.Items.FindByValue(e.Country); if (country != null) { country.Selected = true; Country_SelectedIndexChanged(sender, e); result = true; } } if (e.Clear || (mState != null && !string.IsNullOrEmpty(e.State))) { mState.ClearSelection(); ListItem state = mState.Items.FindByValue(e.State); if (state != null) { state.Selected = true; State_SelectedIndexChanged(sender, e); result = true; } } return(result); }
protected virtual void OnLocationsChanged(LocationEventArgs e) { if (LocationsChanged != null) { LocationsChanged(this, e); } }
protected virtual void OnCurrentLocationChanged(LocationEventArgs e) { if (CurrentLocationChanged != null) { CurrentLocationChanged(this, e); } }
public void onLocationDataAvailable(object sender, LocationEventArgs args) { string latitude = locationTask.latitude; string longitude = locationTask.longitude; this.statusBarTB.Text = "Data acquired..."; locationTask.stopWatcher(); String location = ""; if (!String.IsNullOrEmpty(latitude) && !String.IsNullOrEmpty(longitude)) { location = "location:{" + latitude + "," + longitude + "}"; } smsComposeTask.To = gestureData_i.DisplayName + "<" + gestureData_i.Number + ">"; // Mention here the phone number to whom the sms is to be sent smsComposeTask.Body = "I need help, " + location; // the string containing the sms body try { smsComposeTask.Show(); } catch (InvalidOperationException exception) { } this.statusBarTB.Text = ""; }
void ArrivedAtLocation(object sender, LocationEventArgs args) { if (args.LocationType == LocationType.Quary) { Animator.SetBool(A_IsLoading, true); // Play animation } }
protected void OnLocationChanged(LocationEventArgs args) { double distance = GetDistance(_currentLattitude, _currentLongitude, args.Latitude, args.Longitude); if (distance < DistanceFilter) { string q = string.Format("UPDATE {0} SET EndTime=@p1 WHERE Id=@p2" , Database.LocationsTable); Database.Current.ExecuteNonQuery(q, args.Time, _currentId); } else { string q = string.Format("INSERT INTO {0} VALUES(@p1, @p2, @p3, @p4, @p5, @p6, @p7, @p8, @p9)" , Database.LocationsTable); Guid guid = Guid.NewGuid(); Database.Current.ExecuteNonQuery(q, guid, args.Latitude, args.Longitude , args.Time, args.Time, args.Speed, args.Direction, args.SatellitesCount, args.Altitude); _currentId = guid; _currentLattitude = args.Latitude; _currentLongitude = args.Longitude; if ((DateTime.Now - _sendTime).TotalSeconds > SendInterval) { SendData(); _sendTime = DateTime.Now; } } }
void MyLocationTracker.ObtainMyLocation() { lm = new CLLocationManager(); lm.DesiredAccuracy = CLLocation.AccuracyBest; lm.DistanceFilter = CLLocationDistance.FilterNone; lm.LocationsUpdated += (object sender, CLLocationsUpdatedEventArgs e) => { var locations = e.Locations; var strLocation = locations[locations.Length - 1]. Coordinate.Latitude.ToString(); strLocation = strLocation + "," + locations[locations.Length - 1]. Coordinate.Longitude.ToString(); LocationEventArgs args = new LocationEventArgs(); args.lat = locations[locations.Length - 1]. Coordinate.Latitude; args.lng = locations[locations.Length - 1]. Coordinate.Longitude; locationObtained(this, args); }; lm.AuthorizationChanged += (object sender, CLAuthorizationChangedEventArgs e) => { if (e.Status == CLAuthorizationStatus.AuthorizedWhenInUse) { lm.StartUpdatingLocation(); } }; lm.RequestWhenInUseAuthorization(); }
void ArrivedAtLocation(object sender, LocationEventArgs args) { CurrentDecelerationSpeed = AccelerationSpeed * DecelerationMultiplier; ServiceLocator.GetVoiceoverService().PlaySound(SoundType.TruckSlowdown, 0); ServiceLocator.GetVoiceoverService().FadeOutSound(SoundType.TruckMovementSounds); ServiceLocator.GetVoiceoverService().PlaySound(SoundType.TruckEngineNeutral, .8f); }
private void OnLocationAdded(object sender, LocationEventArgs e) { LocationViewModel vm = new LocationViewModel(e.Location, this.repository); vm.PropertyChanged += this.OnLocationViewModelPropertyChanged; this.AllLocations.Add(vm); }
private void LocationsChanged(object sender, LocationEventArgs e) { if (e.NewLocations == null) { return; } UpdateLayers(e.NewLocations); }
// The method which fires the Event protected void OnPixelClicked(object sender, LocationEventArgs e) { var target = PixelClicked; if (target != null) { target(this, e); } }
/* * Handler for Location updates */ public virtual void LocationHandler(object sender, CLLocationsUpdatedEventArgs e) { if (LocationUpdated != null) { //fire event LocationUpdated with the location information as parameters LocationEventArgs arg = new LocationEventArgs(e.Locations[e.Locations.Length - 1].Coordinate.Longitude, e.Locations[e.Locations.Length - 1].Coordinate.Latitude); LocationUpdated(this, arg); } }
public void OnLocationChanged(CLLocationCoordinate2D location) { var args = new LocationEventArgs { Latitude = location.Latitude, Longitude = location.Longitude }; LocationChanged?.Invoke(this, args); }
private void OnLocationAdded(object sender, LocationEventArgs e) { LocationViewModel viewModel = new LocationViewModel(e.Location, repositorys); // delegate this.PropertyChanged += this.OnLocationViewModelPropertyChanged; this.AllLocations.Add(viewModel); }
private void onRequestIdentifyLocation(ICoordinate location) { EventHandler <LocationEventArgs> e = IdentifyLocationRequested; if (e != null) { LocationEventArgs args = new LocationEventArgs(location); e(this, args); } }
public void UnSelect() { LocationEventArgs args = new LocationEventArgs(); args.OldLocation = CurrentLocation; CurrentLocation = null; args.NewLocation = CurrentLocation; InnerLocations.Clear(); OnCurrentLocationChanged(args); }
void ArrivedAtLocation(object sender, LocationEventArgs args) { // Play the unload animation once the player's car has arrived at the Factory. if (args.LocationType == LocationType.Factory) { InternalRockModel.localScale = ServiceLocator.GetRockScale(); ServiceLocator.GetVoiceoverService().PlaySound(SoundType.TruckUnload, 0); PlayableDirector.Play(); } }
public void OnLocationChanged(Location location) { LocationEventArgs args = new LocationEventArgs() { lat = location.Latitude, lng = location.Longitude }; LocationObtained(this, args); }
protected override void LocationsChanged(object sender, LocationEventArgs e) { foreach (RhitLocation location in e.NewLocations) { if (location.Locations == null || location.Locations.Count <= 0) { continue; } LocationsController.Instance.AddBuilding(location); } }
public void SetLocations(List <RhitLocation> locations) { LocationEventArgs args = new LocationEventArgs(); args.OldLocations = Locations; Locations = locations; args.NewLocations = Locations; UpdateCollections(); OnLocationsChanged(args); }
//---fired whenever there is a change in location--- public void OnLocationChanged(Android.Locations.Location location) { if (location != null) { LocationEventArgs args = new LocationEventArgs(); args.Lat = location.Latitude; args.Lon = location.Longitude; OnlocationObtained(this, args); } ; }
private void Connector_LocationChanged(object sender, LocationEventArgs e) { //this.rectangle.X += e.OffsetX; //this.rectangle.Y += e.OffsetY; //for (int k = 0; k < connectors.Count; k++) //{ // if(!sender.Equals(connectors[k])) // connectors[k].Move(new Point(e.OffsetX, e.OffsetY)); //} }
public void OnLocationChanged(Location location) { _currentLocation = location; if (location != null) { LocationEventArgs args = new LocationEventArgs(); args.lat = location.Latitude; args.lng = location.Longitude; locationObtained(this, args); } }
void BackgroundService_LocationChanged(object sender, BaseService.CoordinatesChangedEventArgs e) { var args = new LocationEventArgs(e.Location.Latitude , e.Location.Longitude , e.Location.Time.ToDateTime() , e.Location.Speed , e.Location.Bearing , e.SatellitesCount , e.Location.Altitude); OnLocationChanged(args); }
public override bool SelectLocation(object sender, LocationEventArgs e) { bool result = base.SelectLocation(sender, e); if (e.Clear || (mNeighborhood != null && !string.IsNullOrEmpty(e.Neighborhood))) { mNeighborhood.Text = e.Neighborhood; result = true; } return(result); }
private void OnLocationRemoved(object sender, LocationEventArgs e) { LocationViewModel viewModel = this.GetOnlySelectedViewModel(); if (viewModel != null) { if (viewModel.Location == e.Location) { this.AllLocations.Remove(viewModel); } } }
void HandleLocationsUpdated (object sender, CLLocationsUpdatedEventArgs e) { var location = e.Locations [e.Locations.Length - 1]; DateTime time = DateTime.SpecifyKind (location.Timestamp, DateTimeKind.Unspecified); var args = new LocationEventArgs (location.Coordinate.Latitude, location.Coordinate.Longitude, time, location.Speed, location.Course, 0, location.Altitude); OnLocationChanged (args); if (_interval != TimeSpan.Zero && _timer == null) { _manager.StopUpdatingLocation (); _timer = new Timer (new TimerCallback(TurnOnLocationManager), null, (int)_interval.TotalMilliseconds, 0); } }
void ArrivedAtLocation(object sender, LocationEventArgs args) { if (args.LocationType == LocationType.Factory) { ServiceLocator.GetVoiceoverService().PlaySound(SoundType.KaChing, 0); ServiceLocator.GetCoinCounter().Coins += TotalUnloadReward; RewardText.text = "+$" + TotalUnloadReward.ToString(); RewardText.transform.position = OriginalRewardTextPos; RewardText.gameObject.SetActive(true); StartCoroutine(FloatRewardText()); } }
void HandleLocationsUpdated(object sender, CLLocationsUpdatedEventArgs e) { var location = e.Locations [e.Locations.Length - 1]; DateTime time = DateTime.SpecifyKind(location.Timestamp, DateTimeKind.Unspecified); var args = new LocationEventArgs(location.Coordinate.Latitude, location.Coordinate.Longitude, time, location.Speed, location.Course, 0, location.Altitude); OnLocationChanged(args); if (_interval != TimeSpan.Zero && _timer == null) { _manager.StopUpdatingLocation(); _timer = new Timer(new TimerCallback(TurnOnLocationManager), null, (int)_interval.TotalMilliseconds, 0); } }
/// <summary> /// Event handler for location update events. /// </summary> /// <param name="sender">Object sending this event</param> /// <param name="args">Event arguments</param> private void OnLocationUpdated(object sender, LocationEventArgs args) { this.Invoke( new UpdateLocationDelegate(this.UpdateLocation), new object[] { args.GeoLocation }); }
private void onRequestIdentifyLocation(ICoordinate location) { EventHandler<LocationEventArgs> e = IdentifyLocationRequested; if (e != null) { LocationEventArgs args = new LocationEventArgs(location); e(this, args); } }
public virtual bool SelectLocation(object sender, LocationEventArgs e) { bool result = false; if (e.Clear || (mCountry != null && !string.IsNullOrEmpty(e.Country))) { mCountry.ClearSelection(); ListItem country = mCountry.Items.FindByValue(e.Country); if (country != null) { country.Selected = true; Country_SelectedIndexChanged(sender, e); result = true; } } if (e.Clear || (mState != null && !string.IsNullOrEmpty(e.State))) { mState.ClearSelection(); ListItem state = mState.Items.FindByValue(e.State); if (state != null) { state.Selected = true; State_SelectedIndexChanged(sender, e); result = true; } } return result; }
public override bool SelectLocation(object sender, LocationEventArgs e) { bool result = base.SelectLocation(sender, e); if (e.Clear || (mCity != null && !string.IsNullOrEmpty(e.City))) { mCity.Text = e.City; result = true; } return result; }
public override bool SelectLocation(object sender, LocationEventArgs e) { bool result = base.SelectLocation(sender, e); if (e.Clear || (mCity != null && !string.IsNullOrEmpty(e.City))) { mCity.ClearSelection(); ListItem city = mCity.Items.FindByValue(e.City); if (city != null) { city.Selected = true; City_SelectedIndexChanged(sender, e); result = true; } } return result; }
public override bool SelectLocation(object sender, LocationEventArgs e) { bool result = base.SelectLocation(sender, e); if (e.Clear || (mNeighborhood != null && !string.IsNullOrEmpty(e.Neighborhood))) { mNeighborhood.ClearSelection(); ListItem neighborhood = mNeighborhood.Items.FindByValue(e.Neighborhood); if (neighborhood != null) { neighborhood.Selected = true; result = true; } } return result; }
public override bool SelectLocation(object sender, LocationEventArgs e) { bool result = base.SelectLocation(sender, e); if (e.Clear || (mNeighborhood != null && !string.IsNullOrEmpty(e.Neighborhood))) { mNeighborhood.Text = e.Neighborhood; result = true; } return result; }