/// <summary>
 /// Initializes a new instance of the <see cref="TreeWatch.iOS.FieldMapRenderer"/> class.
 /// </summary>
 public FieldMapRenderer()
 {
     this.tapGesture = new UITapGestureRecognizer(this.MapTapped);
     this.tapGesture.NumberOfTapsRequired = 1;
     this.fieldHelper = FieldHelper.Instance;
     this.fieldHelper.FieldSelected += this.FieldSelected;
     this.fieldHelper.CenterUserPosition += this.CenterOnUserPosition;
 }
Example #2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="TreeWatch.MapViewModel"/> class.
        /// </summary>
        public MapViewModel()
        {
            this.fieldHelper                = FieldHelper.Instance;
            this.fieldHelper.MapTapped     += this.MapTapped;
            this.fieldHelper.FieldSelected += this.FieldSelected;
            this.fieldHelper.BlockSelected += this.BlockSelected;
            this.Fields        = new ObservableCollection <Field>(new DBQuery <Field>(App.Database).GetAll());
            this.selectedField = new Field("Dummy", new List <Position>(), new List <Block>());

            foreach (Field f in this.Fields)
            {
                var    whc = GeoHelper.CalculateBoundingBox(f.BoundingCoordinates);
                double rad = (whc.WidthInMeters > whc.HeightInMeters) ? whc.WidthInMeters : whc.HeightInMeters;
                rad *= 0.5;
                CrossGeofence.Current.StartMonitoring(new GeofenceCircularRegion(f.Name, whc.Center.Latitude, whc.Center.Longitude, rad)
                {
                    NotifyOnStay = false,
                    StayedInThresholdDuration = TimeSpan.FromMinutes(10)
                });
            }
        }
Example #3
0
        /// <summary>
        /// Initializes a new instance of the <see cref="TreeWatch.MapViewModel"/> class.
        /// </summary>
        public MapViewModel()
        {
            this.fieldHelper = FieldHelper.Instance;
            this.fieldHelper.MapTapped += this.MapTapped;
            this.fieldHelper.FieldSelected += this.FieldSelected;
            this.fieldHelper.BlockSelected += this.BlockSelected;
            this.Fields = new ObservableCollection<Field>(new DBQuery<Field>(App.Database).GetAll());
            this.selectedField = new Field("Dummy", new List<Position>(), new List<Block>());

            foreach (Field f in this.Fields)
            {
                var whc = GeoHelper.CalculateBoundingBox(f.BoundingCoordinates);
                double rad = (whc.WidthInMeters > whc.HeightInMeters) ? whc.WidthInMeters : whc.HeightInMeters;
                rad *= 0.5;
                CrossGeofence.Current.StartMonitoring(new GeofenceCircularRegion(f.Name, whc.Center.Latitude, whc.Center.Longitude, rad)
                    {
                        NotifyOnStay = false,
                        StayedInThresholdDuration = TimeSpan.FromMinutes(10)
                    });
            }
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="TreeWatch.Droid.FieldMapRenderer"/> class.
 /// </summary>
 public FieldMapRenderer()
 {
     this.fieldHelper = FieldHelper.Instance;
     this.fieldHelper.FieldSelected += this.FieldSelected;
 }