i have code should work location sensing, , work once , while lately without change code geopositionstatus equal nodata. location services on , worked few days ago , nothing has changed since. why isn't working now? advice? computer windows 10 , location device on.
static geocoordinatewatcher _watcher; /// <summary> /// /// main entry point application. /// </summary> [stathread] static void main() { application.enablevisualstyles(); application.setcompatibletextrenderingdefault(false); //application.run(new form1()); _watcher = new geocoordinatewatcher(); _watcher.statuschanged += watcher_statuschanged; _watcher.positionchanged += geopositionchanged; _watcher.start(); thread.sleep(500); var coord = _watcher.position.location; } private static void watcher_statuschanged(object sender, geopositionstatuschangedeventargs e) { if (e.status == geopositionstatus.ready) { messagebox.show("watcher ready. first location: current location is: " + _watcher.position.location.latitude + "/" + _watcher.position.location.longitude + "."); } } private static void geopositionchanged(object sender, geopositionchangedeventargs<geocoordinate> e) { messagebox.show("the current location is: " + e.position.location.latitude + "/" + e.position.location.longitude + "."); }
Comments
Post a Comment