mirror of
				https://github.com/Nioux/AideDeJeu.git
				synced 2025-10-30 23:16:09 +00:00 
			
		
		
		
	Simplification
This commit is contained in:
		
							parent
							
								
									5c3b573476
								
							
						
					
					
						commit
						96eef2c464
					
				
					 14 changed files with 264 additions and 607 deletions
				
			
		|  | @ -36,11 +36,8 @@ | |||
|     <Compile Update="Views\AboutPage.xaml.cs"> | ||||
|       <SubType>Code</SubType> | ||||
|     </Compile> | ||||
|     <Compile Update="Views\MonsterDetailPage.xaml.cs"> | ||||
|       <DependentUpon>MonsterDetailPage.xaml</DependentUpon> | ||||
|     </Compile> | ||||
|     <Compile Update="Views\SpellDetailPage.xaml.cs"> | ||||
|       <DependentUpon>SpellDetailPage.xaml</DependentUpon> | ||||
|     <Compile Update="Views\ItemDetailPage.xaml.cs"> | ||||
|       <DependentUpon>ItemDetailPage.xaml</DependentUpon> | ||||
|     </Compile> | ||||
|     <Compile Update="Views\MainPage.xaml.cs"> | ||||
|       <DependentUpon>MainPage.xaml</DependentUpon> | ||||
|  |  | |||
							
								
								
									
										218
									
								
								AideDeJeu/AideDeJeu/ViewModels/ItemDetailViewModel.cs
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										218
									
								
								AideDeJeu/AideDeJeu/ViewModels/ItemDetailViewModel.cs
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,218 @@ | |||
| using AideDeJeu.Tools; | ||||
| using AideDeJeuLib; | ||||
| using AideDeJeuLib.Monsters; | ||||
| using System; | ||||
| using System.Diagnostics; | ||||
| using System.Threading.Tasks; | ||||
| using Xamarin.Forms; | ||||
| 
 | ||||
| namespace AideDeJeu.ViewModels | ||||
| { | ||||
|     public class ItemDetailViewModel : BaseViewModel | ||||
|     { | ||||
|         Item _Item = null; | ||||
|         public Item Item | ||||
|         { | ||||
|             get { return _Item; } | ||||
|             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) | ||||
|         { | ||||
|             Title = item?.Name; | ||||
|             Item = item; | ||||
|             LoadItemCommand = new Command(async () => await ExecuteLoadItemCommand()); | ||||
|         } | ||||
|         async Task ExecuteLoadItemCommand() | ||||
|         { | ||||
|         } | ||||
|     } | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
| } | ||||
|  | @ -13,7 +13,7 @@ using System.Linq; | |||
| 
 | ||||
