mirror of
				https://github.com/Nioux/AideDeJeu.git
				synced 2025-10-31 07:26:09 +00:00 
			
		
		
		
	Clean
This commit is contained in:
		
							parent
							
								
									8765112c55
								
							
						
					
					
						commit
						341b0eb4dc
					
				
					 2 changed files with 18 additions and 37 deletions
				
			
		|  | @ -16,35 +16,11 @@ namespace AideDeJeu.ViewModels | |||
| 
 | ||||
|         public ItemsViewModel() | ||||
|         { | ||||
|             //this.ItemSourceType = itemSourceType; | ||||
|             LoadItemsCommand = new Command(async () => await ExecuteLoadItemsCommandAsync().ConfigureAwait(false)); | ||||
|             //Filter = Main.GetFilterViewModel(ItemSourceType); | ||||
|             //Filter.LoadItemsCommand = LoadItemsCommand; | ||||
|             SearchCommand = new Command<string>((text) => | ||||
|             { | ||||
|                 Filter.SearchText = text; | ||||
|             }); | ||||
|             SearchCommand = new Command<string>((text) => Filter.SearchText = text ); | ||||
|         } | ||||
|         public Command<string> SearchCommand { get; private set; } | ||||
|         public ICommand LoadItemsCommand { get; protected set; } | ||||
|         public async Task ExecuteGotoItemCommandAsync(Item item) | ||||
|         { | ||||
|             await Main.Navigator.GotoItemDetailPageAsync(item); | ||||
|         } | ||||
| 
 | ||||
|         //private ItemSourceType _ItemSourceType = ItemSourceType.SpellHD; | ||||
|         //public ItemSourceType ItemSourceType | ||||
|         //{ | ||||
|         //    get | ||||
|         //    { | ||||
|         //        return _ItemSourceType; | ||||
|         //    } | ||||
|         //    set | ||||
|         //    { | ||||
|         //        SetProperty(ref _ItemSourceType, value); | ||||
|         //        OnPropertyChanged(nameof(Items)); | ||||
|         //    } | ||||
|         //} | ||||
| 
 | ||||
|         private FilterViewModel _Filter; | ||||
|         public FilterViewModel Filter | ||||
|  | @ -85,19 +61,28 @@ namespace AideDeJeu.ViewModels | |||
|                 if (_SelectedItem != null) | ||||
|                 { | ||||
|                     Main.Navigator.GotoItemDetailPageAsync(_SelectedItem); | ||||
|                     //Main.GotoItemCommand.Execute(_SelectedItem); | ||||
|                 } | ||||
|             } | ||||
|         } | ||||
| 
 | ||||
|         public Items AllItems; | ||||
|         public async Task InitAsync() | ||||
|         private Items _AllItems; | ||||
|         public Items AllItems | ||||
|         { | ||||
|             //AllItems = await Main.GetAllItemsAsync(ItemSourceType); | ||||
|             Title = AllItems.Name; | ||||
|             Filter = AllItems.GetNewFilterViewModel(); //Main.GetFilterViewModel(ItemSourceType); | ||||
|             get | ||||
|             { | ||||
|                 return _AllItems; | ||||
|             } | ||||
|             set | ||||
|             { | ||||
|                 _AllItems = value; | ||||
|                 if (_AllItems != null) | ||||
|                 { | ||||
|                     Title = _AllItems.Name; | ||||
|                     Filter = _AllItems.GetNewFilterViewModel(); | ||||
|                     Filter.LoadItemsCommand = LoadItemsCommand; | ||||
|                 } | ||||
|             } | ||||
|         } | ||||
| 
 | ||||
|         async Task LoadItemsAsync(CancellationToken cancellationToken = default) | ||||
|         { | ||||
|  | @ -105,8 +90,6 @@ namespace AideDeJeu.ViewModels | |||
|             Main.IsLoading = true; | ||||
|             try | ||||
|             { | ||||
|                 //var filterViewModel = Filter; | ||||
|                 //var allItems = await Main.GetAllItemsAsync(ItemSourceType); | ||||
|                 var items = await Filter.FilterItems(AllItems, cancellationToken: cancellationToken); | ||||
|                 Items = items.ToList(); | ||||
|             } | ||||
|  |  | |||
|  | @ -32,10 +32,8 @@ namespace AideDeJeu.ViewModels | |||
| 
 | ||||
|         public async Task<ItemsViewModel> GetItemsViewModelAsync(string source) | ||||
|         { | ||||
|             var allItems = await GetAllItemsAsync(source); | ||||
|             var itemsViewModel = new ItemsViewModel(); | ||||
|             itemsViewModel.AllItems = allItems; | ||||
|             await itemsViewModel.InitAsync(); | ||||
|             itemsViewModel.AllItems = await GetAllItemsAsync(source); | ||||
|             return itemsViewModel; | ||||
|         } | ||||
| 
 | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Yan Maniez
						Yan Maniez