1
0
Fork 0
mirror of https://github.com/Nioux/AideDeJeu.git synced 2025-10-29 14:35:45 +00:00
This commit is contained in:
Yan Maniez 2019-09-27 16:04:08 +02:00
parent fda700a8d3
commit 6abf46634c
19 changed files with 6241 additions and 5847 deletions

View file

@ -158,6 +158,9 @@
<EmbeddedResource Update="Views\Library\DeepSearchPage.xaml">
<Generator>MSBuild:UpdateDesignTimeXaml</Generator>
</EmbeddedResource>
<EmbeddedResource Update="Views\Library\ItemPage.xaml">
<Generator>MSBuild:UpdateDesignTimeXaml</Generator>
</EmbeddedResource>
<EmbeddedResource Update="Views\MainNavigationPage.xaml">
<Generator>MSBuild:UpdateDesignTimeXaml</Generator>
</EmbeddedResource>

View file

@ -29,11 +29,12 @@ namespace AideDeJeu
var bgtan = (Color)Resources["HDWhite"];
//MainPage = new MainShell();
var mainNavigationPage = new MainNavigationPage();
vm.Navigator = new Navigator(mainNavigationPage.Navigation);
MainPage = mainNavigationPage;
mainNavigationPage.Navigation.PushAsync(new MainPage());
MainPage = new MainShell();
//var mainNavigationPage = new MainNavigationPage();
//vm.Navigator = new Navigator(mainNavigationPage.Navigation);
vm.Navigator = new Navigator(null);
//MainPage = mainNavigationPage;
//mainNavigationPage.Navigation.PushAsync(new MainPage());
}

View file