| namespace AideDeJeu.ViewModels | ||||
| { | ||||
|     public abstract class ItemsViewModel : BaseViewModel | ||||
|     public class ItemsViewModel : BaseViewModel | ||||
|     { | ||||
|         CancellationTokenSource cancellationTokenSource; | ||||
| 
 | ||||
|  | @ -23,7 +23,10 @@ namespace AideDeJeu.ViewModels | |||
|             LoadItemsCommand = new Command(async () => await ExecuteLoadItemsCommandAsync().ConfigureAwait(false)); | ||||
|         } | ||||
|         public ICommand LoadItemsCommand { get; protected set; } | ||||
|         public abstract Task ExecuteGotoItemCommandAsync(Item item); | ||||
|         public async Task ExecuteGotoItemCommandAsync(Item item) | ||||
|         { | ||||
|             await Main.Navigator.GotoItemDetailPageAsync(item); | ||||
|         } | ||||
|         protected ItemSourceType ItemSourceType; | ||||
| 
 | ||||
| 
 | ||||
|  |  | |||
|  | @ -27,13 +27,10 @@ namespace AideDeJeu.ViewModels | |||
|     { | ||||
|         Spell = 0x01, | ||||
|         Monster = 0x10, | ||||
|         //VF = 0x0100, | ||||
|         VO = 0x1100, | ||||
|         HD = 0x1000, | ||||
|         //SpellVF = Spell | VF, | ||||
|         SpellVO = Spell | VO, | ||||
|         SpellHD = Spell | HD, | ||||
|         //MonsterVF = Monster | VF, | ||||
|         MonsterVO = Monster | VO, | ||||
|         MonsterHD = Monster | HD, | ||||
|     } | ||||
|  | @ -64,12 +61,10 @@ namespace AideDeJeu.ViewModels | |||
| 
 | ||||
|         public Dictionary<ItemSourceType, Lazy<ItemsViewModel>> AllItemsViewModel = new Dictionary<ItemSourceType, Lazy<ItemsViewModel>>() | ||||
|         { | ||||
|             //{ ItemSourceType.SpellVF, new Lazy<ItemsViewModel>(() => new SpellsViewModel(ItemSourceType.SpellVF)) }, | ||||
|             { ItemSourceType.SpellVO, new Lazy<ItemsViewModel>(() => new SpellsViewModel(ItemSourceType.SpellVO)) }, | ||||
|             { ItemSourceType.SpellHD, new Lazy<ItemsViewModel>(() => new SpellsViewModel(ItemSourceType.SpellHD)) }, | ||||
|             //{ ItemSourceType.MonsterVF, new Lazy<ItemsViewModel>(() => new MonstersViewModel(ItemSourceType.MonsterVF)) }, | ||||
|             { ItemSourceType.MonsterVO, new Lazy<ItemsViewModel>(() => new MonstersViewModel(ItemSourceType.MonsterVO)) }, | ||||
|             { ItemSourceType.MonsterHD, new Lazy<ItemsViewModel>(() => new MonstersViewModel(ItemSourceType.MonsterHD)) }, | ||||
|             { ItemSourceType.SpellVO, new Lazy<ItemsViewModel>(() => new ItemsViewModel(ItemSourceType.SpellVO)) }, | ||||
|             { ItemSourceType.SpellHD, new Lazy<ItemsViewModel>(() => new ItemsViewModel(ItemSourceType.SpellHD)) }, | ||||
|             { ItemSourceType.MonsterVO, new Lazy<ItemsViewModel>(() => new ItemsViewModel(ItemSourceType.MonsterVO)) }, | ||||
|             { ItemSourceType.MonsterHD, new Lazy<ItemsViewModel>(() => new ItemsViewModel(ItemSourceType.MonsterHD)) }, | ||||
|         }; | ||||
| 
 | ||||
|         public ItemsViewModel GetItemsViewModel(ItemSourceType itemSourceType) | ||||
|  | @ -79,10 +74,8 @@ namespace AideDeJeu.ViewModels | |||
| 
 | ||||
|         public Dictionary<ItemSourceType, Lazy<FilterViewModel>> AllFiltersViewModel = new Dictionary<ItemSourceType, Lazy<FilterViewModel>>() | ||||
|         { | ||||
|             //{ ItemSourceType.SpellVF, new Lazy<FilterViewModel>(() => new VFSpellFilterViewModel()) }, | ||||
|             { ItemSourceType.SpellVO, new Lazy<FilterViewModel>(() => new VOSpellFilterViewModel()) }, | ||||
|             { ItemSourceType.SpellHD, new Lazy<FilterViewModel>(() => new HDSpellFilterViewModel()) }, | ||||
|             //{ ItemSourceType.MonsterVF, new Lazy<FilterViewModel>(() => new VFMonsterFilterViewModel()) }, | ||||
|             { ItemSourceType.MonsterVO, new Lazy<FilterViewModel>(() => new VOMonsterFilterViewModel()) }, | ||||
|             { ItemSourceType.MonsterHD, new Lazy<FilterViewModel>(() => new HDMonsterFilterViewModel()) }, | ||||
|         }; | ||||
|  | @ -171,7 +164,7 @@ namespace AideDeJeu.ViewModels | |||
|                     var spell = spells.Where(i => Tools.Helpers.IdFromName(i.Name) == anchor).FirstOrDefault(); | ||||
|                     if (spell != null) | ||||
|                     { | ||||
|                         await Navigator.GotoSpellDetailPageAsync(spell); | ||||
|                         await Navigator.GotoItemDetailPageAsync(spell); | ||||
|                     } | ||||
|                 } | ||||
|                 else if (file == "spells_vo") | ||||
|  | @ -180,7 +173,7 @@ namespace AideDeJeu.ViewModels | |||
|                     var spell = spells.Where(i => Tools.Helpers.IdFromName(i.Name) == anchor).FirstOrDefault(); | ||||
|                     if (spell != null) | ||||
|                     { | ||||
|                         await Navigator.GotoSpellDetailPageAsync(spell); | ||||
|                         await Navigator.GotoItemDetailPageAsync(spell); | ||||
|                     } | ||||
|                 } | ||||
|                 else if (file == "monsters_hd") | ||||
|  | @ -189,7 +182,7 @@ namespace AideDeJeu.ViewModels | |||
|                     var monster = monsters.Where(i => Tools.Helpers.IdFromName(i.Name) == anchor).FirstOrDefault(); | ||||
|                     if (monster != null) | ||||
|                     { | ||||
|                         await Navigator.GotoMonsterDetailPageAsync(monster); | ||||
|                         await Navigator.GotoItemDetailPageAsync(monster); | ||||
|                     } | ||||
|                 } | ||||
|                 else if (file == "monsters_vo") | ||||
|  | @ -198,7 +191,7 @@ namespace AideDeJeu.ViewModels | |||
|                     var monster = monsters.Where(i => Tools.Helpers.IdFromName(i.Name) == anchor).FirstOrDefault(); | ||||
|                     if (monster != null) | ||||
|                     { | ||||
|                         await Navigator.GotoMonsterDetailPageAsync(monster); | ||||
|                         await Navigator.GotoItemDetailPageAsync(monster); | ||||
|                     } | ||||
|                 } | ||||
|                 else | ||||
|  |  | |||
|  | @ -1,217 +0,0 @@ | |||
| using AideDeJeu.Tools; | ||||
| using AideDeJeuLib.Monsters; | ||||
| using System; | ||||
| using System.Diagnostics; | ||||
| using System.Threading.Tasks; | ||||
| using Xamarin.Forms; | ||||
| 
 | ||||
