mirror of
				https://github.com/Nioux/AideDeJeu.git
				synced 2025-10-30 23:16:09 +00:00 
			
		
		
		
	Début vue pdf
This commit is contained in:
		
							parent
							
								
									e8fe98b227
								
							
						
					
					
						commit
						8fa16487eb
					
				
					 8 changed files with 108 additions and 87 deletions
				
			
		|  | @ -178,6 +178,9 @@ | ||||||
|     <EmbeddedResource Update="Views\PlayerCharacter\FinalizeView.xaml"> |     <EmbeddedResource Update="Views\PlayerCharacter\FinalizeView.xaml"> | ||||||
|       <Generator>MSBuild:UpdateDesignTimeXaml</Generator> |       <Generator>MSBuild:UpdateDesignTimeXaml</Generator> | ||||||
|     </EmbeddedResource> |     </EmbeddedResource> | ||||||
|  |     <EmbeddedResource Update="Views\PlayerCharacter\PdfViewPage.xaml"> | ||||||
|  |       <Generator>MSBuild:UpdateDesignTimeXaml</Generator> | ||||||
|  |     </EmbeddedResource> | ||||||
|     <EmbeddedResource Update="Views\PlayerCharacter\PlayerCharacterEditorPage.xaml"> |     <EmbeddedResource Update="Views\PlayerCharacter\PlayerCharacterEditorPage.xaml"> | ||||||
|       <Generator>MSBuild:UpdateDesignTimeXaml</Generator> |       <Generator>MSBuild:UpdateDesignTimeXaml</Generator> | ||||||
|     </EmbeddedResource> |     </EmbeddedResource> | ||||||
|  |  | ||||||
|  | @ -39,29 +39,18 @@ namespace AideDeJeu.ViewModels.PlayerCharacter | ||||||
|             SelectedPlayerCharacter.Background.PropertyChanged += Background_PropertyChanged; |             SelectedPlayerCharacter.Background.PropertyChanged += Background_PropertyChanged; | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|  |             // raz des listes de choix | ||||||
|             ResetAlignments(); |             ResetAlignments(); | ||||||
|             Races = await Task.Run(async () => await LoadRacesAsync()); |             Races = await Task.Run(async () => await LoadRacesAsync()); | ||||||
|             Classes = await Task.Run(async () => await LoadClassesAsync()); |             Classes = await Task.Run(async () => await LoadClassesAsync()); | ||||||
| 
 |  | ||||||
|             Backgrounds = await Task.Run(async () => await LoadBackgroundsAsync()); |             Backgrounds = await Task.Run(async () => await LoadBackgroundsAsync()); | ||||||
|             //SelectedBackground = null; |  | ||||||
|             //NotifySelectedBackground = new NotifyTaskCompletion<BackgroundItem>(null); |  | ||||||
|             SubBackgrounds = null; |             SubBackgrounds = null; | ||||||
|             //SelectedSubBackground = null; |  | ||||||
|             //NotifySelectedSubBackground = new NotifyTaskCompletion<SubBackgroundItem>(null); |  | ||||||
|             PersonalityTraits = null; |             PersonalityTraits = null; | ||||||
|             PersonalityIdeals = null; |             PersonalityIdeals = null; | ||||||
|             PersonalityLinks = null; |             PersonalityLinks = null; | ||||||
|             PersonalityDefects = null; |             PersonalityDefects = null; | ||||||
|             //SelectedPersonalityTrait = null; |  | ||||||
|             //SelectedPersonalityIdeal = null; |  | ||||||
|             //SelectedPersonalityLink = null; |  | ||||||
|             //SelectedPersonalityDefect = null; |  | ||||||
|             BackgroundSpecialties = null; |             BackgroundSpecialties = null; | ||||||
|             SubBackgroundSpecialties = null; |             SubBackgroundSpecialties = null; | ||||||
|             //BackgroundSpecialty = null; |  | ||||||
|             SelectedPlayerCharacter.Background.BackgroundSkill = null; |  | ||||||
|             SelectedPlayerCharacter.Background.SubBackgroundSkill = null; |  | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|         private async void Background_PropertyChanged(object sender, PropertyChangedEventArgs e) |         private async void Background_PropertyChanged(object sender, PropertyChangedEventArgs e) | ||||||
|  | @ -187,8 +176,8 @@ namespace AideDeJeu.ViewModels.PlayerCharacter | ||||||
|         #endregion Selected PC |         #endregion Selected PC | ||||||
| 
 | 
 | ||||||
