我是 Windows Phone 7 的新手。
我正在 wp7 中开发一个项目,在该项目中每 60 秒我需要将我的纬度经度详细信息发送到 Web 服务(asmx)。
我有一个后台服务,并且正在连接到 asmx 服务。当我在 asmx 上更新我的详细信息时,需要在手机上显示 toast 消息,但我无法做到,请帮助我
这是我的后台服务代码
protected override void OnInvoke(ScheduledTask task)
{
watcher = new GeoCoordinateWatcher(GeoPositionAccuracy.Default);
watcher.Start();
string useremail = task.Description.ToString();
string latitude = watcher.Position.Location.Latitude.ToString();
string longitude = watcher.Position.Location.Longitude.ToString();
ServiceReference1.UpdateUserLocationSoapClient obj = new ServiceReference1.UpdateUserLocationSoapClient();
obj.UpdateUserLocation1Completed += new EventHandler<ServiceReference1.UpdateUserLocation1CompletedEventArgs>(obj_UpdateUserLocation1Completed);
obj.UpdateUserLocation1Async(useremail, latitude, longitude);
// If debugging is enabled, launch the agent again in one minute.
#if DEBUG_AGENT
ScheduledActionService.LaunchForTest(task.Name, TimeSpan.FromSeconds(5));
#endif
// Call NotifyComplete to let the system know the agent is done working.
NotifyComplete();
}
私人无效obj_UpdateUserLocation1Completed(对象发送者,ServiceReference1.UpdateUserLocation1CompletedEventArgs e){
ShellToast toast = new ShellToast();
toast.Title = "kk";
toast.Content = "ss" + e.Result.ToString();
toast.Show();
}