mirror of
				https://github.com/Nioux/AideDeJeu.git
				synced 2025-10-31 07:26:09 +00:00 
			
		
		
		
	Clean
This commit is contained in:
		
							parent
							
								
									96eef2c464
								
							
						
					
					
						commit
						64fb8082de
					
				
					 4 changed files with 5 additions and 192 deletions
				
			
		|  | @ -16,7 +16,7 @@ namespace AideDeJeu.ViewModels | |||
|     public abstract class FilterViewModel : BaseViewModel | ||||
|     { | ||||
|         public ICommand LoadItemsCommand { get; protected set; } | ||||
|         public abstract Task<IEnumerable<Item>> FilterItems(IEnumerable<Item> items, CancellationToken token = default); | ||||
|         public abstract Task<IEnumerable<Item>> FilterItems(IEnumerable<Item> items, CancellationToken cancellationToken = default); | ||||
|         public abstract IEnumerable<Filter> Filters { get; } | ||||
|         private string _SearchText = ""; | ||||
|         public string SearchText | ||||
|  |  | |||
|  | @ -17,188 +17,9 @@ namespace AideDeJeu.ViewModels | |||
|             set | ||||
|             { | ||||
|                 SetProperty(ref _Item, value); | ||||
|                 //OnPropertyChanged(nameof(TypeSizeAlignment)); | ||||
|                 //OnPropertyChanged(nameof(ArmorClass)); | ||||
|                 //OnPropertyChanged(nameof(HitPoints)); | ||||
|                 //OnPropertyChanged(nameof(Speed)); | ||||
|                 //OnPropertyChanged(nameof(SavingThrows)); | ||||
|                 //OnPropertyChanged(nameof(Skills)); | ||||
|                 //OnPropertyChanged(nameof(DamageVulnerabilities)); | ||||
|                 //OnPropertyChanged(nameof(DamageResistances)); | ||||
|                 //OnPropertyChanged(nameof(DamageImmunities)); | ||||
|                 //OnPropertyChanged(nameof(ConditionImmunities)); | ||||
|                 //OnPropertyChanged(nameof(Senses)); | ||||
|                 //OnPropertyChanged(nameof(Languages)); | ||||
|                 //OnPropertyChanged(nameof(Challenge)); | ||||
|                 //OnPropertyChanged(nameof(Duration)); | ||||
|                 //OnPropertyChanged(nameof(Duration)); | ||||
|             } | ||||
|         } | ||||
| 
 | ||||
|         //public FormattedString TypeSizeAlignment | ||||
|         //{ | ||||
|         //    get | ||||
|         //    { | ||||
|         //        var fd = FormatedTextHelpers.FontData.FromResource("contentital"); | ||||
|         //        var fs = new FormattedString(); | ||||
|         //        fs.Spans.Add(new Span() { Text = string.Format("{0} de taille {1}, {2}", Item.Type, Item.Size, Item.Alignment), FontFamily = fd.FontFamily, FontAttributes = fd.FontAttributes, FontSize = fd.FontSize, ForegroundColor = fd.TextColor }); | ||||
|         //        return fs; | ||||
|         //    } | ||||
|         //} | ||||
| 
 | ||||
|         //public FormattedString ArmorClass | ||||
|         //{ | ||||
|         //    get | ||||
|         //    { | ||||
|         //        var fd = FormatedTextHelpers.FontData.FromResource("content"); | ||||
|         //        var fs = new FormattedString(); | ||||
|         //        fs.Spans.Add(new Span() { Text = string.Format("Classe d'armure {0}", Item.ArmorClass), FontFamily = fd.FontFamily, FontAttributes = fd.FontAttributes, FontSize = fd.FontSize, ForegroundColor = fd.TextColor }); | ||||
|         //        return fs; | ||||
|         //    } | ||||
|         //} | ||||
| 
 | ||||
|         //public FormattedString HitPoints | ||||
|         //{ | ||||
|         //    get | ||||
|         //    { | ||||
|         //        var fd = FormatedTextHelpers.FontData.FromResource("content"); | ||||
|         //        var fs = new FormattedString(); | ||||
|         //        fs.Spans.Add(new Span() { Text = string.Format("Points de vie {0}", Item.HitPoints), FontFamily = fd.FontFamily, FontAttributes = fd.FontAttributes, FontSize = fd.FontSize, ForegroundColor = fd.TextColor }); | ||||
|         //        return fs; | ||||
|         //    } | ||||
|         //} | ||||
| 
 | ||||