@ -239,6 +239,8 @@ namespace AideDeJeu.ViewModels
public async Task NavigateToLinkAsync(string s)
{
await Shell.Current.GoToAsync($"//data/item?path={s}");
return;
if (s != null)
{
var regex = new Regex("/?(?<file>.*?)(_with_(?<with>.*))?\\.md(#(?<anchor>.*))?");

View file

@ -0,0 +1,48 @@
<?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.Library.ItemPage"
Title="{Binding Title}"
Icon="spell_book.png"
x:Name="This">
<ContentPage.Resources>
<ResourceDictionary>
<tools:MonsterMarkdownTheme x:Key="MonsterMarkdownTheme" />
<tools:NullToFalseConverter x:Key="NullToFalseConverter" />
</ResourceDictionary>
</ContentPage.Resources>
<ContentPage.ToolbarItems>
<ToolbarItem Name="AddToFavorites" Text="Ajouter aux favoris" Order="Primary" Icon="round_star.png" Command="{Binding Main.Navigator.AddToFavoritesCommand}" />
<ToolbarItem Name="Print" Text="Générer un PDF" Order="Primary" Icon="scroll_unfurled.png" Command="{Binding Main.Navigator.GeneratePDFCommand}" CommandParameter="{Binding Item.Markdown}" />
</ContentPage.ToolbarItems>
<Grid>
<ScrollView Orientation="Vertical" BackgroundColor="{StaticResource HDWhite}">
<mdview:MarkdownView
Theme="{StaticResource MonsterMarkdownTheme}"
Markdown="{Binding Item.Item.Markdown}"
NavigateToLinkCommand="{Binding Main.Navigator.NavigateToLinkCommand}"
/>
</ScrollView>
<ActivityIndicator
VerticalOptions="StartAndExpand"
HorizontalOptions="End"
Color="{StaticResource HDRed}"
IsRunning="{Binding Main.IsLoading}"
IsVisible="{Binding Main.IsLoading}">
<ActivityIndicator.WidthRequest>
<OnPlatform x:TypeArguments="x:Double">
<On Platform="UWP" Value="400" />
<On Platform="iOS, Android" Value="50" />
</OnPlatform>
</ActivityIndicator.WidthRequest>
<ActivityIndicator.HeightRequest>
<OnPlatform x:TypeArguments="x:Double">
<On Platform="UWP" Value="10" />
<On Platform="iOS, Android" Value="50" />
</OnPlatform>
</ActivityIndicator.HeightRequest>
</ActivityIndicator>
</Grid>
</ContentPage>

View file

@ -0,0 +1,146 @@

using AideDeJeu.ViewModels;
using AideDeJeu.ViewModels.Library;
using AideDeJeuLib;
using SkiaSharp;
using SkiaSharp.Views.Forms;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using Xamarin.Forms;
using Xamarin.Forms.Xaml;
namespace AideDeJeu.Views.Library
{
[XamlCompilation(XamlCompilationOptions.Compile)]
[QueryProperty("Path", "path")]
public partial class ItemPage : ContentPage, INotifyPropertyChanged
{
public MainViewModel Main
{
get
{
return DependencyService.Get<MainViewModel>();
}
}
private ItemDetailViewModel _Item = null;
public ItemDetailViewModel Item
{
get
{
return _Item;
}
set
{
SetProperty(ref _Item, value);
}
}
public ItemPage()
{
BindingContext = this;
InitializeComponent();
}
public ItemPage(string id)
{
Path = id;
BindingContext = this;
InitializeComponent();
LoadPageAsync();
}
protected override void OnAppearing()
{
base.OnAppearing();
LoadPageAsync();
}
private string _Path { get; set; } = "index.md";
public string Path
{
get
{
return _Path;
}
set
{
_Path = value;
LoadPageAsync();
}
}
private async Task LoadPageAsync()
{
var regex = new Regex("/?(?<file>.*?)(_with_(?<with>.*))?\\.md(#(?<anchor>.*))?");
var match = regex.Match(Path);
var file = match.Groups["file"].Value;
var anchor = match.Groups["anchor"].Value;
var with = match.Groups["with"].Value;
Item item = null;
try
{
Main.IsBusy = true;
Main.IsLoading = true;
item = await Task.Run(async () => await Main.Store.GetItemFromDataAsync(file, anchor));
}
finally
{
Main.IsBusy = false;
Main.IsLoading = false;
}
if (item != null)
{
var items = item; // as Items;
var filterViewModel = items.GetNewFilterViewModel();
var itemsViewModel = new ItemDetailViewModel() { Item = items };
this.Item = itemsViewModel;
//SwitchToMainTab();
//if (filterViewModel == null)
//{
// await GotoItemsPageAsync(itemsViewModel);
//}
//else
//{
// await GotoFilteredItemsPageAsync(itemsViewModel);
//}
}
else
{
//await App.Current.MainPage.DisplayAlert("Lien invalide", s, "OK");
}
}
protected bool SetProperty<T>(ref T backingStore, T value,
[CallerMemberName]string propertyName = "",
Action onChanged = null)
{
if (EqualityComparer<T>.Default.Equals(backingStore, value))
return false;
backingStore = value;
onChanged?.Invoke();
OnPropertyChanged(propertyName);
return true;
}
#region INotifyPropertyChanged
public event PropertyChangedEventHandler PropertyChanged;
protected void OnPropertyChanged([CallerMemberName] string propertyName = "")
{
var changed = PropertyChanged;
if (changed == null)
return;
changed.Invoke(this, new PropertyChangedEventArgs(propertyName));
}
#endregion
}
}

View file

@ -16,7 +16,7 @@
<ShellContent Title="Dés" ContentTemplate="{DataTemplate local:DicesPage}" />
</ShellItem>
<ShellItem Title="Bibliothèque" FlyoutIcon="spell_book.png" Route="data">
<ShellContent Title="Bibliothèque" Icon="spell_book.png" Route="item" ContentTemplate="{DataTemplate library:ItemDetailPage}" />
<ShellContent Title="Bibliothèque" Icon="spell_book.png" Route="item" ContentTemplate="{DataTemplate library:ItemPage}" />
</ShellItem>
<!--<FlyoutItem Title="Héros &amp; Dragons">
<ShellContent Title="Héros &amp; Dragons" ContentTemplate="{DataTemplate library:ItemDetailPage}" />
@ -45,42 +45,96 @@
<FlyoutItem Title="SRD">
<ShellContent Title="SRD" ContentTemplate="{DataTemplate library:ItemDetailPage}" />
</FlyoutItem>-->
<ShellItem Title="Manuel des Règles">
<ShellContent>
<ShellContent.ContentTemplate>
<DataTemplate>
<library:ItemPage>
<x:Arguments>
<x:String>index_mdr.md</x:String>
</x:Arguments>
</library:ItemPage>
</DataTemplate>
</ShellContent.ContentTemplate>
</ShellContent>
</ShellItem>
<ShellItem Title="Cadre de Campagne">
<ShellContent>
<ShellContent.ContentTemplate>
<DataTemplate>
<library:ItemPage>
<x:Arguments>
<x:String>index_cdc.md</x:String>
</x:Arguments>
</library:ItemPage>
</DataTemplate>
</ShellContent.ContentTemplate>
</ShellContent>
</ShellItem>
<ShellItem Title="Créatures et Oppositions">
<ShellContent>
<ShellContent.ContentTemplate>
<DataTemplate>
<library:ItemPage>
<x:Arguments>
<x:String>index_ceo.md</x:String>
</x:Arguments>
</library:ItemPage>
</DataTemplate>
</ShellContent.ContentTemplate>
</ShellContent>
</ShellItem>
<ShellItem Title="Les Cinq Royaumes">
<ShellSection>
<ShellContent Title="test1">
<ShellContent.ContentTemplate>
<DataTemplate>
<library:ItemsPage>
<x:Arguments>
<x:String>l5r_index_hd.md</x:String>
</x:Arguments>
</library:ItemsPage>
</DataTemplate>
</ShellContent.ContentTemplate>
</ShellContent>
<ShellContent Title="test2">
<ShellContent.ContentTemplate>
<DataTemplate>
<library:ItemsPage>
<x:Arguments>
<x:String>l5r_index_hd.md</x:String>
</x:Arguments>
</library:ItemsPage>
</DataTemplate>
</ShellContent.ContentTemplate>
</ShellContent>
<ShellContent Title="test3">
<ShellContent.ContentTemplate>
<DataTemplate>
<library:ItemsPage>
<x:Arguments>
<x:String>l5r_index_hd.md</x:String>
</x:Arguments>
</library:ItemsPage>
</DataTemplate>
</ShellContent.ContentTemplate>
</ShellContent>
</ShellSection>
<ShellContent>
<ShellContent.ContentTemplate>
<DataTemplate>
<library:ItemPage>
<x:Arguments>
<x:String>l5r_index_hd.md</x:String>
</x:Arguments>
</library:ItemPage>
</DataTemplate>
</ShellContent.ContentTemplate>
</ShellContent>
</ShellItem>
<ShellItem Title="Livre des Monstres">
<ShellContent>
<ShellContent.ContentTemplate>
<DataTemplate>
<library:ItemPage>
<x:Arguments>
<x:String>tome_of_beasts.md</x:String>
</x:Arguments>
</library:ItemPage>
</DataTemplate>
</ShellContent.ContentTemplate>
</ShellContent>
</ShellItem>
<ShellItem Title="Monstrueusement Mignons">
<ShellContent>
<ShellContent.ContentTemplate>
<DataTemplate>
<library:ItemPage>
<x:Arguments>
<x:String>baby_bestiary.md</x:String>
</x:Arguments>
</library:ItemPage>
</DataTemplate>
</ShellContent.ContentTemplate>
</ShellContent>
</ShellItem>
<ShellItem Title="SRD">
<ShellContent>
<ShellContent.ContentTemplate>
<DataTemplate>
<library:ItemPage>
<x:Arguments>
<x:String>index_srd.md</x:String>
</x:Arguments>
</library:ItemPage>
</DataTemplate>
</ShellContent.ContentTemplate>
</ShellContent>
</ShellItem>
<!--Command="{Binding ShellNavigateCommand}"
CommandParameter="//data/item?path=l5r_index_hd.md"

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

12
Data/HD/index_cdc.md Normal file
View file

@ -0,0 +1,12 @@
# Cadre de campagne
## [Objets magiques](hd_magicitems.md)
### [Objets magiques de A à Z](hd_magicitems_az.md)
### [Objets magiques intelligents](hd_sentient_magicitems.md)
### [Artefacts](hd_artifacts.md)
## [Jouer dans un multivers](hd_planes.md)

14
Data/HD/index_ceo.md Normal file
View file

@ -0,0 +1,14 @@
# Créatures et oppositions
## [Créatures](hd_monsters.md)
## [Pièges](hd_traps.md)
## [Maladies](hd_diseases.md)
## [Folie](hd_madness.md)
## [Objets](hd_objects.md)
## [Poisons](hd_poisons.md)

28
Data/HD/index_mdr.md Normal file
View file

@ -0,0 +1,28 @@
# Manuel des règles
## [Création du personnage](hd_beyond1stlevel.md)
## [Races](hd_races.md)
## [Personnalité et Historique](hd_personnality_background.md)
## [Classes](hd_classes.md)
## [Équipement](hd_equipment.md)
## [Options de personnalisation](hd_custom_options.md)
## [Utiliser les Caractéristiques](hd_abilities.md)
## [Partir à l'aventure](hd_adventure.md)
## [Combattre](hd_combat.md)
## [Gérer la santé](hd_manage_health.md)
## [Lancer des sorts](hd_spellcasting.md)
## [Description des Sorts](hd_spells.md)
## [Panthéons](hd_pantheons.md)

8
Data/HD/index_srd.md Normal file
View file

@ -0,0 +1,8 @@
# SRD
## [Conditions](srd_conditions.md)
## [Spells](srd_spells.md)
## [Monsters, Animals and NPC](srd_monsters.md)

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

16
Data/index_cdc.md Normal file
View file

@ -0,0 +1,16 @@
<!--GenericItem-->
# <!--Name-->Cadre de campagne<!--/Name-->
## [Objets magiques](magicitems_hd.md)
### [Objets magiques de A à Z](magicitems_az_hd.md)
### [Objets magiques intelligents](sentient_magicitems_hd.md)
### [Artefacts](artifacts_hd.md)
## [Jouer dans un multivers](planes_hd.md)
<!--/GenericItem-->

18
Data/index_ceo.md Normal file
View file

@ -0,0 +1,18 @@
<!--GenericItem-->
# <!--Name-->Créatures et oppositions<!--/Name-->
## [Créatures](monsters_hd.md)
## [Pièges](traps_hd.md)
## [Maladies](diseases_hd.md)
## [Folie](madness_hd.md)
## [Objets](objects_hd.md)
## [Poisons](poisons_hd.md)
<!--/GenericItem-->

32
Data/index_mdr.md Normal file
View file

@ -0,0 +1,32 @@
<!--GenericItem-->
# <!--Name-->Manuel des règles<!--/Name-->
## [Création du personnage](beyond1stlevel_hd.md)
## [Races](races_hd.md)
## [Personnalité et Historique](personnality_background_hd.md)
## [Classes](classes_hd.md)
## [Équipement](equipment_hd.md)
## [Options de personnalisation](custom_options_hd.md)
## [Utiliser les Caractéristiques](abilities_hd.md)
## [Partir à l'aventure](adventure_hd.md)
## [Combattre](combat_hd.md)
## [Gérer la santé](manage_health_hd.md)
## [Lancer des sorts](spellcasting_hd.md)
## [Description des Sorts](spells_hd.md)
## [Panthéons](pantheons_hd.md)
<!--/GenericItem-->

12
Data/index_srd.md Normal file
View file

@ -0,0 +1,12 @@
<!--GenericItem-->
# <!--Name-->SRD<!--/Name-->
## [Conditions](conditions_vo.md)
## [Spells](spells_vo.md)
## [Monsters, Animals and NPC](monsters_vo.md)
<!--/GenericItem-->

Binary file not shown.