本文整理汇总了C#中ILibraryService.GetObjectsFromFile方法的典型用法代码示例。如果您正苦于以下问题:C# ILibraryService.GetObjectsFromFile方法的具体用法?C# ILibraryService.GetObjectsFromFile怎么用?C# ILibraryService.GetObjectsFromFile使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ILibraryService
的用法示例。
在下文中一共展示了ILibraryService.GetObjectsFromFile方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: EditViewModel
public EditViewModel(ILibraryService libraryService, IEventAggregator eventAggregator)
{
this._eventAggregator = eventAggregator;
var orderedEnumerable = libraryService.GetObjectsFromFile().Videos.OrderBy(v=>v.Category).ToList();
this.Videos = new ObservableCollection<Video>(orderedEnumerable);
this.SelectedVideo = this.Videos.FirstOrDefault();
}
示例2: TagsListViewModel
public TagsListViewModel(ITagsListView view, ILibraryService libraryService, IEventAggregator eventAggregator)
: base(view)
{
this._eventAggregator = eventAggregator;
this.SelectedTags = new ObservableCollection<CategoryViewModel>();
this.Tags = new ObservableCollection<CategoryViewModel>();
var videos = libraryService.GetObjectsFromFile().Videos;
IEnumerable<String> tags =
videos.SelectMany(v => v.Tags).Select(t => t.Value).Distinct().OrderBy(t => t);
foreach (var tag in tags)
{
this.Tags.Add(new CategoryViewModel
{
Name = tag,
Count = videos.Count(v => v.Tags.Any(t => t.Value == tag))
});
}
}
示例3: PlayListViewModel
public PlayListViewModel(IPlayListView view, IEventAggregator eventAggregator, ILibraryService libraryService)
: base(view)
{
this._libraryService = libraryService;
this.Playlist = new ObservableCollection<Video>();
this.RemoveCommand = new DelegateCommand(() => this.Remove(this.CurrentVideo));
this.AddCommand = new DelegateCommand<Video>(this.Add);
this.AddRangeCommand = new DelegateCommand<IEnumerable<Video>>(this.Add);
this.SavePlaylistCommand = new DelegateCommand(this.Save);
eventAggregator.GetEvent<OnAddVideo>().Subscribe(this.Add);
eventAggregator.GetEvent<OnAddVideoRange>().Subscribe(this.Add);
eventAggregator.GetEvent<OnPlayPlaylistRequest>()
.Subscribe(dummy => { eventAggregator.GetEvent<OnPlayPlaylist>().Publish(this.Playlist); }, true);
this._playListCollection = new ObservableCollection<Playlist>(libraryService.GetObjectsFromFile().PlayLists);
}
示例4: CreateTags
private void CreateTags(ILibraryService libraryService)
{
this.Tags.Clear();
var videos = libraryService.GetObjectsFromFile()
.Videos;
IEnumerable<Tag> tags = videos
.SelectMany(v => v.Tags)
.Distinct()
.OrderBy(t=>t.Value);
foreach (var tag in tags)
{
this.Tags.Add(tag);
}
}
示例5: CreateCategories
private void CreateCategories(ILibraryService libraryService)
{
this.CategoryViewModels.Clear();
IEnumerable<IGrouping<string, Video>> categories =
libraryService.GetObjectsFromFile()
.Videos.Where(v => !String.IsNullOrEmpty(v.Category))
.GroupBy(v => v.Category)
.OrderBy(g=>g.Key);
foreach (var category in categories)
{
this.CategoryViewModels.Add(new CategoryViewModel
{
Name = category.Key,
Count = category.Count()
});
}
if (this.CategoryViewModels.Any())
{
CategoryViewModel vm = this.CategoryViewModels.First();
if (this.Video != null && !String.IsNullOrEmpty(this.Video.Category))
{
vm = this.CategoryViewModels.FirstOrDefault(c => c.Name == this.Video.Category);
}
this.SelectedCategory = vm;
}
}