0

我正在尝试为我在 ModelLib.cs 中定义的方法实现回调,它具有以下代码。但是 e.UserSTate 不可用。有没有办法可以用某些东西替换它。

public class TrackingDetailsModel
{
    public void GetCurrentLocation()
    {
       GeoCoordinateWatcher watcher = new GeoCoordinateWatcher(GeoPositionAccuracy.High);
       watcher.PositionChanged += new EventHandler<GeoPositionChangedEventArgs<GeoCoordinate>>(this.watcher_PositionChanged);       

    }
}

  private void watcher_PositionChanged(object sender, GeoPositionChangedEventArgs<GeoCoordinate> e)
    {

        Action<LocationInfo> target = (Action<LocationInfo>)e.UserState;//user state here is not recognized..
     }

LocaionInfo 类在 UtilLib.cs 中定义,如下所示:

 public class LocationInfo
   { 
    public string Altitude{ get; set; }
    public string Longitude{ get; set; }
    public string Latitude{ get; set; }
   }
4

0 回答 0