本文整理汇总了C#中IImageService.GetImages方法的典型用法代码示例。如果您正苦于以下问题:C# IImageService.GetImages方法的具体用法?C# IImageService.GetImages怎么用?C# IImageService.GetImages使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IImageService
的用法示例。
在下文中一共展示了IImageService.GetImages方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: FlickrSearchViewModel
public FlickrSearchViewModel(IImageService imageService)
{
Images = new ReactiveList<SearchResultViewModel>();
var canExecute = this.WhenAnyValue(x => x.SearchText)
.Select(x => !String.IsNullOrWhiteSpace(x));
Search = ReactiveCommand.CreateAsyncObservable(
canExecute,
_ =>
{
Images.Clear();
ShowError = false;
return imageService.GetImages(SearchText);
});
Search.Subscribe(images => Images.Add(images));
Search.ThrownExceptions.Subscribe(_ => ShowError = true);
isLoading = Search.IsExecuting.ToProperty(this, vm => vm.IsLoading);
canEnterSearchText = this.WhenAnyValue(x => x.IsLoading)
.Select(x => !x)
.ToProperty(this, vm => vm.CanEnterSearchText);
}
示例2: SetUp
public void SetUp()
{
service = Substitute.For<IImageService>();
service.GetImages(Arg.Any<string>())
.Returns(Observable.Never<SearchResultViewModel>());
subject = new FlickrSearchViewModel(service);
}
示例3: CreateSearchCommand
private void CreateSearchCommand(IImageService imageService)
{
var canExecute = this.WhenAnyValue(x => x.SearchText)
.Select(x => !String.IsNullOrEmpty(x));
Search = ReactiveCommand.CreateAsyncObservable(canExecute,
_ =>
{
Images.Clear();
ShowError = false;
return imageService.GetImages(SearchText);
});
Search.Subscribe(images => Images.Add(images));
Search.ThrownExceptions.Subscribe(_ => ShowError = true);
}