mirror of
				https://github.com/Nioux/AideDeJeu.git
				synced 2025-10-31 15:36:07 +00:00 
			
		
		
		
	Correctif
This commit is contained in:
		
							parent
							
								
									341b0eb4dc
								
							
						
					
					
						commit
						cd106acb13
					
				
					 1 changed files with 20 additions and 4 deletions
				
			
		|  | @ -17,7 +17,13 @@ namespace AideDeJeu.ViewModels | ||||||
|         public ItemsViewModel() |         public ItemsViewModel() | ||||||
|         { |         { | ||||||
|             LoadItemsCommand = new Command(async () => await ExecuteLoadItemsCommandAsync().ConfigureAwait(false)); |             LoadItemsCommand = new Command(async () => await ExecuteLoadItemsCommandAsync().ConfigureAwait(false)); | ||||||
|             SearchCommand = new Command<string>((text) => Filter.SearchText = text ); |             SearchCommand = new Command<string>((text) => | ||||||
|  |             { | ||||||
|  |                 if (Filter != null) | ||||||
|  |                 { | ||||||
|  |                     Filter.SearchText = text; | ||||||
|  |                 } | ||||||
|  |             }); | ||||||
|         } |         } | ||||||
|         public Command<string> SearchCommand { get; private set; } |         public Command<string> SearchCommand { get; private set; } | ||||||
|         public ICommand LoadItemsCommand { get; protected set; } |         public ICommand LoadItemsCommand { get; protected set; } | ||||||
|  | @ -79,20 +85,30 @@ namespace AideDeJeu.ViewModels | ||||||
|                 { |                 { | ||||||
|                     Title = _AllItems.Name; |                     Title = _AllItems.Name; | ||||||
|                     Filter = _AllItems.GetNewFilterViewModel(); |                     Filter = _AllItems.GetNewFilterViewModel(); | ||||||
|  |                     if (Filter != null) | ||||||
|  |                     { | ||||||
|                         Filter.LoadItemsCommand = LoadItemsCommand; |                         Filter.LoadItemsCommand = LoadItemsCommand; | ||||||
|                     } |                     } | ||||||
|                 } |                 } | ||||||
|             } |             } | ||||||
|  |         } | ||||||
| 
 | 
 | ||||||
|         async Task LoadItemsAsync(CancellationToken cancellationToken = default) |         async Task LoadItemsAsync(CancellationToken cancellationToken = default) | ||||||
|         { |         { | ||||||
|             IsBusy = true; |             IsBusy = true; | ||||||
|             Main.IsLoading = true; |             Main.IsLoading = true; | ||||||
|             try |             try | ||||||
|  |             { | ||||||
|  |                 if (Filter != null) | ||||||
|                 { |                 { | ||||||
|                     var items = await Filter.FilterItems(AllItems, cancellationToken: cancellationToken); |                     var items = await Filter.FilterItems(AllItems, cancellationToken: cancellationToken); | ||||||
|                     Items = items.ToList(); |                     Items = items.ToList(); | ||||||
|                 } |                 } | ||||||
|  |                 else | ||||||
|  |                 { | ||||||
|  |                     Items = AllItems.ToList(); | ||||||
|  |                 } | ||||||
|  |             } | ||||||
|             catch (OperationCanceledException ex) |             catch (OperationCanceledException ex) | ||||||
|             { |             { | ||||||
|                 Debug.WriteLine(ex); |                 Debug.WriteLine(ex); | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Yan Maniez
						Yan Maniez