public void OnRegionStateChanged(GeofenceResult result) { var e=new Event() { Date=(result.Transition!=GeofenceTransition.Exited)?result.LastEnterTime.ToString():result.LastExitTime.ToString(), Id=App.Events.Count+1, Description=result.ToString() }; App.Events.Add(e); Settings.SaveResult(e); Debug.WriteLine(string.Format("{0} - {1}", CrossGeofence.Id, result.ToString())); }
public GeofenceResult(GeofenceResult result) { if (result != null) { this.LastEnterTime = result.LastEnterTime; this.LastExitTime = result.LastExitTime; this.Transition = result.Transition; this.RegionId = result.RegionId; this.Latitude = result.Latitude; this.Longitude = result.Longitude; this.Accuracy = result.Accuracy; } }
public void OnRegionStateChanged(GeofenceResult result) { switch (result.Transition) { case GeofenceTransition.Entered: break; case GeofenceTransition.Exited: break; case GeofenceTransition.Stayed: break; default: break; } /*if (result.Transition == GeofenceTransition.Entered) // SendMail(new []{ "*****@*****.**", "*****@*****.**" }, // "Email sent by the Region State Changed event, Entered the radius area", // "Message Test from Geofence App"); { var msg = String.Format("{0} - {1}{2}", "Region State Changed event trigger, Entered!", DateTime.Now.ToString(), Environment.NewLine); WriteFile(msg); } else if (result.Transition == GeofenceTransition.Exited) // SendMail(new []{ "*****@*****.**", "*****@*****.**" }, // "Email sent by the Region State Changed event, Exited the radius area", // "Message Test from Geofence App"); { var msg = String.Format("{0} - {1}{2}", "Region State Changed event trigger, Exited!", DateTime.Now.ToString(), Environment.NewLine); WriteFile(msg); } else if (result.Transition == GeofenceTransition.Stayed) // SendMail(new []{ "*****@*****.**", "*****@*****.**" }, // "Email sent by the Region State Changed event, Stayed at the radius area", // "Message Test from Geofence App"); { var msg = String.Format("{0} - {1}{2}", "Region State Changed event trigger, Stayed!", DateTime.Now.ToString(), Environment.NewLine); WriteFile(msg); } else // SendMail(new []{ "*****@*****.**", "*****@*****.**" }, // "Email sent by the Region State Changed event, Unknow", // "Message Test from Geofence App"); { var msg = String.Format("{0} - {1}{2}", "Region State Changed event trigger, Unknow!", DateTime.Now.ToString(), Environment.NewLine); WriteFile(msg); }*/ }