mirror of
				https://github.com/Nioux/AideDeJeu.git
				synced 2025-10-30 23:16:09 +00:00 
			
		
		
		
	Navigation liste pré filtré
This commit is contained in:
		
							parent
							
								
									b2dbf641f7
								
							
						
					
					
						commit
						8ba016149b
					
				
					 3 changed files with 19 additions and 9 deletions
				
			
		|  | @ -19,6 +19,7 @@ namespace AideDeJeuLib | ||||||
|                     "## [Caractéristiques](abilities_hd.md)\n\n" + |                     "## [Caractéristiques](abilities_hd.md)\n\n" + | ||||||
|                     "## [États spéciaux](conditions_hd.md)\n\n" + |                     "## [États spéciaux](conditions_hd.md)\n\n" + | ||||||
|                     "## [Sorts](spells_hd.md)\n\n" + |                     "## [Sorts](spells_hd.md)\n\n" + | ||||||
|  |                     "## [Sorts de mago](spells_hd_with_class_magicien.md)\n\n" + | ||||||
|                     "## [Créatures](monsters_hd.md)\n\n" + |                     "## [Créatures](monsters_hd.md)\n\n" + | ||||||
|                     //"## [Mignons](baby_bestiary_hd.md)\n\n" + |                     //"## [Mignons](baby_bestiary_hd.md)\n\n" + | ||||||
|                     "# VO (SRD)\n\n" + |                     "# VO (SRD)\n\n" + | ||||||
|  |  | ||||||
|  | @ -43,7 +43,15 @@ namespace AideDeJeu.ViewModels | ||||||
|             } |             } | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|         public virtual void FilterWith(string key, string val) { } |         public void FilterWith(string key, string val) | ||||||
|  |         { | ||||||
|  |             var filter = Filters.FirstOrDefault(f => f.Key.ToString().ToLower() == key.ToLower()); | ||||||
|  |             if (filter != null) | ||||||
|  |             { | ||||||
|  |                 filter.Index = filter.KeyValues.FindIndex(kv => kv.Value.ToLower().Contains(val.ToLower())); | ||||||
|  |             } | ||||||
|  |         } | ||||||
|  | 
 | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     public enum FilterKeys |     public enum FilterKeys | ||||||
|  | @ -322,12 +330,6 @@ namespace AideDeJeu.ViewModels | ||||||
| 
 | 
 | ||||||
|     public class HDSpellFilterViewModel : SpellFilterViewModel |     public class HDSpellFilterViewModel : SpellFilterViewModel | ||||||
|     { |     { | ||||||
|         public override void FilterWith(string key, string val) |  | ||||||
|         { |  | ||||||
|             var filter = Filters.FirstOrDefault(f => f.Key.ToString().ToLower() == key.ToLower()); |  | ||||||
|             filter.Index = filter.KeyValues.FindIndex(kv => kv.Value.ToLower().Contains(val.ToLower())); |  | ||||||
|         } |  | ||||||
| 
 |  | ||||||
|         public override List<KeyValuePair<string, string>> Classes { get; } = new List<KeyValuePair<string, string>>() |         public override List<KeyValuePair<string, string>> Classes { get; } = new List<KeyValuePair<string, string>>() | ||||||
|         { |         { | ||||||
|             new KeyValuePair<string, string>("", "Toutes" ), |             new KeyValuePair<string, string>("", "Toutes" ), | ||||||
|  |  | ||||||
|  | @ -57,10 +57,11 @@ namespace AideDeJeu.ViewModels | ||||||
|         { |         { | ||||||
|             if (s != null) |             if (s != null) | ||||||
|             { |             { | ||||||
|                 var regex = new Regex("/(?<file>.*)\\.md(#(?<anchor>.*))?"); |                 var regex = new Regex("/(?<file>.*?)(_with_(?<with>.*))?\\.md(#(?<anchor>.*))?"); | ||||||
|                 var match = regex.Match(s); |                 var match = regex.Match(s); | ||||||
|                 var file = match.Groups["file"].Value; |                 var file = match.Groups["file"].Value; | ||||||
|                 var anchor = match.Groups["anchor"].Value; |                 var anchor = match.Groups["anchor"].Value; | ||||||
|  |                 var with = match.Groups["with"].Value; | ||||||
|                 var item = await Main.GetItemFromDataAsync(file); |                 var item = await Main.GetItemFromDataAsync(file); | ||||||
|                 if (item != null) |                 if (item != null) | ||||||
|                 { |                 { | ||||||
|  | @ -80,7 +81,13 @@ namespace AideDeJeu.ViewModels | ||||||
|                             var filterViewModel = items.GetNewFilterViewModel(); |                             var filterViewModel = items.GetNewFilterViewModel(); | ||||||
|                             var itemsViewModel = new ItemsViewModel() { AllItems = items, Filter = filterViewModel }; |                             var itemsViewModel = new ItemsViewModel() { AllItems = items, Filter = filterViewModel }; | ||||||
|                             itemsViewModel.LoadItemsCommand.Execute(null); |                             itemsViewModel.LoadItemsCommand.Execute(null); | ||||||
|                             //filterViewModel.FilterWith("class", "magicien"); |                             if(!string.IsNullOrEmpty(with)) | ||||||
|  |                             { | ||||||
|  |                                 var swith = with.Split('_'); | ||||||
|  |                                 var key = swith[0]; | ||||||
|  |                                 var val = swith[1]; | ||||||
|  |                                 filterViewModel.FilterWith(key, val); | ||||||
|  |                             } | ||||||
|                             if (filterViewModel == null) |                             if (filterViewModel == null) | ||||||
|                             { |                             { | ||||||
|                                 await GotoItemsPageAsync(itemsViewModel); |                                 await GotoItemsPageAsync(itemsViewModel); | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Yan Maniez
						Yan Maniez