1
0
Fork 0
mirror of https://github.com/Nioux/AideDeJeu.git synced 2025-10-29 14:35:45 +00:00

Version dynamique

This commit is contained in:
Yan Maniez 2018-05-07 01:17:51 +02:00
parent 53d047f67d
commit 05551ec754
5 changed files with 52 additions and 12 deletions

View file

@ -69,6 +69,7 @@
<Compile Include="MainActivity.cs" />
<Compile Include="Resources\Resource.Designer.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Version.cs" />
</ItemGroup>
<ItemGroup>
<AndroidAsset Include="Assets\LinLibertine_R.ttf" />

View 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;
}
}
}

View file

@ -0,0 +1,12 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace AideDeJeu.Tools
{
public interface IAppVersion
{
string GetVersion();
int GetBuild();
}
}

View file

@ -1,4 +1,5 @@
using System;
using AideDeJeu.Tools;
using System;
using System.Windows.Input;
using Xamarin.Forms;
@ -15,5 +16,12 @@ namespace AideDeJeu.ViewModels
}
public ICommand OpenWebCommand { get; }
public string Version {
get
{
return DependencyService.Get<IAppVersion>().GetVersion();
}
}
}
}

View file

@ -21,17 +21,8 @@
</StackLayout>
<ScrollView Grid.Row="1">
<StackLayout Orientation="Vertical" Padding="16,40,16,40" Spacing="10">
<Label FontSize="22">
<Label.FormattedText>
<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="Aide de Jeu" FontSize="22" FontAttributes="Bold" />
<Label Text="{Binding Version}" FontAttributes="Bold" FontSize="22" />
<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="Les icones proviennent du site Game-icons.net" />