예제 #1
0
        public GeofenceBuilder ThenSetGeocircle(IGeoshape geocricle)
        {
            if (geocricle.GeoshapeType != GeoshapeType.Geocircle)
            {
                throw new ArgumentException($"{nameof(GeofenceBuilder)} can use only {nameof(Geocircle)} as {nameof(IGeoshape)}");
            }

            _geoshape = geocricle as Geocircle;
            return(this);
        }
예제 #2
0
 public Geofence(string id, IGeoshape geoshape, MonitoredGeofenceStates monitoredStates, bool singleUse, TimeSpan dwellTime, DateTimeOffset startTime, TimeSpan duration)
 {
     Duration        = duration;
     DwellTime       = dwellTime;
     Geoshape        = geoshape;
     Id              = id;
     MonitoredStates = monitoredStates;
     SingleUse       = singleUse;
     StartTime       = startTime;
 }
예제 #3
0
        /// <summary>
        /// Initializes a new Geofence object given the id and the shape of the geofence.
        /// </summary>
        /// <param name="id"></param>
        /// <param name="geoshape"></param>
        public Geofence(string id, IGeoshape geoshape)
        {
#if WINDOWS_UWP || WINDOWS_APP || WINDOWS_PHONE_APP || WINDOWS_PHONE
            _fence = new Windows.Devices.Geolocation.Geofencing.Geofence(id, (Windows.Devices.Geolocation.Geocircle)((Geocircle)geoshape));
#elif __UNIFIED__
            _shape = (Geocircle)geoshape;

            if(_shape.Radius > GeofenceMonitor.Current.maxRegion)
            {
                throw new PlatformNotSupportedException("Geofence Radius is greater than the maximum supported on this platform");
            }

            _region = new CLCircularRegion(new CLLocationCoordinate2D(_shape.Center.Latitude, _shape.Center.Longitude), _shape.Radius, id);
#else
                throw new PlatformNotSupportedException();
#endif
        }
예제 #4
0
파일: Geofence.cs 프로젝트: baskren/Pontoon
        /// <summary>
        /// Initializes a new Geofence object given the id and the shape of the geofence.
        /// </summary>
        /// <param name="id"></param>
        /// <param name="geoshape"></param>
        public Geofence(string id, IGeoshape geoshape)
        {
#if WINDOWS_UWP || WINDOWS_APP || WINDOWS_PHONE_APP || WINDOWS_PHONE
            _fence = new Windows.Devices.Geolocation.Geofencing.Geofence(id, (Windows.Devices.Geolocation.Geocircle)((Geocircle)geoshape));
#elif __UNIFIED__
            _shape = (Geocircle)geoshape;
            if (_shape.Radius > GeofenceMonitor.Current.maxRegion)
            {
                throw new PlatformNotSupportedException("Geofence Radius is greater than the maximum supported on this platform");
            }

            if (id != _shape.Id)
            {
                // replace with correctly named CLRegion
                _shape = new CLCircularRegion(new CLLocationCoordinate2D(_shape.Center.Latitude, _shape.Center.Longitude), _shape.Radius, id);
            }
#elif TIZEN
            _id    = id;
            _shape = ((Geocircle)geoshape);
#else
            throw new PlatformNotSupportedException();
#endif
        }
예제 #5
0
 public Geofence(string id, IGeoshape geoshape, MonitoredGeofenceStates monitoredStates, bool singleUse, TimeSpan dwellTime)
     : this(id, geoshape, monitoredStates, singleUse, dwellTime, new DateTimeOffset(1601, 1, 1, 0, 0, 0, TimeSpan.FromSeconds(0)), TimeSpan.FromSeconds(0))
 {
 }
예제 #6
0
 public Geofence(string id, IGeoshape geoshape, MonitoredGeofenceStates monitoredStates, bool singleUse)
     : this(id, geoshape, monitoredStates, singleUse, TimeSpan.FromSeconds(10))
 {
 }
예제 #7
0
 public Geofence(string id, IGeoshape geoshape)
     : this(id, geoshape, MonitoredGeofenceStates.Entered | MonitoredGeofenceStates.Exited, false)
 {
 }