|         //public FormattedString Speed | ||||
|         //{ | ||||
|         //    get | ||||
|         //    { | ||||
|         //        var fd = FormatedTextHelpers.FontData.FromResource("content"); | ||||
|         //        var fs = new FormattedString(); | ||||
|         //        fs.Spans.Add(new Span() { Text = string.Format("Vitesse {0}", Item.Speed), FontFamily = fd.FontFamily, FontAttributes = fd.FontAttributes, FontSize = fd.FontSize, ForegroundColor = fd.TextColor }); | ||||
|         //        return fs; | ||||
|         //    } | ||||
|         //} | ||||
| 
 | ||||
|         //public FormattedString SavingThrows | ||||
|         //{ | ||||
|         //    get | ||||
|         //    { | ||||
|         //        var fd = FormatedTextHelpers.FontData.FromResource("content"); | ||||
|         //        var fdb = FormatedTextHelpers.FontData.FromResource("contentbold"); | ||||
|         //        var fs = new FormattedString(); | ||||
|         //        fs.Spans.Add(new Span() { Text = "Jets de sauvegarde ", FontFamily = fdb.FontFamily, FontAttributes = fdb.FontAttributes, FontSize = fdb.FontSize, ForegroundColor = fdb.TextColor }); | ||||
|         //        fs.Spans.Add(new Span() { Text = Item.SavingThrows, FontFamily = fd.FontFamily, FontAttributes = fd.FontAttributes, FontSize = fd.FontSize, ForegroundColor = fd.TextColor }); | ||||
|         //        return fs; | ||||
|         //    } | ||||
|         //} | ||||
| 
 | ||||
|         //public FormattedString Skills | ||||
|         //{ | ||||
|         //    get | ||||
|         //    { | ||||
|         //        var fd = FormatedTextHelpers.FontData.FromResource("content"); | ||||
|         //        var fdb = FormatedTextHelpers.FontData.FromResource("contentbold"); | ||||
|         //        var fs = new FormattedString(); | ||||
|         //        fs.Spans.Add(new Span() { Text = "Compétence ", FontFamily = fdb.FontFamily, FontAttributes = fdb.FontAttributes, FontSize = fdb.FontSize, ForegroundColor = fdb.TextColor }); | ||||
|         //        fs.Spans.Add(new Span() { Text = Item.Skills, FontFamily = fd.FontFamily, FontAttributes = fd.FontAttributes, FontSize = fd.FontSize, ForegroundColor = fd.TextColor }); | ||||
|         //        return fs; | ||||
|         //    } | ||||
|         //} | ||||
| 
 | ||||
| 
 | ||||
|         //public FormattedString DamageVulnerabilities | ||||
|         //{ | ||||
|         //    get | ||||
|         //    { | ||||
|         //        var fd = FormatedTextHelpers.FontData.FromResource("content"); | ||||
|         //        var fdb = FormatedTextHelpers.FontData.FromResource("contentbold"); | ||||
|         //        var fs = new FormattedString(); | ||||
|         //        fs.Spans.Add(new Span() { Text = "Vulnérabilité aux dégâts ", FontFamily = fdb.FontFamily, FontAttributes = fdb.FontAttributes, FontSize = fdb.FontSize, ForegroundColor = fdb.TextColor }); | ||||
|         //        fs.Spans.Add(new Span() { Text = Item.DamageVulnerabilities, FontFamily = fd.FontFamily, FontAttributes = fd.FontAttributes, FontSize = fd.FontSize, ForegroundColor = fd.TextColor }); | ||||
|         //        return fs; | ||||
|         //    } | ||||
|         //} | ||||
| 
 | ||||
