mirror of
				https://github.com/Nioux/AideDeJeu.git
				synced 2025-10-30 23:16:09 +00:00 
			
		
		
		
	Version dynamique
This commit is contained in:
		
							parent
							
								
									53d047f67d
								
							
						
					
					
						commit
						05551ec754
					
				
					 5 changed files with 52 additions and 12 deletions
				
			
		|  | @ -69,6 +69,7 @@ | ||||||
|     <Compile Include="MainActivity.cs" /> |     <Compile Include="MainActivity.cs" /> | ||||||
|     <Compile Include="Resources\Resource.Designer.cs" /> |     <Compile Include="Resources\Resource.Designer.cs" /> | ||||||
|     <Compile Include="Properties\AssemblyInfo.cs" /> |     <Compile Include="Properties\AssemblyInfo.cs" /> | ||||||
|  |     <Compile Include="Version.cs" /> | ||||||
|   </ItemGroup> |   </ItemGroup> | ||||||
|   <ItemGroup> |   <ItemGroup> | ||||||
|     <AndroidAsset Include="Assets\LinLibertine_R.ttf" /> |     <AndroidAsset Include="Assets\LinLibertine_R.ttf" /> | ||||||
|  |  | ||||||
							
								
								
									
										28
									
								
								AideDeJeu/AideDeJeu.Android/Version.cs
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										28
									
								
								AideDeJeu/AideDeJeu.Android/Version.cs
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,28 @@ | ||||||
|  | using AideDeJeu.Tools; | ||||||
|  | using Android.Content.PM; | ||||||
|  | 
 | ||||||
|  | [assembly: Xamarin.Forms.Dependency(typeof(AideDeJeu.Droid.Version_Android))] | ||||||
|  | namespace AideDeJeu.Droid | ||||||
|  | { | ||||||
|  |     public class Version_Android : IAppVersion | ||||||
|  |     { | ||||||
|  |         public string GetVersion() | ||||||
|  |         { | ||||||
|  |             var context = global::Android.App.Application.Context; | ||||||
|  | 
 | ||||||
|  |             PackageManager manager = context.PackageManager; | ||||||
|  |             PackageInfo info = manager.GetPackageInfo(context.PackageName, 0); | ||||||
|  | 
 | ||||||
|  |             return info.VersionName; | ||||||
|  |         } | ||||||
|  | 
 | ||||||
|  |         public int GetBuild() | ||||||
|  |         { | ||||||
|  |             var context = global::Android.App.Application.Context; | ||||||
|  |             PackageManager manager = context.PackageManager; | ||||||
|  |             PackageInfo info = manager.GetPackageInfo(context.PackageName, 0); | ||||||
|  | 
 | ||||||
|  |             return info.VersionCode; | ||||||
|  |         } | ||||||
|  |     } | ||||||
|  | } | ||||||
							
								
								
									
										12
									
								
								AideDeJeu/AideDeJeu/Tools/Version.cs
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										12
									
								
								AideDeJeu/AideDeJeu/Tools/Version.cs
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,12 @@ | ||||||
|  | using System; | ||||||
|  | using System.Collections.Generic; | ||||||
|  | using System.Text; | ||||||
|  | 
 | ||||||
|  | namespace AideDeJeu.Tools | ||||||
|  | { | ||||||
|  |     public interface IAppVersion | ||||||
|  |     { | ||||||
|  |         string GetVersion(); | ||||||
|  |         int GetBuild(); | ||||||
|  |     } | ||||||
|  | } | ||||||
|  | @ -1,4 +1,5 @@ | ||||||
| using System; | using AideDeJeu.Tools; | ||||||
|  | using System; | ||||||
| using System.Windows.Input; | using System.Windows.Input; | ||||||
| 
 | 
 | ||||||
| using Xamarin.Forms; | using Xamarin.Forms; | ||||||
|  | @ -15,5 +16,12 @@ namespace AideDeJeu.ViewModels | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|         public ICommand OpenWebCommand { get; } |         public ICommand OpenWebCommand { get; } | ||||||
|  | 
 | ||||||
|  |         public string Version { | ||||||
|  |             get | ||||||
|  |             { | ||||||
|  |                 return DependencyService.Get<IAppVersion>().GetVersion(); | ||||||
|  |             } | ||||||
|  |         } | ||||||
|     } |     } | ||||||
| } | } | ||||||
|  | @ -21,17 +21,8 @@ | ||||||
|         </StackLayout> |         </StackLayout> | ||||||
|         <ScrollView Grid.Row="1"> |         <ScrollView Grid.Row="1"> | ||||||
|             <StackLayout Orientation="Vertical" Padding="16,40,16,40" Spacing="10"> |             <StackLayout Orientation="Vertical" Padding="16,40,16,40" Spacing="10"> | ||||||
|                 <Label FontSize="22"> |                 <Label Text="Aide de Jeu" FontSize="22" FontAttributes="Bold" /> | ||||||
|                     <Label.FormattedText> |                 <Label Text="{Binding Version}" FontAttributes="Bold" FontSize="22" /> | ||||||
|                         <FormattedString> |  | ||||||
|                             <FormattedString.Spans> |  | ||||||
|                                 <Span Text="Aide de Jeu" FontAttributes="Bold" FontSize="22" /> |  | ||||||
|                                 <Span Text=" " /> |  | ||||||
|                                 <Span Text="1.04" ForegroundColor="{StaticResource LightTextColor}" /> |  | ||||||
|                             </FormattedString.Spans> |  | ||||||
|                         </FormattedString> |  | ||||||
|                     </Label.FormattedText> |  | ||||||
|                 </Label> |  | ||||||
|                 <Label Text="Cette application est une aide de jeu pour le plus célèbre des jeux de rôle" /> |                 <Label Text="Cette application est une aide de jeu pour le plus célèbre des jeux de rôle" /> | ||||||
|                 <Label Text="Son contenu provient du site AideDD, et est traduit du SRD" /> |                 <Label Text="Son contenu provient du site AideDD, et est traduit du SRD" /> | ||||||
|                 <Label Text="Les icones proviennent du site Game-icons.net" /> |                 <Label Text="Les icones proviennent du site Game-icons.net" /> | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Yan Maniez
						Yan Maniez