public void AddFromDiscover(string parentDirectory = null) { SelectedTabIndex = 3; DiscoverAvailable = true; var search = new NewMediaViewModel(_engine, _exceptionHandler, DialogService); search.AddFromDiscover(parentDirectory); Searches = new[] { search }; SubscribeSearches(); SelectedSearches = Searches; }
public async Task AddFromSearch(string searchQuery, string parentDirectory = null) { SelectedTabIndex = 2; SearchAvailable = true; var search = new NewMediaViewModel(_engine, _exceptionHandler, DialogService); var t = search.AddFromSearch(searchQuery, parentDirectory); SelectedSearches = Searches = new[] { search }; await t; SubscribeSearches(); }
public async Task AddFromImdbId(string imdbId, string directory = null) { SelectedTabIndex = 4; var search = new NewMediaViewModel(_engine, _exceptionHandler, DialogService); var t = search.AddFromImdbId(imdbId, directory); Searches = new[] { search }; SubscribeSearches(); SelectedSearches = Searches; EditList = new[] { search.Search.SelectedResult }; await t; }
// ReSharper disable once ParameterTypeCanBeEnumerable.Local private async Task AddDirectories(string[] directories) { Searches = null; var directoryInfoes = directories.Select(d => new DirectoryInfo(d)).Where(di => di.Exists).ToList(); var filterDirectories = directoryInfoes.Select(di => di.FullName).ToList(); var medias = await _engine.GetMediaList(filterDirectories); var mediaList = medias.ToList(); Searches = directoryInfoes .Select(di => { var search = new NewMediaViewModel(_engine, _exceptionHandler, DialogService); search.AddFromDirectory(di, mediaList.FirstOrDefault(m => string.Equals(m.Directory, di.FullName, StringComparison.OrdinalIgnoreCase))); return(search); }) .ToList(); SubscribeSearches(); }
// ReSharper disable once ParameterTypeCanBeEnumerable.Local private async Task AddDirectories(string[] directories) { Searches = null; var directoryInfoes = directories.Select(d => new DirectoryInfo(d)).Where(di => di.Exists).ToList(); var filterDirectories = directoryInfoes.Select(di => di.FullName).ToList(); var medias = await _engine.GetMediaList(filterDirectories); var mediaList = medias.ToList(); Searches = directoryInfoes .Select(di => { var search = new NewMediaViewModel(_engine, _exceptionHandler, DialogService); search.AddFromDirectory(di, mediaList.FirstOrDefault(m => string.Equals(m.Directory, di.FullName, StringComparison.OrdinalIgnoreCase))); return search; }) .ToList(); SubscribeSearches(); }