|         //public FormattedString DamageImmunities | ||||
|         //{ | ||||
|         //    get | ||||
|         //    { | ||||
|         //        var fd = FormatedTextHelpers.FontData.FromResource("content"); | ||||
|         //        var fdb = FormatedTextHelpers.FontData.FromResource("contentbold"); | ||||
|         //        var fs = new FormattedString(); | ||||
|         //        fs.Spans.Add(new Span() { Text = "Immunité contre les dégâts ", FontFamily = fdb.FontFamily, FontAttributes = fdb.FontAttributes, FontSize = fdb.FontSize, ForegroundColor = fdb.TextColor }); | ||||
|         //        fs.Spans.Add(new Span() { Text = Item.DamageImmunities, FontFamily = fd.FontFamily, FontAttributes = fd.FontAttributes, FontSize = fd.FontSize, ForegroundColor = fd.TextColor }); | ||||
|         //        return fs; | ||||
|         //    } | ||||
|         //} | ||||
| 
 | ||||
|         //public FormattedString ConditionImmunities | ||||
|         //{ | ||||
|         //    get | ||||
|         //    { | ||||
|         //        var fd = FormatedTextHelpers.FontData.FromResource("content"); | ||||
|         //        var fdb = FormatedTextHelpers.FontData.FromResource("contentbold"); | ||||
|         //        var fs = new FormattedString(); | ||||
|         //        fs.Spans.Add(new Span() { Text = "Immunité contre les états ", FontFamily = fdb.FontFamily, FontAttributes = fdb.FontAttributes, FontSize = fdb.FontSize, ForegroundColor = fdb.TextColor }); | ||||
|         //        fs.Spans.Add(new Span() { Text = Item.ConditionImmunities, FontFamily = fd.FontFamily, FontAttributes = fd.FontAttributes, FontSize = fd.FontSize, ForegroundColor = fd.TextColor }); | ||||
|         //        return fs; | ||||
|         //    } | ||||
|         //} | ||||
| 
 | ||||
|         //public FormattedString DamageResistances | ||||
|         //{ | ||||
|         //    get | ||||
|         //    { | ||||
|         //        var fd = FormatedTextHelpers.FontData.FromResource("content"); | ||||
|         //        var fdb = FormatedTextHelpers.FontData.FromResource("contentbold"); | ||||
|         //        var fs = new FormattedString(); | ||||
|         //        fs.Spans.Add(new Span() { Text = "Résistance aux dégâts ", FontFamily = fdb.FontFamily, FontAttributes = fdb.FontAttributes, FontSize = fdb.FontSize, ForegroundColor = fdb.TextColor }); | ||||
|         //        fs.Spans.Add(new Span() { Text = Item.DamageResistances, FontFamily = fd.FontFamily, FontAttributes = fd.FontAttributes, FontSize = fd.FontSize, ForegroundColor = fd.TextColor }); | ||||
|         //        return fs; | ||||
|         //    } | ||||
|         //} | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
|         //public FormattedString Senses | ||||
|         //{ | ||||
|         //    get | ||||
|         //    { | ||||
|         //        var fd = FormatedTextHelpers.FontData.FromResource("content"); | ||||
|         //        var fdb = FormatedTextHelpers.FontData.FromResource("contentbold"); | ||||
|         //        var fs = new FormattedString(); | ||||
|         //        fs.Spans.Add(new Span() { Text = "Sens ", FontFamily = fdb.FontFamily, FontAttributes = fdb.FontAttributes, FontSize = fdb.FontSize, ForegroundColor = fdb.TextColor }); | ||||
|         //        fs.Spans.Add(new Span() { Text = Item.Senses, FontFamily = fd.FontFamily, FontAttributes = fd.FontAttributes, FontSize = fd.FontSize, ForegroundColor = fd.TextColor }); | ||||
|         //        return fs; | ||||
|         //    } | ||||
|         //} | ||||
| 
 | ||||
|         //public FormattedString Languages | ||||
|         //{ | ||||
|         //    get | ||||
|         //    { | ||||
|         //        var fd = FormatedTextHelpers.FontData.FromResource("content"); | ||||
|         //        var fdb = FormatedTextHelpers.FontData.FromResource("contentbold"); | ||||
|         //        var fs = new FormattedString(); | ||||
|         //        fs.Spans.Add(new Span() { Text = "Langues ", FontFamily = fdb.FontFamily, FontAttributes = fdb.FontAttributes, FontSize = fdb.FontSize, ForegroundColor = fdb.TextColor }); | ||||
|         //        fs.Spans.Add(new Span() { Text = Item.Languages, FontFamily = fd.FontFamily, FontAttributes = fd.FontAttributes, FontSize = fd.FontSize, ForegroundColor = fd.TextColor }); | ||||
|         //        return fs; | ||||
|         //    } | ||||
|         //} | ||||
| 
 | ||||
