我正在开发一个Xamarin Forms移动应用程序,它有一个包含SearchBar,ListView和Map控件的页面.列表视图包含一个地址列表,这些地址在地图上反映为引脚.
当用户在SearchBar中键入时,ListView会自动更新(通过ViewModel绑定).过滤列表数据源的ViewModel方法看起来像这样......
void FilterList()
{
listDataSource = new ObservableCollection<location>(
locationData.Where(l => l.Address.Contains(searchBar.Text))
);
// ***** Now, update the map pins using the data in listDataSource
}
Run Code Online (Sandbox Code Playgroud)
我希望更新Map,因为ListView被过滤,但不是在每个按键上,因为这可能每秒发生多次.基本上,我想在更新Map之前在每个FilterList事件中进行"滚动暂停".在伪代码中......
// ***** Now, update the map pins using the data in listDataSource
if (a previously-requested map update is pending)
{
// Cancel the pending map update request
}
// Request a new map update in 1000ms using [listDataSource]
Run Code Online (Sandbox Code Playgroud)
可以使用可移植类库中提供的Stopwatch类来完成此操作,但我怀疑使用Tasks可以实现更清晰/更好的方法.
任何人都可以建议一个"更聪明" PCL兼容的方式来做到这一点?
c# mvvm task-parallel-library portable-class-library xamarin.forms
我有一个带有PCL程序集,Android应用程序和iOS应用程序的Xamarin.Forms解决方案,我想解码PCL中的JWT.
我不能使用Thinktecture.IdentityModel.Core 1.1.0或System.IdentityModel.Tokens.Jwt 4.0.0或JWT 1.3.2,因为它们都不能添加到以' portable-net45 + win + MonoAndroid10 +为目标的项目中MonoTouch10 '.
我能够从NuGet 添加Jose JWT 1.7.0并验证它在单元测试中有效,但它导致我在我的Xamarin Android项目中得到以下构建错误...
加载程序集时出现异常:System.IO.FileNotFoundException:无法加载程序集'System.Web.Extensions,Version = 4.0.0.0,Culture = neutral,PublicKeyToken = 31bf3856ad364e35'.也许它在Mono for Android配置文件中不存在?
建议?
.net xamarin.ios xamarin.android jwt thinktecture-ident-model