|         #region Alignment |         #region Alignment | ||||||
|         private NotifyTaskCompletion<List<AlignmentItem>> _Alignments = null; |         private List<AlignmentItem> _Alignments = null; | ||||||
|         public NotifyTaskCompletion<List<AlignmentItem>> Alignments |         public List<AlignmentItem> Alignments | ||||||
|         { |         { | ||||||
|             get |             get | ||||||
|             { |             { | ||||||
|  | @ -215,9 +204,9 @@ namespace AideDeJeu.ViewModels.PlayerCharacter | ||||||
|             } |             } | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|         private void ResetAlignments() |         private async Task ResetAlignments() | ||||||
|         { |         { | ||||||
|             Alignments = new NotifyTaskCompletion<List<AlignmentItem>>(Task.Run(() => LoadAlignmentsAsync())); |             Alignments = await LoadAlignmentsAsync(); | ||||||
|             if (!string.IsNullOrEmpty(SelectedPlayerCharacter.Background.PersonalityIdeal)) |             if (!string.IsNullOrEmpty(SelectedPlayerCharacter.Background.PersonalityIdeal)) | ||||||
|             { |             { | ||||||
|                 var regex = new Regex(".*\\((?<alignment>.*?)\\)$"); |                 var regex = new Regex(".*\\((?<alignment>.*?)\\)$"); | ||||||
|  | @ -225,17 +214,17 @@ namespace AideDeJeu.ViewModels.PlayerCharacter | ||||||
|                 var alignment = match.Groups["alignment"].Value; |                 var alignment = match.Groups["alignment"].Value; | ||||||
|                 if (!string.IsNullOrEmpty(alignment) && alignment.ToLower() != "tous") |                 if (!string.IsNullOrEmpty(alignment) && alignment.ToLower() != "tous") | ||||||
|                 { |                 { | ||||||
|                     Alignments = new NotifyTaskCompletion<List<AlignmentItem>>(Task.Run(() => LoadAlignmentsAsync(alignment))); |                     Alignments = await LoadAlignmentsAsync(alignment); | ||||||
|                     SelectedPlayerCharacter.Alignment = null; |                     SelectedPlayerCharacter.Alignment = null; | ||||||
|                 } |                 } | ||||||
|                 else |                 else | ||||||
|                 { |                 { | ||||||
|                     Alignments = new NotifyTaskCompletion<List<AlignmentItem>>(Task.Run(() => LoadAlignmentsAsync())); |                     Alignments = await LoadAlignmentsAsync(); | ||||||
|                 } |                 } | ||||||
|             } |             } | ||||||
|             else |             else | ||||||
|             { |             { | ||||||
|                 Alignments = new NotifyTaskCompletion<List<AlignmentItem>>(Task.Run(() => LoadAlignmentsAsync())); |                 Alignments = await LoadAlignmentsAsync(); | ||||||
|             } |             } | ||||||
|         } |         } | ||||||
|         #endregion Alignment |         #endregion Alignment | ||||||
|  | @ -1233,13 +1222,13 @@ namespace AideDeJeu.ViewModels.PlayerCharacter | ||||||
|             } |             } | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|         async Task ExecuteGenerateAndOpenPdfCommandAsync() |         public async Task ExecuteGenerateAndOpenPdfCommandAsync() | ||||||
|         { |         { | ||||||
|             await GeneratePdfAsync(); |             await GeneratePdfAsync(SelectedPlayerCharacter); | ||||||
|             await OpenPdfAsync(); |             await OpenPdfAsync(); | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|         async Task GeneratePdfAsync() |         public async Task<string> GeneratePdfAsync(PlayerCharacterViewModel playerCharacter) | ||||||
|         { |         { | ||||||
|             //PdfDocument pdfDoc = new PdfDocument(new PdfReader(SRC), new PdfWriter(dest)); |             //PdfDocument pdfDoc = new PdfDocument(new PdfReader(SRC), new PdfWriter(dest)); | ||||||
|             //PdfDocument srcDoc; |             //PdfDocument srcDoc; | ||||||
|  | @ -1259,7 +1248,8 @@ namespace AideDeJeu.ViewModels.PlayerCharacter | ||||||
|             //System.Text.Encoding.RegisterProvider(System.Text.CodePagesEncodingProvider.Instance); |             //System.Text.Encoding.RegisterProvider(System.Text.CodePagesEncodingProvider.Instance); | ||||||
|             //PdfDocument pdfDoc = new PdfDocument(new PdfWriter()); |             //PdfDocument pdfDoc = new PdfDocument(new PdfWriter()); | ||||||
|             //var stream = DependencyService.Get<INativeAPI>().CreateStream("test.pdf"); |             //var stream = DependencyService.Get<INativeAPI>().CreateStream("test.pdf"); | ||||||
|             var stream = new FileStream(Path.Combine(Xamarin.Essentials.FileSystem.CacheDirectory, "test.pdf"), FileMode.Create, FileAccess.ReadWrite); |             var filePath = Path.Combine(Xamarin.Essentials.FileSystem.CacheDirectory, "test.pdf"); | ||||||
|  |             var stream = new FileStream(filePath, FileMode.Create, FileAccess.ReadWrite); | ||||||
| 
 | 
 | ||||||
|             //PdfReader reader = new PdfReader(AideDeJeu.Tools.Helpers.GetResourceStream("AideDeJeu.Pdf.178_hd_01_feuille_de_perso_v1.pdf")); |             //PdfReader reader = new PdfReader(AideDeJeu.Tools.Helpers.GetResourceStream("AideDeJeu.Pdf.178_hd_01_feuille_de_perso_v1.pdf")); | ||||||
|             PdfReader reader = new PdfReader(AideDeJeu.Tools.Helpers.GetResourceStream("AideDeJeu.Pdf.feuille_de_personnage_editable.pdf")); |             PdfReader reader = new PdfReader(AideDeJeu.Tools.Helpers.GetResourceStream("AideDeJeu.Pdf.feuille_de_personnage_editable.pdf")); | ||||||
|  | @ -1267,23 +1257,23 @@ namespace AideDeJeu.ViewModels.PlayerCharacter | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|             var fontPath = Path.Combine(Xamarin.Essentials.FileSystem.CacheDirectory, "LinLibertine_aBS.ttf"); |             //var fontPath = Path.Combine(Xamarin.Essentials.FileSystem.CacheDirectory, "LinLibertine_aBS.ttf"); | ||||||
|             using (var inFont = AideDeJeu.Tools.Helpers.GetResourceStream("AideDeJeu.Pdf.LinLibertine_aBS.ttf")) |             //using (var inFont = AideDeJeu.Tools.Helpers.GetResourceStream("AideDeJeu.Pdf.LinLibertine_aBS.ttf")) | ||||||
|             { |             //{ | ||||||
|                 using (var outFont = new FileStream(fontPath, FileMode.Create, FileAccess.ReadWrite)) |             //    using (var outFont = new FileStream(fontPath, FileMode.Create, FileAccess.ReadWrite)) | ||||||
|                 { |             //    { | ||||||
|                     await inFont.CopyToAsync(outFont); |             //        await inFont.CopyToAsync(outFont); | ||||||
|                 } |             //    } | ||||||
|             } |             //} | ||||||
|             //var set = listFonts(reader); |             //var set = listFonts(reader); | ||||||
|             //var truc = findFontInPage(reader, "MinionPro-It", 1); |             //var truc = findFontInPage(reader, "MinionPro-It", 1); | ||||||
|             //var fonts = BaseFont.GetDocumentFonts(reader); |             //var fonts = BaseFont.GetDocumentFonts(reader); | ||||||
|             //var font = BaseFont.CreateFont("TMULFZ+MinionPro-It", BaseFont.WINANSI, BaseFont.EMBEDDED); |             //var font = BaseFont.CreateFont("TMULFZ+MinionPro-It", BaseFont.WINANSI, BaseFont.EMBEDDED); | ||||||
|             //var font = findFontInForm(reader, new PdfName("MinionPro-It")); |             //var font = findFontInForm(reader, new PdfName("MinionPro-It")); | ||||||
|             FontFactory.Register(fontPath, "mafont"); |             //FontFactory.Register(fontPath, "mafont"); | ||||||
|             var bigFont = FontFactory.GetFont("mafont", 20, iTextSharp.text.Font.BOLD); |             //var bigFont = FontFactory.GetFont("mafont", 20, iTextSharp.text.Font.BOLD); | ||||||
|             var normalFont = FontFactory.GetFont("mafont", 12, iTextSharp.text.Font.NORMAL); |             //var normalFont = FontFactory.GetFont("mafont", 12, iTextSharp.text.Font.NORMAL); | ||||||
|             var smallFont = FontFactory.GetFont("mafont", 6, iTextSharp.text.Font.NORMAL); |             //var smallFont = FontFactory.GetFont("mafont", 6, iTextSharp.text.Font.NORMAL); | ||||||
|             //System.Text.Encoding.RegisterProvider(new System.Text.EncodingProvider()); |             //System.Text.Encoding.RegisterProvider(new System.Text.EncodingProvider()); | ||||||
|             //var font = BaseFont.CreateFont("mafont", BaseFont.WINANSI, BaseFont.EMBEDDED); |             //var font = BaseFont.CreateFont("mafont", BaseFont.WINANSI, BaseFont.EMBEDDED); | ||||||
|             //var font = mafont.BaseFont; |             //var font = mafont.BaseFont; | ||||||
|  | @ -1425,7 +1415,7 @@ namespace AideDeJeu.ViewModels.PlayerCharacter | ||||||
|              |              | ||||||
|             document.Close(); |             document.Close(); | ||||||
|             */ |             */ | ||||||
| 
 |             return filePath; | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|         async Task OpenPdfAsync() |         async Task OpenPdfAsync() | ||||||
|  |  | ||||||
|  | @ -15,11 +15,6 @@ | ||||||
|         <ScrollView Grid.ColumnSpan="2" Orientation="Vertical"> |         <ScrollView Grid.ColumnSpan="2" Orientation="Vertical"> | ||||||
|             <StackLayout> |             <StackLayout> | ||||||
| 
 | 
 | ||||||
|                 <!-- DEBUG --> |  | ||||||
|                 <!--<Label Text="{Binding Backgrounds.Status, StringFormat='Backgrounds.Status = {0}'}" /> |  | ||||||
|                 <Label Text="{Binding NotifySelectedBackground.Status, StringFormat='NotifySelectedBackground.Status = {0}'}" /> |  | ||||||
|                 <Label Text="{Binding NotifySelectedSubBackground.Status, StringFormat='NotifySelectedSubBackground.Status = {0}'}" />--> |  | ||||||
| 
 |  | ||||||
|                 <pickers:ItemPickerView BindingContext="{Binding}" Title="Historique" ItemsSource="{Binding Backgrounds}" SelectedItem="{Binding SelectedPlayerCharacter.Background.Background, Mode=TwoWay}" /> |                 <pickers:ItemPickerView BindingContext="{Binding}" Title="Historique" ItemsSource="{Binding Backgrounds}" SelectedItem="{Binding SelectedPlayerCharacter.Background.Background, Mode=TwoWay}" /> | ||||||
|                 <pickers:ItemPickerView BindingContext="{Binding}" Title="Variante" ItemsSource="{Binding SubBackgrounds}" SelectedItem="{Binding SelectedPlayerCharacter.Background.SubBackground, Mode=TwoWay}" IsVisible="{Binding SubBackgrounds, Converter={StaticResource NullToFalseConverter}, FallbackValue=False}" /> |                 <pickers:ItemPickerView BindingContext="{Binding}" Title="Variante" ItemsSource="{Binding SubBackgrounds}" SelectedItem="{Binding SelectedPlayerCharacter.Background.SubBackground, Mode=TwoWay}" IsVisible="{Binding SubBackgrounds, Converter={StaticResource NullToFalseConverter}, FallbackValue=False}" /> | ||||||
| 
 | 
 | ||||||
|  | @ -44,9 +39,6 @@ | ||||||
| 
 | 
 | ||||||
|                 <pickers:StringPickerView BindingContext="{Binding}" Title="Défaut" IsVisible="{Binding SelectedPlayerCharacter.Background.Background, Converter={StaticResource NullToFalseConverter}, FallbackValue=False}" ItemsSource="{Binding PersonalityDefects}" SelectedItem="{Binding SelectedPlayerCharacter.Background.PersonalityDefect, Mode=TwoWay}" /> |                 <pickers:StringPickerView BindingContext="{Binding}" Title="Défaut" IsVisible="{Binding SelectedPlayerCharacter.Background.Background, Converter={StaticResource NullToFalseConverter}, FallbackValue=False}" ItemsSource="{Binding PersonalityDefects}" SelectedItem="{Binding SelectedPlayerCharacter.Background.PersonalityDefect, Mode=TwoWay}" /> | ||||||
| 
 | 
 | ||||||
|                 <!-- test --> |  | ||||||
|                 <!--<views:StringPickerView BindingContext="{Binding}" IsVisible="{Binding SelectedBackground, Converter={StaticResource NullToFalseConverter}, FallbackValue=False}" Title="Compétences" SelectedItem="{Binding PreferedBackground.Abilities}" />--> |  | ||||||
| 
 |  | ||||||
|                 <Frame BorderColor="Black" Padding="2" Margin="10" IsVisible="{Binding SelectedPlayerCharacter.Background.BackgroundOrSubBackground, Converter={StaticResource NullToFalseConverter}, FallbackValue=False}"> |                 <Frame BorderColor="Black" Padding="2" Margin="10" IsVisible="{Binding SelectedPlayerCharacter.Background.BackgroundOrSubBackground, Converter={StaticResource NullToFalseConverter}, FallbackValue=False}"> | ||||||
|                     <StackLayout Padding="0"> |                     <StackLayout Padding="0"> | ||||||
|                         <mdview:MarkdownView Theme="{StaticResource MonsterMarkdownTheme}" HorizontalOptions="FillAndExpand" Markdown="# Compétences" /> |                         <mdview:MarkdownView Theme="{StaticResource MonsterMarkdownTheme}" HorizontalOptions="FillAndExpand" Markdown="# Compétences" /> | ||||||
|  |  | ||||||
|  | @ -14,12 +14,29 @@ | ||||||
|     <ContentView.Content> |     <ContentView.Content> | ||||||
|         <ScrollView Grid.ColumnSpan="2" Orientation="Vertical"> |         <ScrollView Grid.ColumnSpan="2" Orientation="Vertical"> | ||||||
|             <StackLayout> |             <StackLayout> | ||||||
|                 <Entry Placeholder="Nom" Text="{Binding Name}" Keyboard="Text" /> |                 <Frame BorderColor="Black" Padding="2" Margin="10"> | ||||||
|                 <!--<Picker Title="Alignement" HorizontalOptions="FillAndExpand" IsEnabled="{Binding Alignments.IsSuccessfullyCompleted}" ItemsSource="{Binding Alignments.Result}" ItemDisplayBinding="{Binding Name}" SelectedIndex="{Binding AlignmentSelectedIndex, Mode=TwoWay}" />--> |                     <StackLayout Padding="0"> | ||||||
|                 <pickers:ItemPickerView BindingContext="{Binding}" IsEnabled="{Binding Alignments.IsSuccessfullyCompleted}" Title="Alignement" ItemsSource="{Binding Alignments.Result}" SelectedItem="{Binding SelectedPlayerCharacter.Alignment, Mode=TwoWay}" /> |                         <mdview:MarkdownView Theme="{StaticResource MonsterMarkdownTheme}" HorizontalOptions="FillAndExpand" Markdown="# Nom" /> | ||||||
|  |                         <Entry Margin="10" Placeholder="Nom" Text="{Binding Name}" Keyboard="Text" /> | ||||||
|  |                     </StackLayout> | ||||||
|  |                 </Frame> | ||||||
|  |                 <Frame BorderColor="Black" Padding="2" Margin="10"> | ||||||
|  |                     <StackLayout Padding="0"> | ||||||
|  |                         <mdview:MarkdownView Theme="{StaticResource MonsterMarkdownTheme}" HorizontalOptions="FillAndExpand" Markdown="# Niveau" /> | ||||||
|  |                         <Picker Margin="10" Title="Niveau" HorizontalOptions="FillAndExpand"> | ||||||
|  |                             <Picker.ItemsSource> | ||||||
|  |                                 <x:Array Type="{x:Type x:Int32}"> | ||||||
|  |                                     <x:Int32>1</x:Int32> | ||||||
|  |                                 </x:Array> | ||||||
|  |                             </Picker.ItemsSource> | ||||||
|  |                             <Picker.SelectedItem> | ||||||
|  |                                 <x:Int32>1</x:Int32> | ||||||
|  |                             </Picker.SelectedItem> | ||||||
|  |                         </Picker> | ||||||
|  |                     </StackLayout> | ||||||
|  |                 </Frame> | ||||||
|  |                 <pickers:ItemPickerView BindingContext="{Binding}" IsEnabled="{Binding Alignments, Converter={StaticResource NullToFalseConverter}}" Title="Alignement" ItemsSource="{Binding Alignments}" SelectedItem="{Binding SelectedPlayerCharacter.Alignment, Mode=TwoWay}" /> | ||||||
| 
 | 
 | ||||||
|                 <!--<mdview:MarkdownView Theme="{StaticResource MonsterMarkdownTheme}" Markdown="{Binding SelectedPlayerCharacter.Alignment.Description}" />--> |  | ||||||
|                 <Picker Title="Niveau" HorizontalOptions="FillAndExpand" ItemsSource="{Binding Levels}" ItemDisplayBinding="{Binding StringFormat='Niveau : {0}'}" /> |  | ||||||
|             </StackLayout> |             </StackLayout> | ||||||
|         </ScrollView> |         </ScrollView> | ||||||
|     </ContentView.Content> |     </ContentView.Content> | ||||||
|  |  | ||||||
							
								
								
									
										12
									
								
								AideDeJeu/AideDeJeu/Views/PlayerCharacter/PdfViewPage.xaml
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										12
									
								
								AideDeJeu/AideDeJeu/Views/PlayerCharacter/PdfViewPage.xaml
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,12 @@ | ||||||
|  | <?xml version="1.0" encoding="utf-8" ?> | ||||||
|  | <ContentPage xmlns="http://xamarin.com/schemas/2014/forms" | ||||||
|  |              xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" | ||||||
|  |              x:Class="AideDeJeu.Views.PlayerCharacter.PdfViewPage"> | ||||||
|  |     <ContentPage.Content> | ||||||
|  |         <StackLayout> | ||||||
|  |             <Label Text="{Binding PdfFile.Result}" | ||||||
|  |                 VerticalOptions="CenterAndExpand"  | ||||||
|  |                 HorizontalOptions="CenterAndExpand" /> | ||||||
|  |         </StackLayout> | ||||||
|  |     </ContentPage.Content> | ||||||
|  | </ContentPage> | ||||||
|  | @ -0,0 +1,24 @@ | ||||||
|  | using AideDeJeu.Tools; | ||||||
|  | using AideDeJeu.ViewModels.PlayerCharacter; | ||||||
|  | using System; | ||||||
|  | using System.Collections.Generic; | ||||||
|  | using System.Linq; | ||||||
|  | using System.Text; | ||||||
|  | using System.Threading.Tasks; | ||||||
|  | 
 | ||||||
|  | using Xamarin.Forms; | ||||||
|  | using Xamarin.Forms.Xaml; | ||||||
|  | 
 | ||||||
|  | namespace AideDeJeu.Views.PlayerCharacter | ||||||
|  | { | ||||||
|  |     [XamlCompilation(XamlCompilationOptions.Compile)] | ||||||
|  |     public partial class PdfViewPage : ContentPage | ||||||
|  |     { | ||||||
|  |         public PdfViewPage() | ||||||
|  |         { | ||||||
|  |             InitializeComponent(); | ||||||
|  |         } | ||||||
|  | 
 | ||||||
|  |         public NotifyTaskCompletion<string> PdfFile { get; set; } | ||||||
|  |     } | ||||||
|  | } | ||||||
|  | @ -117,27 +117,10 @@ | ||||||
|             <pcviews:AbilitiesView Grid.ColumnSpan="2" BindingContext="{Binding}" /> |             <pcviews:AbilitiesView Grid.ColumnSpan="2" BindingContext="{Binding}" /> | ||||||
| 
 | 
 | ||||||
|             <Button Grid.Column="0" Grid.Row="1" Text="Historique" Command="{Binding ChangePageCommand, Source={x:Reference This}}" CommandParameter="{x:Reference Background}"/> |             <Button Grid.Column="0" Grid.Row="1" Text="Historique" Command="{Binding ChangePageCommand, Source={x:Reference This}}" CommandParameter="{x:Reference Background}"/> | ||||||
|             <Button Grid.Column="1" Grid.Row="1" Text="Équipement" Command="{Binding ChangePageCommand, Source={x:Reference This}}" CommandParameter="{x:Reference Equipment}"/> |             <Button Grid.Column="1" Grid.Row="1" Text="Autres" Command="{Binding ChangePageCommand, Source={x:Reference This}}" CommandParameter="{x:Reference Others}"/> | ||||||
|         </Grid> |         </Grid> | ||||||
|     </ContentPage> |     </ContentPage> | ||||||
|     <ContentPage x:Name="Equipment" Title="Équipement"> |     <ContentPage x:Name="Others" Title="Autres"> | ||||||
|         <Grid> |  | ||||||
|             <Grid.ColumnDefinitions> |  | ||||||
|                 <ColumnDefinition Width="*" /> |  | ||||||
|                 <ColumnDefinition Width="*" /> |  | ||||||
|             </Grid.ColumnDefinitions> |  | ||||||
|             <Grid.RowDefinitions> |  | ||||||
|                 <RowDefinition Height="*" /> |  | ||||||
|                 <RowDefinition Height="auto" /> |  | ||||||
|             </Grid.RowDefinitions> |  | ||||||
| 
 |  | ||||||
|             <pcviews:EquipmentView Grid.ColumnSpan="2" BindingContext="{Binding}" /> |  | ||||||
| 
 |  | ||||||
|             <Button Grid.Column="0" Grid.Row="1" Text="Caractéristiques" Command="{Binding ChangePageCommand, Source={x:Reference This}}" CommandParameter="{x:Reference Abilities}"/> |  | ||||||
|             <Button Grid.Column="1" Grid.Row="1" Text="Finalisation" Command="{Binding ChangePageCommand, Source={x:Reference This}}" CommandParameter="{x:Reference Finalize}"/> |  | ||||||
|         </Grid> |  | ||||||
|     </ContentPage> |  | ||||||
|     <ContentPage x:Name="Finalize" Title="Finalisation"> |  | ||||||
|         <Grid> |         <Grid> | ||||||
|             <Grid.ColumnDefinitions> |             <Grid.ColumnDefinitions> | ||||||
|                 <ColumnDefinition Width="*" /> |                 <ColumnDefinition Width="*" /> | ||||||
|  | @ -150,25 +133,8 @@ | ||||||
| 
 | 
 | ||||||
|             <pcviews:FinalizeView Grid.ColumnSpan="2" BindingContext="{Binding}" /> |             <pcviews:FinalizeView Grid.ColumnSpan="2" BindingContext="{Binding}" /> | ||||||
| 
 | 
 | ||||||
|             <Button Grid.Column="0" Grid.Row="1" Text="Équipement" Command="{Binding ChangePageCommand, Source={x:Reference This}}" CommandParameter="{x:Reference Equipment}"/> |             <Button Grid.Column="0" Grid.Row="1" Text="Caractéristiques" Command="{Binding ChangePageCommand, Source={x:Reference This}}" CommandParameter="{x:Reference Abilities}"/> | ||||||
|             <Button Grid.Column="1" Grid.Row="1" Text="Résumé" Command="{Binding ChangePageCommand, Source={x:Reference This}}" CommandParameter="{x:Reference Resume}"/> |             <Button Grid.Column="1" Grid.Row="1" Text="Résumé" Command="{Binding PdfViewCommand, Source={x:Reference This}}" CommandParameter="{Binding SelectedPlayerCharacter}" /> | ||||||
|         </Grid> |  | ||||||
|     </ContentPage> |  | ||||||
|     <ContentPage x:Name="Resume" Title="Résumé"> |  | ||||||
|         <Grid> |  | ||||||
|             <Grid.ColumnDefinitions> |  | ||||||
|                 <ColumnDefinition Width="*" /> |  | ||||||
|                 <ColumnDefinition Width="*" /> |  | ||||||
|             </Grid.ColumnDefinitions> |  | ||||||
|             <Grid.RowDefinitions> |  | ||||||
|                 <RowDefinition Height="*" /> |  | ||||||
|                 <RowDefinition Height="auto" /> |  | ||||||
|             </Grid.RowDefinitions> |  | ||||||
| 
 |  | ||||||
|             <pcviews:ResumeView Grid.ColumnSpan="2" BindingContext="{Binding}" /> |  | ||||||
| 
 |  | ||||||
|             <Button Grid.Column="0" Grid.Row="1" Text="Finalisation" Command="{Binding ChangePageCommand, Source={x:Reference This}}" CommandParameter="{x:Reference Finalize}"/> |  | ||||||
|             <Button Grid.Column="1" Grid.Row="1" Text="Ouvrir en PDF" Command="{Binding GenerateAndOpenPdfCommand}" /> |  | ||||||
|         </Grid> |         </Grid> | ||||||
|     </ContentPage> |     </ContentPage> | ||||||
| </CarouselPage> | </CarouselPage> | ||||||
|  | @ -50,5 +50,22 @@ namespace AideDeJeu.Views.PlayerCharacter | ||||||
|         { |         { | ||||||
|             This.CurrentPage = param as ContentPage; |             This.CurrentPage = param as ContentPage; | ||||||
|         } |         } | ||||||
|  | 
 | ||||||
|  |         public Command PdfViewCommand | ||||||
|  |         { | ||||||
|  |             get | ||||||
|  |             { | ||||||
|  |                 return new Command<object>(ExecutePdfViewCommand); | ||||||
|  |             } | ||||||
|  |         } | ||||||
|  | 
 | ||||||
|  |         public void ExecutePdfViewCommand(object param) | ||||||
|  |         { | ||||||
|  |             var vm = BindingContext as PlayerCharacterEditorViewModel; | ||||||
|  |             var page = new PdfViewPage(); | ||||||
|  |             page.PdfFile = new Tools.NotifyTaskCompletion<string>(Task.Run(async() => await vm.GeneratePdfAsync(param as PlayerCharacterViewModel))); | ||||||
|  |             page.BindingContext = page; | ||||||
|  |             Navigation.PushModalAsync(page, true); | ||||||
|  |         } | ||||||
|     } |     } | ||||||
| } | } | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Yan Maniez
						Yan Maniez