Beispiel #1
0
        // 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();
        }