public async Task ToggleFavs() { if ( !FavOnly ) { BookStorage BS = new BookStorage(); string[] BookIds = BS.GetIdList(); List<ActiveItem> SS = new List<ActiveItem>(); foreach ( string Id in BookIds ) { if ( Data != null && Data.Any( x => ( x as LocalBook ).aid == Id ) ) { continue; } LocalBook LB = await LocalBook.CreateAsync( Id ); if ( !( LB.CanProcess || LB.ProcessSuccess ) ) { XParameter Param = BS.GetBook( Id ); LB.Name = Param.GetValue( AppKeys.GLOBAL_NAME ); LB.Desc = "Source is unavailable"; LB.CanProcess = false; } LB.IsFav = true; SS.Add( LB ); } if ( 0 < SS.Count ) { if ( Data == null ) Data = SS; else Data = Data.Concat( SS ); } FavOnly = true; } else { FavOnly = false; if ( Data != null ) { Data = Data.Where( x => { LocalBook LB = x as LocalBook; if ( LB.IsFav ) return LB.ProcessSuccess || LB.Processing || LB.CanProcess; return true; } ); } } NotifyChanged( "SearchSet" ); }