| namespace AideDeJeu.ViewModels | ||||
| { | ||||
|     public class MonsterDetailViewModel : BaseViewModel | ||||
|     { | ||||
|         Monster _Item = null; | ||||
|         public Monster Item | ||||
|         { | ||||
|             get { return _Item; } | ||||
|             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 MonsterDetailViewModel(Monster item = null) | ||||
|         { | ||||
|             Title = item?.Name; | ||||
|             Item = item; | ||||
|             LoadItemCommand = new Command(async () => await ExecuteLoadItemCommand()); | ||||
|         } | ||||
|         async Task ExecuteLoadItemCommand() | ||||
|         { | ||||
|         } | ||||
|     } | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
| } | ||||
|  | @ -1,27 +0,0 @@ | |||
| using AideDeJeu.Tools; | ||||
| using AideDeJeuLib; | ||||
| using AideDeJeuLib.Monsters; | ||||
| using System; | ||||
| using System.Collections.Generic; | ||||
| using System.Collections.ObjectModel; | ||||
| using System.Diagnostics; | ||||
| using System.IO; | ||||
| using System.Linq; | ||||
| using System.Reflection; | ||||
| using System.Runtime.Serialization.Json; | ||||
| using System.Threading.Tasks; | ||||
| 
 | ||||
| namespace AideDeJeu.ViewModels | ||||
| { | ||||
|     public class MonstersViewModel : ItemsViewModel | ||||
|     { | ||||
|         public MonstersViewModel(ItemSourceType itemSourceType) : base(itemSourceType) | ||||
|         { | ||||
|         } | ||||
| 
 | ||||
|         public override async Task ExecuteGotoItemCommandAsync(Item item) | ||||
|         { | ||||
|             await Main.Navigator.GotoMonsterDetailPageAsync(item as Monster); | ||||
|         } | ||||
|     } | ||||
| } | ||||
|  | @ -14,8 +14,7 @@ namespace AideDeJeu.ViewModels | |||
|     public interface INavigator | ||||
|     { | ||||
|         Task GotoAboutPageAsync(); | ||||
|         Task GotoMonsterDetailPageAsync(Item item); | ||||
|         Task GotoSpellDetailPageAsync(Item item); | ||||
|         Task GotoItemDetailPageAsync(Item item); | ||||
|     } | ||||
|     public class Navigator : INavigator | ||||
|     { | ||||
|  | @ -31,26 +30,14 @@ namespace AideDeJeu.ViewModels | |||
|             await Navigation.PushAsync(new Views.AboutPage()); | ||||
|         } | ||||
| 
 | ||||
|         public async Task GotoMonsterDetailPageAsync(Item item) | ||||
|         public async Task GotoItemDetailPageAsync(Item item) | ||||
|         { | ||||
|             var monster = item as Monster; | ||||
|             if (item == null) | ||||
|                 return; | ||||
| 
 | ||||
|             var vm = new MonsterDetailViewModel(monster); | ||||
|             var vm = new ItemDetailViewModel(item); | ||||
|             vm.LoadItemCommand.Execute(null); | ||||
|             await Navigation.PushAsync(new MonsterDetailPage(vm)); | ||||
|         } | ||||
| 
 | ||||
|         public async Task GotoSpellDetailPageAsync(Item item) | ||||
|         { | ||||
|             var spell = item as Spell; | ||||
|             if (item == null) | ||||
|                 return; | ||||
| 
 | ||||
|             var vm = new SpellDetailViewModel(spell); | ||||
|             vm.LoadItemCommand.Execute(null); | ||||
|             await Navigation.PushAsync(new SpellDetailPage(vm)); | ||||
|             await Navigation.PushAsync(new ItemDetailPage(vm)); | ||||
|         } | ||||
| 
 | ||||
| 
 | ||||
|  |  | |||
|  | @ -1,110 +0,0 @@ | |||
| using AideDeJeu.Tools; | ||||
| using AideDeJeuLib.Spells; | ||||
| using System; | ||||
| using System.Collections.Generic; | ||||
| using System.Collections.ObjectModel; | ||||
| using System.Diagnostics; | ||||
| using System.Linq; | ||||
| using System.Threading.Tasks; | ||||
| using Xamarin.Forms; | ||||
| 
 | ||||
| namespace AideDeJeu.ViewModels | ||||
| { | ||||
|     public class SpellDetailViewModel : BaseViewModel | ||||
|     { | ||||
|         Spell _Item = null; | ||||
|         public Spell Item | ||||
|         { | ||||
|             get { return _Item; } | ||||
|             set | ||||
|             { | ||||
|                 SetProperty(ref _Item, value); | ||||
|                 OnPropertyChanged(nameof(TypeLevel)); | ||||
|                 OnPropertyChanged(nameof(CastingTime)); | ||||
|                 OnPropertyChanged(nameof(Range)); | ||||
|                 OnPropertyChanged(nameof(Components)); | ||||
|                 OnPropertyChanged(nameof(Duration)); | ||||
|             } | ||||
|         } | ||||
| 
 | ||||
|         public FormattedString TypeLevel | ||||
|         { | ||||
|             get | ||||
|             { | ||||
|                 var fd = FormatedTextHelpers.FontData.FromResource("contentital"); | ||||
|                 var fs = new FormattedString(); | ||||
|                 var capType = Item?.Type?.First().ToString()?.ToUpper() + Item?.Type?.Substring(1); | ||||
|                 fs.Spans.Add(new Span() { Text = string.Format("{0} de niveau {1} {2}", capType, Item?.Level, Item?.Rituel), FontFamily = fd.FontFamily, FontAttributes = fd.FontAttributes, FontSize = fd.FontSize, ForegroundColor = fd.TextColor}); | ||||
|                 return fs; | ||||
|             } | ||||
|         } | ||||
| 
 | ||||
|         public FormattedString CastingTime | ||||
|         { | ||||
|             get | ||||
|             { | ||||
|                 var fd = FormatedTextHelpers.FontData.FromResource("content"); | ||||
|                 var fdb = FormatedTextHelpers.FontData.FromResource("contentbold"); | ||||
|                 var fs = new FormattedString(); | ||||
|                 fs.Spans.Add(new Span() { Text = "Durée d'incantation : ", FontFamily = fdb.FontFamily, FontAttributes = fdb.FontAttributes, FontSize = fdb.FontSize, ForegroundColor = fdb.TextColor }); | ||||
|                 fs.Spans.Add(new Span() { Text = Item.CastingTime, FontFamily = fd.FontFamily, FontAttributes = fd.FontAttributes, FontSize = fd.FontSize, ForegroundColor = fd.TextColor }); | ||||
|                 return fs; | ||||
|             } | ||||
|         } | ||||
| 
 | ||||
|         public FormattedString Range | ||||
|         { | ||||
|             get | ||||
|             { | ||||
|                 var fd = FormatedTextHelpers.FontData.FromResource("content"); | ||||
|                 var fdb = FormatedTextHelpers.FontData.FromResource("contentbold"); | ||||
|                 var fs = new FormattedString(); | ||||
|                 fs.Spans.Add(new Span() { Text = "Portée : ", FontFamily = fdb.FontFamily, FontAttributes = fdb.FontAttributes, FontSize = fdb.FontSize, ForegroundColor = fdb.TextColor }); | ||||
|                 fs.Spans.Add(new Span() { Text = Item.Range, FontFamily = fd.FontFamily, FontAttributes = fd.FontAttributes, FontSize = fd.FontSize, ForegroundColor = fd.TextColor }); | ||||
|                 return fs; | ||||
|             } | ||||
|         } | ||||
| 
 | ||||
|         public FormattedString Components | ||||
|         { | ||||
|             get | ||||
|             { | ||||
|                 var fd = FormatedTextHelpers.FontData.FromResource("content"); | ||||
|                 var fdb = FormatedTextHelpers.FontData.FromResource("contentbold"); | ||||
|                 var fs = new FormattedString(); | ||||
|                 fs.Spans.Add(new Span() { Text = "Composantes : ", FontFamily = fdb.FontFamily, FontAttributes = fdb.FontAttributes, FontSize = fdb.FontSize, ForegroundColor = fdb.TextColor }); | ||||
|                 fs.Spans.Add(new Span() { Text = Item.Components, FontFamily = fd.FontFamily, FontAttributes = fd.FontAttributes, FontSize = fd.FontSize, ForegroundColor = fd.TextColor }); | ||||
|                 return fs; | ||||
|             } | ||||
|         } | ||||
| 
 | ||||
|         public FormattedString Duration | ||||
|         { | ||||
|             get | ||||
|             { | ||||
|                 var fd = FormatedTextHelpers.FontData.FromResource("content"); | ||||
|                 var fdb = FormatedTextHelpers.FontData.FromResource("contentbold"); | ||||
|                 var fs = new FormattedString(); | ||||
|                 fs.Spans.Add(new Span() { Text = "Durée : ", FontFamily = fdb.FontFamily, FontAttributes = fdb.FontAttributes, FontSize = fdb.FontSize, ForegroundColor = fdb.TextColor }); | ||||
|                 fs.Spans.Add(new Span() { Text = Item.Duration, FontFamily = fd.FontFamily, FontAttributes = fd.FontAttributes, FontSize = fd.FontSize, ForegroundColor = fd.TextColor }); | ||||
|                 return fs; | ||||
|             } | ||||
|         } | ||||
| 
 | ||||
|         public Command LoadItemCommand { get; set; } | ||||
| 
 | ||||
|         public SpellDetailViewModel(Spell item = null) | ||||
|         { | ||||
|             Title = item?.Name; | ||||
|             Item = item; | ||||
|             LoadItemCommand = new Command(async () => await ExecuteLoadItemCommand()); | ||||
|         } | ||||
|         async Task ExecuteLoadItemCommand() | ||||
|         { | ||||
|         } | ||||
|     } | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
| } | ||||
|  | @ -1,27 +0,0 @@ | |||
| using AideDeJeuLib; | ||||
| using AideDeJeuLib.Spells; | ||||
| using System; | ||||
| using System.Collections.Generic; | ||||
| using System.Collections.ObjectModel; | ||||
| using System.Diagnostics; | ||||
| using System.IO; | ||||
| using System.Linq; | ||||
| using System.Reflection; | ||||
| using System.Runtime.Serialization.Json; | ||||
| using System.Threading.Tasks; | ||||
| 
 | ||||
| namespace AideDeJeu.ViewModels | ||||
| { | ||||
|     public class SpellsViewModel : ItemsViewModel | ||||
|     { | ||||
|         public SpellsViewModel(ItemSourceType itemSourceType) : base(itemSourceType) | ||||
|         { | ||||
|         } | ||||
| 
 | ||||
|         public override async Task ExecuteGotoItemCommandAsync(Item item) | ||||
|         { | ||||
|             await Main.Navigator.GotoSpellDetailPageAsync(item as Spell); | ||||
|         } | ||||
| 
 | ||||
|     } | ||||
| } | ||||
							
								
								
									
										20
									
								
								AideDeJeu/AideDeJeu/Views/ItemDetailPage.xaml
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										20
									
								
								AideDeJeu/AideDeJeu/Views/ItemDetailPage.xaml
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,20 @@ | |||
| <?xml version="1.0" encoding="utf-8" ?> | ||||
| <ContentPage xmlns="http://xamarin.com/schemas/2014/forms" | ||||
|              xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" | ||||
|              xmlns:tools="clr-namespace:AideDeJeu.Tools" | ||||
|              xmlns:mdview="clr-namespace:Xam.Forms.Markdown" | ||||
|              x:Class="AideDeJeu.Views.ItemDetailPage" | ||||
|              Title="{Binding Title}"> | ||||
|     <ContentPage.Resources> | ||||
|         <ResourceDictionary> | ||||
|             <tools:MonsterMarkdownTheme x:Key="MonsterMarkdownTheme" /> | ||||
|             <tools:NullToFalseConverter x:Key="NullToFalseConverter" /> | ||||
|             <tools:StringListToStringConverter x:Key="StringListToStringConverter" /> | ||||
|         </ResourceDictionary> | ||||
|     </ContentPage.Resources> | ||||
|     <ScrollView Orientation="Vertical" BackgroundColor="#fdf1dc"> | ||||
|         <StackLayout Orientation="Vertical" Padding="15"> | ||||
|             <mdview:MarkdownView x:Name="mdMarkdown" Theme="{StaticResource MonsterMarkdownTheme}" Markdown="{Binding Item.Markdown}" /> | ||||
|         </StackLayout> | ||||
|     </ScrollView> | ||||
| </ContentPage> | ||||
|  | @ -12,19 +12,20 @@ using System.Linq; | |||
| using AideDeJeuLib.Spells; | ||||
| using System.Text; | ||||
| using System.Globalization; | ||||
| using AideDeJeuLib; | ||||
| 
 | ||||
| namespace AideDeJeu.Views | ||||
| { | ||||
|     [XamlCompilation(XamlCompilationOptions.Compile)] | ||||
| 	public partial class MonsterDetailPage : ContentPage | ||||
| 	public partial class ItemDetailPage : ContentPage | ||||
| 	{ | ||||
|         MonsterDetailViewModel viewModel; | ||||
|         ItemDetailViewModel viewModel; | ||||
| 
 | ||||
|         public MonsterDetailPage(MonsterDetailViewModel viewModel) | ||||
|         public ItemDetailPage(ItemDetailViewModel itemVM) | ||||
|         { | ||||
|             InitializeComponent(); | ||||
| 
 | ||||
|             BindingContext = this.viewModel = viewModel; | ||||
|             BindingContext = this.viewModel = itemVM; | ||||
| 
 | ||||
|             mdMarkdown.NavigateToLink = async (s) => await viewModel.Main.NavigateToLink(s); | ||||
|             //mdNameVO.NavigateToLink = async (s) => await viewModel.Main.NavigateToLink(s); | ||||
|  | @ -34,7 +35,7 @@ namespace AideDeJeu.Views | |||
|             //mdLegendaryActions.NavigateToLink = async (s) => await viewModel.Main.NavigateToLink(s); | ||||
|         } | ||||
| 
 | ||||
|         public MonsterDetailPage() | ||||
|         public ItemDetailPage() | ||||
|         { | ||||
|             InitializeComponent(); | ||||
| 
 | ||||
|  | @ -45,7 +46,7 @@ namespace AideDeJeu.Views | |||
|                 //Description = "This is an item description." | ||||
|             }; | ||||
| 
 | ||||
|             viewModel = new MonsterDetailViewModel(item); | ||||
|             viewModel = new ItemDetailViewModel(item); | ||||
|             BindingContext = viewModel; | ||||
|         } | ||||
| 
 | ||||
|  | @ -1,96 +0,0 @@ | |||
| <?xml version="1.0" encoding="utf-8" ?> | ||||
| <ContentPage xmlns="http://xamarin.com/schemas/2014/forms" | ||||
|              xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" | ||||
|              xmlns:tools="clr-namespace:AideDeJeu.Tools" | ||||
|              xmlns:skia="clr-namespace:SkiaSharp.Views.Forms;assembly=SkiaSharp.Views.Forms" | ||||
|              xmlns:mdview="clr-namespace:Xam.Forms.Markdown" | ||||
|              x:Class="AideDeJeu.Views.MonsterDetailPage" | ||||
|              Title="{Binding Title}"> | ||||
|     <ContentPage.Resources> | ||||
|         <ResourceDictionary> | ||||
|             <tools:MonsterMarkdownTheme x:Key="MonsterMarkdownTheme" /> | ||||
|             <tools:NullToFalseConverter x:Key="NullToFalseConverter" /> | ||||
|             <tools:StringListToStringConverter x:Key="StringListToStringConverter" /> | ||||
|         </ResourceDictionary> | ||||
|     </ContentPage.Resources> | ||||
|     <ScrollView Orientation="Vertical" BackgroundColor="#fdf1dc"> | ||||
|         <StackLayout Orientation="Vertical" Padding="15"> | ||||
| 
 | ||||
|             <mdview:MarkdownView x:Name="mdMarkdown" Theme="{StaticResource MonsterMarkdownTheme}" Markdown="{Binding Item.Markdown}" /> | ||||
|             <!--<skia:SKCanvasView PaintSurface="PaintHeaderBar" HorizontalOptions="FillAndExpand" HeightRequest="8" /> | ||||
|              | ||||
|             <Label Text="{Binding Item.Name}" Style="{StaticResource Key=subsection}" /> | ||||
|             <mdview:MarkdownView x:Name="mdNameVO" Theme="{StaticResource MonsterMarkdownTheme}" Markdown="{Binding Item.Markdown}" /> | ||||
| 
 | ||||
|             <Label FormattedText="{Binding TypeSizeAlignment}" /> | ||||
| 
 | ||||
|             <skia:SKCanvasView PaintSurface="PaintRedBar" HorizontalOptions="FillAndExpand" HeightRequest="8"/> | ||||
| 
 | ||||
|             <Label FormattedText="{Binding ArmorClass}" Style="{StaticResource Key=content}" /> | ||||
|             <Label FormattedText="{Binding HitPoints}" Style="{StaticResource Key=content}" /> | ||||
|             <Label FormattedText="{Binding Speed}" Style="{StaticResource Key=content}" /> | ||||
| 
 | ||||
|             <skia:SKCanvasView PaintSurface="PaintRedBar" HorizontalOptions="FillAndExpand" HeightRequest="8"/> | ||||
| 
 | ||||
|             <Grid> | ||||
|                 <Grid.ColumnDefinitions> | ||||
|                     <ColumnDefinition Width="*" /> | ||||
|                     <ColumnDefinition Width="*" /> | ||||
|                     <ColumnDefinition Width="*" /> | ||||
|                     <ColumnDefinition Width="*" /> | ||||
|                     <ColumnDefinition Width="*" /> | ||||
|                     <ColumnDefinition Width="*" /> | ||||
|                 </Grid.ColumnDefinitions> | ||||
|                 <Grid.RowDefinitions> | ||||
|                     <RowDefinition Height="*" /> | ||||
|                     <RowDefinition Height="*" /> | ||||
|                 </Grid.RowDefinitions> | ||||
|                 <Label Grid.Row="0" Grid.Column="0" Text="FOR" HorizontalTextAlignment="Center" Style="{StaticResource Key=content}" /> | ||||
|                 <Label Grid.Row="1" Grid.Column="0" Text="{Binding Item.Strength}" HorizontalTextAlignment="Center" Style="{StaticResource Key=content}" /> | ||||
|                 <Label Grid.Row="0" Grid.Column="1" Text="DEX" HorizontalTextAlignment="Center" Style="{StaticResource Key=content}" /> | ||||
|                 <Label Grid.Row="1" Grid.Column="1" Text="{Binding Item.Dexterity}" HorizontalTextAlignment="Center" Style="{StaticResource Key=content}" /> | ||||
|                 <Label Grid.Row="0" Grid.Column="2" Text="CON" HorizontalTextAlignment="Center" Style="{StaticResource Key=content}" /> | ||||
|                 <Label Grid.Row="1" Grid.Column="2" Text="{Binding Item.Constitution}" HorizontalTextAlignment="Center" Style="{StaticResource Key=content}" /> | ||||
|                 <Label Grid.Row="0" Grid.Column="3" Text="INT" HorizontalTextAlignment="Center" Style="{StaticResource Key=content}" /> | ||||
|                 <Label Grid.Row="1" Grid.Column="3" Text="{Binding Item.Intelligence}" HorizontalTextAlignment="Center" Style="{StaticResource Key=content}" /> | ||||
|                 <Label Grid.Row="0" Grid.Column="4" Text="SAG" HorizontalTextAlignment="Center" Style="{StaticResource Key=content}" /> | ||||
|                 <Label Grid.Row="1" Grid.Column="4" Text="{Binding Item.Wisdom}" HorizontalTextAlignment="Center" Style="{StaticResource Key=content}" /> | ||||
|                 <Label Grid.Row="0" Grid.Column="5" Text="CHA" HorizontalTextAlignment="Center" Style="{StaticResource Key=content}" /> | ||||
|                 <Label Grid.Row="1" Grid.Column="5" Text="{Binding Item.Charisma}" HorizontalTextAlignment="Center" Style="{StaticResource Key=content}" /> | ||||
|             </Grid> | ||||
| 
 | ||||
|             <skia:SKCanvasView PaintSurface="PaintRedBar" HorizontalOptions="FillAndExpand" HeightRequest="8"/> | ||||
| 
 | ||||
|             <Label FormattedText="{Binding SavingThrows}" IsVisible="{Binding Item.SavingThrows, Converter={StaticResource NullToFalseConverter}}" Style="{StaticResource Key=content}" /> | ||||
|             <Label FormattedText="{Binding Skills}" IsVisible="{Binding Item.Skills, Converter={StaticResource NullToFalseConverter}}" Style="{StaticResource Key=content}" /> | ||||
|             <Label FormattedText="{Binding DamageVulnerabilities}" IsVisible="{Binding Item.DamageVulnerabilities, Converter={StaticResource NullToFalseConverter}}" Style="{StaticResource Key=content}" /> | ||||
|             <Label FormattedText="{Binding DamageResistances}" IsVisible="{Binding Item.DamageResistances, Converter={StaticResource NullToFalseConverter}}" Style="{StaticResource Key=content}" /> | ||||
|             <Label FormattedText="{Binding DamageImmunities}" IsVisible="{Binding Item.DamageImmunities, Converter={StaticResource NullToFalseConverter}}" Style="{StaticResource Key=content}" /> | ||||
|             <Label FormattedText="{Binding ConditionImmunities}" IsVisible="{Binding Item.ConditionImmunities, Converter={StaticResource NullToFalseConverter}}" Style="{StaticResource Key=content}" /> | ||||
|             <Label FormattedText="{Binding Senses}" IsVisible="{Binding Item.Senses, Converter={StaticResource NullToFalseConverter}}" Style="{StaticResource Key=content}" /> | ||||
|             <Label FormattedText="{Binding Languages}" IsVisible="{Binding Item.Languages, Converter={StaticResource NullToFalseConverter}}" Style="{StaticResource Key=content}" /> | ||||
|             <Label FormattedText="{Binding Challenge}" IsVisible="{Binding Item.Challenge, Converter={StaticResource NullToFalseConverter}}" Style="{StaticResource Key=content}" /> | ||||
| 
 | ||||
|             <skia:SKCanvasView PaintSurface="PaintRedBar" HorizontalOptions="FillAndExpand" HeightRequest="8"/> | ||||
| 
 | ||||
|             <Label Text="Capacités" Style="{StaticResource Key=subsubsection}" IsVisible="{Binding Item.SpecialFeatures, Converter={StaticResource NullToFalseConverter}}" /> | ||||
|             <mdview:MarkdownView x:Name="mdSpecialFeatures" Theme="{StaticResource MonsterMarkdownTheme}" Markdown="{Binding Item.SpecialFeatures, Converter={StaticResource StringListToStringConverter}}"  IsVisible="{Binding Item.SpecialFeatures, Converter={StaticResource NullToFalseConverter}}" /> | ||||
| 
 | ||||
|             <Label Text="Actions" Style="{StaticResource Key=subsubsection}" IsVisible="{Binding Item.Actions, Converter={StaticResource NullToFalseConverter}}" /> | ||||
|             <mdview:MarkdownView x:Name="mdActions" Theme="{StaticResource MonsterMarkdownTheme}" Markdown="{Binding Item.Actions, Converter={StaticResource StringListToStringConverter}}" IsVisible="{Binding Item.Actions, Converter={StaticResource NullToFalseConverter}}" /> | ||||
| 
 | ||||
|             <Label Text="Réactions" Style="{StaticResource Key=subsubsection}" IsVisible="{Binding Item.Reactions, Converter={StaticResource NullToFalseConverter}}" /> | ||||
|             <mdview:MarkdownView x:Name="mdReactions" Theme="{StaticResource MonsterMarkdownTheme}" Markdown="{Binding Item.Reactions, Converter={StaticResource StringListToStringConverter}}" IsVisible="{Binding Item.Reactions, Converter={StaticResource NullToFalseConverter}}" /> | ||||
| 
 | ||||
|             <Label Text="Actions légendaires" Style="{StaticResource Key=subsubsection}" IsVisible="{Binding Item.LegendaryActions, Converter={StaticResource NullToFalseConverter}}" /> | ||||
|             <mdview:MarkdownView x:Name="mdLegendaryActions" Theme="{StaticResource MonsterMarkdownTheme}" Markdown="{Binding Item.LegendaryActions, Converter={StaticResource StringListToStringConverter}}" IsVisible="{Binding Item.LegendaryActions, Converter={StaticResource NullToFalseConverter}}" /> | ||||
| 
 | ||||
|             <skia:SKCanvasView PaintSurface="PaintHeaderBar" HorizontalOptions="FillAndExpand" HeightRequest="8" /> | ||||
| 
 | ||||
|             <Label Text="{Binding Item.Description}" Style="{StaticResource Key=content}" /> | ||||
|             <Label Text="{Binding Item.Legendary}" Style="{StaticResource Key=content}" /> | ||||
|             <Label Text="{Binding Item.Source}" Style="{StaticResource Key=content}" />--> | ||||
| 
 | ||||
|         </StackLayout> | ||||
|     </ScrollView> | ||||
| </ContentPage> | ||||
|  | @ -1,39 +0,0 @@ | |||
| <?xml version="1.0" encoding="utf-8" ?> | ||||
| <ContentPage xmlns="http://xamarin.com/schemas/2014/forms" | ||||
|              xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" | ||||
|              xmlns:tools="clr-namespace:AideDeJeu.Tools" | ||||
|              xmlns:mdview="clr-namespace:Xam.Forms.Markdown" | ||||
|              x:Class="AideDeJeu.Views.SpellDetailPage" | ||||
|              Title="{Binding Title}"> | ||||
|     <ContentPage.Resources> | ||||
|         <ResourceDictionary> | ||||
|             <tools:MonsterMarkdownTheme x:Key="MonsterMarkdownTheme" /> | ||||
|             <tools:NullToFalseConverter x:Key="NullToFalseConverter" /> | ||||
|             <tools:StringListToStringConverter x:Key="StringListToStringConverter" /> | ||||
|         </ResourceDictionary> | ||||
|     </ContentPage.Resources> | ||||
|     <ScrollView VerticalScrollBarVisibility="Default" HorizontalScrollBarVisibility="Default"> | ||||
|         <StackLayout Orientation="Vertical" Padding="15"> | ||||
|             <!--<Label Text="{Binding Item.Name}" Style="{StaticResource Key=subsection}" /> | ||||
|             <mdview:MarkdownView x:Name="mdNameVO" Theme="{StaticResource MonsterMarkdownTheme}" Markdown="{Binding Item.NameVO}" /> | ||||
| 
 | ||||
|             <Label Text=" " /> | ||||
| 
 | ||||
|             <Label FormattedText="{Binding TypeLevel}" /> | ||||
| 
 | ||||
|             <Label FormattedText="{Binding CastingTime}" /> | ||||
| 
 | ||||
|             <Label FormattedText="{Binding Range}" /> | ||||
| 
 | ||||
|             <Label FormattedText="{Binding Components}" /> | ||||
| 
 | ||||
|             <Label FormattedText="{Binding Duration}" /> | ||||
| 
 | ||||
|             <Label Text=" " />--> | ||||
| 
 | ||||
|             <mdview:MarkdownView x:Name="mdDescription" Theme="{StaticResource MonsterMarkdownTheme}" Markdown="{Binding Item.Markdown}" /> | ||||
| 
 | ||||
|             <!--<Label Text="{Binding Item.Source}" Style="{StaticResource Key=content}" />--> | ||||
|         </StackLayout> | ||||
|     </ScrollView> | ||||
| </ContentPage> | ||||
|  | @ -1,46 +0,0 @@ | |||
|  | ||||
| using AideDeJeu.ViewModels; | ||||
| using AideDeJeuLib.Spells; | ||||
| using Xamarin.Forms; | ||||
| using Xamarin.Forms.Xaml; | ||||
| 
 | ||||
| namespace AideDeJeu.Views | ||||
| { | ||||
|     [XamlCompilation(XamlCompilationOptions.Compile)] | ||||
| 	public partial class SpellDetailPage : ContentPage | ||||
| 	{ | ||||
|         SpellDetailViewModel viewModel; | ||||
| 
 | ||||
|         public SpellDetailPage(SpellDetailViewModel viewModel) | ||||
|         { | ||||
|             InitializeComponent(); | ||||
| 
 | ||||
|             BindingContext = this.viewModel = viewModel; | ||||
| 
 | ||||
|             //mdNameVO.NavigateToLink = async (s) => await viewModel.Main.NavigateToLink(s); | ||||
|             mdDescription.NavigateToLink = async (s) => await viewModel.Main.NavigateToLink(s); | ||||
| 
 | ||||
|         } | ||||
| 
 | ||||
|         public SpellDetailPage() | ||||
|         { | ||||
|             InitializeComponent(); | ||||
| 
 | ||||
|             var item = new SpellHD | ||||
|             { | ||||
|                 Name = "", | ||||
|                 NameVO = "", | ||||
|                 //Description = "This is an item description." | ||||
|             }; | ||||
| 
 | ||||
|             viewModel = new SpellDetailViewModel(item); | ||||
|             BindingContext = viewModel; | ||||
|         } | ||||
| 
 | ||||
|         private void ListView_ItemTapped(object sender, ItemTappedEventArgs e) | ||||
|         { | ||||
|             if (e.Item == null) return; | ||||
|             ((ListView)sender).SelectedItem = null; | ||||
|         } | ||||
|     } | ||||
| } | ||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Yan Maniez
						Yan Maniez