Пример #1
0
        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();
        }
Пример #3
0
    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);
    }
Пример #4
0
 protected virtual void OnLocationsChanged(LocationEventArgs e)
 {
     if (LocationsChanged != null)
     {
         LocationsChanged(this, e);
     }
 }
Пример #5
0
 protected virtual void OnCurrentLocationChanged(LocationEventArgs e)
 {
     if (CurrentLocationChanged != null)
     {
         CurrentLocationChanged(this, e);
     }
 }
Пример #6
0
        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 = "";
        }
Пример #7
0
 void ArrivedAtLocation(object sender, LocationEventArgs args)
 {
     if (args.LocationType == LocationType.Quary)
     {
         Animator.SetBool(A_IsLoading, true);                    // Play animation
     }
 }
Пример #8
0
        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();
 }
Пример #10
0
        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;
                }
            }
        }
Пример #11
0
        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);
        }
Пример #12
0
        private void OnLocationAdded(object sender, LocationEventArgs e)
        {
            LocationViewModel vm = new LocationViewModel(e.Location, this.repository);

            vm.PropertyChanged += this.OnLocationViewModelPropertyChanged;

            this.AllLocations.Add(vm);
        }
Пример #13
0
 private void LocationsChanged(object sender, LocationEventArgs e)
 {
     if (e.NewLocations == null)
     {
         return;
     }
     UpdateLayers(e.NewLocations);
 }
Пример #14
0
        // The method which fires the Event
        protected void OnPixelClicked(object sender, LocationEventArgs e)
        {
            var target = PixelClicked;

            if (target != null)
            {
                target(this, e);
            }
        }
Пример #15
0
 /*
  * 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);
     }
 }
Пример #16
0
        public void OnLocationChanged(CLLocationCoordinate2D location)
        {
            var args = new LocationEventArgs
            {
                Latitude  = location.Latitude,
                Longitude = location.Longitude
            };

            LocationChanged?.Invoke(this, args);
        }
Пример #17
0
        private void OnLocationAdded(object sender, LocationEventArgs e)
        {
            LocationViewModel viewModel = new LocationViewModel(e.Location, repositorys);

            // delegate
            this.PropertyChanged += this.OnLocationViewModelPropertyChanged;


            this.AllLocations.Add(viewModel);
        }
Пример #18
0
        private void onRequestIdentifyLocation(ICoordinate location)
        {
            EventHandler <LocationEventArgs> e = IdentifyLocationRequested;

            if (e != null)
            {
                LocationEventArgs args = new LocationEventArgs(location);
                e(this, args);
            }
        }
Пример #19
0
        public void UnSelect()
        {
            LocationEventArgs args = new LocationEventArgs();

            args.OldLocation = CurrentLocation;
            CurrentLocation  = null;
            args.NewLocation = CurrentLocation;
            InnerLocations.Clear();
            OnCurrentLocationChanged(args);
        }
Пример #20
0
 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();
     }
 }
Пример #21
0
        public void OnLocationChanged(Location location)
        {
            LocationEventArgs args = new LocationEventArgs()
            {
                lat = location.Latitude,
                lng = location.Longitude
            };

            LocationObtained(this, args);
        }
Пример #22
0
 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);
     }
 }
Пример #23
0
        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);
            }
        }
Пример #27
0
        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);
        }
Пример #28
0
    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);
    }
Пример #29
0
        private void OnLocationRemoved(object sender, LocationEventArgs e)
        {
            LocationViewModel viewModel = this.GetOnlySelectedViewModel();

            if (viewModel != null)
            {
                if (viewModel.Location == e.Location)
                {
                    this.AllLocations.Remove(viewModel);
                }
            }
        }
Пример #30
0
		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);
			}
		}
Пример #31
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());
     }
 }
Пример #32
0
        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);
        }
Пример #33
0
        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);
            }
        }
Пример #34
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 });
 }
Пример #35
0
        private void onRequestIdentifyLocation(ICoordinate location)
        {
            EventHandler<LocationEventArgs> e = IdentifyLocationRequested;

            if (e != null)
            {
                LocationEventArgs args = new LocationEventArgs(location);
                e(this, args);
            }
        }
Пример #36
0
    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;
    }
Пример #37
0
    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;
    }
Пример #38
0
    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;
    }
Пример #39
0
    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;
    }
Пример #40
0
    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;
    }