1
0
Fork 0
mirror of https://github.com/Nioux/AideDeJeu.git synced 2025-10-30 23:16:09 +00:00

Petit refactor

This commit is contained in:
Yan Maniez 2019-10-14 10:18:08 +02:00
parent 458df38f64
commit 73f730c09a
4 changed files with 26 additions and 20 deletions

View file

@ -13,12 +13,8 @@ namespace AideDeJeu.ViewModels
public AboutViewModel() public AboutViewModel()
{ {
Title = "À propos de ..."; Title = "À propos de ...";
OpenWebCommand = new Command<string>((param) => Device.OpenUri(new Uri(param)));
} }
public ICommand OpenWebCommand { get; }
public string Version { public string Version {
get get
{ {

View file

@ -40,6 +40,15 @@ namespace AideDeJeu.ViewModels
} }
} }
private ICommand _OpenWebCommand = null;
public ICommand OpenWebCommand
{
get
{
return _OpenWebCommand ?? (_OpenWebCommand = new Command<string>((param) => Device.OpenUri(new Uri(param))));
}
}
public async Task GotoAboutPageAsync() public async Task GotoAboutPageAsync()
{ {
//await Navigation.PushAsync(new Views.AboutPage(), true); //await Navigation.PushAsync(new Views.AboutPage(), true);

View file

@ -3,7 +3,8 @@
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="AideDeJeu.Views.AboutPage" x:Class="AideDeJeu.Views.AboutPage"
xmlns:vm="clr-namespace:AideDeJeu.ViewModels" xmlns:vm="clr-namespace:AideDeJeu.ViewModels"
Title="{Binding Title}"> Title="{Binding Title}"
x:DataType="vm:AboutViewModel">
<ContentPage.BindingContext> <ContentPage.BindingContext>
<vm:AboutViewModel /> <vm:AboutViewModel />
</ContentPage.BindingContext> </ContentPage.BindingContext>
@ -42,7 +43,7 @@
</FormattedString> </FormattedString>
</Label.FormattedText> </Label.FormattedText>
<Label.GestureRecognizers> <Label.GestureRecognizers>
<TapGestureRecognizer Command="{Binding OpenWebCommand}" CommandParameter="https://github.com/Nioux/AideDeJeu" /> <TapGestureRecognizer Command="{Binding Main.Navigator.OpenWebCommand}" CommandParameter="https://github.com/Nioux/AideDeJeu" />
</Label.GestureRecognizers> </Label.GestureRecognizers>
</Label> </Label>
@ -54,7 +55,7 @@
</FormattedString> </FormattedString>
</Label.FormattedText> </Label.FormattedText>
<Label.GestureRecognizers> <Label.GestureRecognizers>
<TapGestureRecognizer Command="{Binding OpenWebCommand}" CommandParameter="http://game-icons.net" /> <TapGestureRecognizer Command="{Binding Main.Navigator.OpenWebCommand}" CommandParameter="http://game-icons.net" />
</Label.GestureRecognizers> </Label.GestureRecognizers>
</Label> </Label>
@ -66,7 +67,7 @@
</FormattedString> </FormattedString>
</Label.FormattedText> </Label.FormattedText>
<Label.GestureRecognizers> <Label.GestureRecognizers>
<TapGestureRecognizer Command="{Binding OpenWebCommand}" CommandParameter="https://www.dafont.com/fr/" /> <TapGestureRecognizer Command="{Binding Main.Navigator.OpenWebCommand}" CommandParameter="https://www.dafont.com/fr/" />
</Label.GestureRecognizers> </Label.GestureRecognizers>
</Label> </Label>
@ -78,7 +79,7 @@
</FormattedString> </FormattedString>
</Label.FormattedText> </Label.FormattedText>
<Label.GestureRecognizers> <Label.GestureRecognizers>
<TapGestureRecognizer Command="{Binding OpenWebCommand}" CommandParameter="https://www.black-book-editions.fr/forums.php?topic_id=5626" /> <TapGestureRecognizer Command="{Binding Main.Navigator.OpenWebCommand}" CommandParameter="https://www.black-book-editions.fr/forums.php?topic_id=5626" />
</Label.GestureRecognizers> </Label.GestureRecognizers>
</Label> </Label>
@ -90,7 +91,7 @@
</FormattedString> </FormattedString>
</Label.FormattedText> </Label.FormattedText>
<Label.GestureRecognizers> <Label.GestureRecognizers>
<TapGestureRecognizer Command="{Binding OpenWebCommand}" CommandParameter="https://www.black-book-editions.fr/forums.php?topic_id=12619" /> <TapGestureRecognizer Command="{Binding Main.Navigator.OpenWebCommand}" CommandParameter="https://www.black-book-editions.fr/forums.php?topic_id=12619" />
</Label.GestureRecognizers> </Label.GestureRecognizers>
</Label> </Label>
@ -102,7 +103,7 @@
</FormattedString> </FormattedString>
</Label.FormattedText> </Label.FormattedText>
<Label.GestureRecognizers> <Label.GestureRecognizers>
<TapGestureRecognizer Command="{Binding OpenWebCommand}" CommandParameter="https://www.black-book-editions.fr/forums.php?topic_id=7400&amp;tid=304699#msg304699" /> <TapGestureRecognizer Command="{Binding Main.Navigator.OpenWebCommand}" CommandParameter="https://www.black-book-editions.fr/forums.php?topic_id=7400&amp;tid=304699#msg304699" />
</Label.GestureRecognizers> </Label.GestureRecognizers>
</Label> </Label>
@ -116,7 +117,7 @@
<Label.GestureRecognizers> <Label.GestureRecognizers>
<OnPlatform x:TypeArguments="TapGestureRecognizer"> <OnPlatform x:TypeArguments="TapGestureRecognizer">
<On Platform="Android, UWP"> <On Platform="Android, UWP">
<TapGestureRecognizer Command="{Binding OpenWebCommand}" CommandParameter="https://fr.tipeee.com/nioux" /> <TapGestureRecognizer Command="{Binding Main.Navigator.OpenWebCommand}" CommandParameter="https://fr.tipeee.com/nioux" />
</On> </On>
</OnPlatform> </OnPlatform>
</Label.GestureRecognizers> </Label.GestureRecognizers>
@ -130,7 +131,7 @@
</FormattedString> </FormattedString>
</Label.FormattedText> </Label.FormattedText>
<Label.GestureRecognizers> <Label.GestureRecognizers>
<TapGestureRecognizer Command="{Binding OpenWebCommand}" CommandParameter="http://www.black-book-editions.fr/" /> <TapGestureRecognizer Command="{Binding Main.Navigator.OpenWebCommand}" CommandParameter="http://www.black-book-editions.fr/" />
</Label.GestureRecognizers> </Label.GestureRecognizers>
</Label> </Label>
@ -150,7 +151,7 @@
</FormattedString> </FormattedString>
</Label.FormattedText> </Label.FormattedText>
<Label.GestureRecognizers> <Label.GestureRecognizers>
<TapGestureRecognizer Command="{Binding OpenWebCommand}" CommandParameter="https://heros-et-dragons.fr/" /> <TapGestureRecognizer Command="{Binding Main.Navigator.OpenWebCommand}" CommandParameter="https://heros-et-dragons.fr/" />
</Label.GestureRecognizers> </Label.GestureRecognizers>
</Label> </Label>

View file

@ -108,18 +108,18 @@
<ImageButton Source="spell_book.png" Command="{Binding Main.Navigator.LibraryCommand, Mode=OneTime}" /> <ImageButton Source="spell_book.png" Command="{Binding Main.Navigator.LibraryCommand, Mode=OneTime}" />
</Grid> </Grid>
</Frame> </Frame>
<!--<Frame> <Frame>
<Grid> <Grid>
<Label Text="Favoris" /> <Label Text="Favoris" FontFamily="{StaticResource LinuxLibertineCapitals}" />
<ImageButton Source="stars_stack.png" Command="{Binding Main.Navigator.BookmarksCommand}" /> <ImageButton Source="stars_stack.png" Command="{Binding Main.Navigator.BookmarksCommand, Mode=OneTime}" />
</Grid> </Grid>
</Frame> </Frame>
<Frame> <Frame>
<Grid> <Grid>
<Label Text="Recherche" /> <Label Text="Recherche" FontFamily="{StaticResource LinuxLibertineCapitals}" />
<ImageButton Source="crystal_ball.png" Command="{Binding Main.Navigator.DeepSearchCommand}" /> <ImageButton Source="crystal_ball.png" Command="{Binding Main.Navigator.DeepSearchCommand, Mode=OneTime}" />
</Grid> </Grid>
</Frame>--> </Frame>
<Frame> <Frame>
<Grid> <Grid>
<Label Text="A propos de..." FontFamily="{StaticResource LinuxLibertineCapitals}" /> <Label Text="A propos de..." FontFamily="{StaticResource LinuxLibertineCapitals}" />