|         //public FormattedString Challenge | ||||
|         //{ | ||||
|         //    get | ||||
|         //    { | ||||
|         //        var fd = FormatedTextHelpers.FontData.FromResource("content"); | ||||
|         //        var fdb = FormatedTextHelpers.FontData.FromResource("contentbold"); | ||||
|         //        var fs = new FormattedString(); | ||||
|         //        fs.Spans.Add(new Span() { Text = "Dangerosité ", FontFamily = fdb.FontFamily, FontAttributes = fdb.FontAttributes, FontSize = fdb.FontSize, ForegroundColor = fdb.TextColor }); | ||||
|         //        fs.Spans.Add(new Span() { Text = Item.Challenge, FontFamily = fd.FontFamily, FontAttributes = fd.FontAttributes, FontSize = fd.FontSize, ForegroundColor = fd.TextColor }); | ||||
|         //        return fs; | ||||
|         //    } | ||||
|         //} | ||||
| 
 | ||||
|         public Command LoadItemCommand { get; set; } | ||||
| 
 | ||||
|         public ItemDetailViewModel(Item item = null) | ||||
|  |  | |||
|  | @ -73,16 +73,15 @@ namespace AideDeJeu.ViewModels | |||
|             return _AllItems; | ||||
|         } | ||||
| 
 | ||||
|         async Task LoadItemsAsync(CancellationToken token = default) | ||||
|         async Task LoadItemsAsync(CancellationToken cancellationToken = default) | ||||
|         { | ||||
|             IsBusy = true; | ||||
|             Main.IsLoading = true; | ||||
|             try | ||||
|             { | ||||
|                 var filterViewModel = Main.GetFilterViewModel(ItemSourceType); | ||||
|                 var items = await filterViewModel.FilterItems(await GetAllItemsAsync(), token); | ||||
|                 var items = await filterViewModel.FilterItems(await GetAllItemsAsync(), cancellationToken: cancellationToken); | ||||
|                 Main.Items = items.ToList(); | ||||
|                 Main.IsLoading = false; | ||||
|             } | ||||
|             catch (OperationCanceledException ex) | ||||
|             { | ||||
|  | @ -90,16 +89,14 @@ namespace AideDeJeu.ViewModels | |||
|             } | ||||
|             finally | ||||
|             { | ||||
|                 Main.IsLoading = false; | ||||
|                 IsBusy = false; | ||||
|             } | ||||
|         } | ||||
| 
 | ||||
|         public async Task ExecuteLoadItemsCommandAsync() | ||||
|         { | ||||
|             if (cancellationTokenSource != null) | ||||
|             { | ||||
|                 cancellationTokenSource.Cancel(); | ||||
|             } | ||||
|             cancellationTokenSource?.Cancel(); | ||||
|             cancellationTokenSource = new CancellationTokenSource(); | ||||
|             await LoadItemsAsync(cancellationTokenSource.Token); | ||||
|         } | ||||
|  |  | |||
|  | @ -28,11 +28,6 @@ namespace AideDeJeu.Views | |||
|             BindingContext = this.viewModel = itemVM; | ||||
| 
 | ||||
|             mdMarkdown.NavigateToLink = async (s) => await viewModel.Main.NavigateToLink(s); | ||||
|             //mdNameVO.NavigateToLink = async (s) => await viewModel.Main.NavigateToLink(s); | ||||
|             //mdSpecialFeatures.NavigateToLink = async(s) => await viewModel.Main.NavigateToLink(s); | ||||
|             //mdActions.NavigateToLink = async (s) => await viewModel.Main.NavigateToLink(s); | ||||
|             //mdReactions.NavigateToLink = async (s) => await viewModel.Main.NavigateToLink(s); | ||||
|             //mdLegendaryActions.NavigateToLink = async (s) => await viewModel.Main.NavigateToLink(s); | ||||
|         } | ||||
| 
 | ||||
|         public ItemDetailPage() | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Yan Maniez
						Yan Maniez