1
0
Fork 0
mirror of https://github.com/Nioux/AideDeJeu.git synced 2025-12-16 23:29:47 +00:00

Test multilien + correctif null pointer

This commit is contained in:
Yan Maniez 2018-06-21 23:44:26 +02:00
parent 9c629b4fcc
commit 6a8ee5f49c
2 changed files with 26 additions and 16 deletions

View file

@ -161,21 +161,30 @@ namespace AideDeJeu.ViewModels
public async Task NavigateToLink(string s)
{
var regex = new Regex("/(?<file>.*)\\.md#(?<anchor>.*)");
var match = regex.Match(s);
var file = match.Groups["file"].Value;
var anchor = match.Groups["anchor"].Value;
if (file == "spells_hd")
if (s != null)
{
var spells = await GetItemsViewModel(ItemSourceType.SpellHD).GetAllItemsAsync();
var spell = spells.Where(i => i.Id == anchor).FirstOrDefault();
await Navigator.GotoSpellDetailPageAsync(spell);
}
else if (file == "monsters_hd")
{
var monsters = await GetItemsViewModel(ItemSourceType.MonsterHD).GetAllItemsAsync();
var monster = monsters.Where(i => i.Id == anchor).FirstOrDefault();
await Navigator.GotoMonsterDetailPageAsync(monster);
var regex = new Regex("/(?<file>.*)\\.md#(?<anchor>.*)");
var match = regex.Match(s);
var file = match.Groups["file"].Value;
var anchor = match.Groups["anchor"].Value;
if (file == "spells_hd")
{
var spells = await GetItemsViewModel(ItemSourceType.SpellHD).GetAllItemsAsync();
var spell = spells.Where(i => i.Id == anchor).FirstOrDefault();
if (spell != null)
{
await Navigator.GotoSpellDetailPageAsync(spell);
}
}
else if (file == "monsters_hd")
{
var monsters = await GetItemsViewModel(ItemSourceType.MonsterHD).GetAllItemsAsync();
var monster = monsters.Where(i => i.Id == anchor).FirstOrDefault();
if (monster != null)
{
await Navigator.GotoMonsterDetailPageAsync(monster);
}
}
}
}