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

Nettoyage encore

This commit is contained in:
Yan Maniez 2018-06-30 18:55:10 +02:00
parent 9b8f86ab63
commit 468a17131e
5 changed files with 1 additions and 134 deletions

View file

@ -144,7 +144,7 @@ namespace AideDeJeuLib.Cards
//new FillCardContent(1),
//new TextCardContent(spell.DescriptionText),
});
var description = ToContents(spell.DescriptionDiv.SelectSingleNode("div"));
var description = ToContents(null); // spell.DescriptionDiv.SelectSingleNode("div"));
foreach (var line in description)
{
int size = contents.Sum(cc => cc.Height);

View file

@ -54,37 +54,7 @@ namespace AideDeJeuLib.Spells
public string Components { get; set; }
public string Duration { get; set; }
public string DescriptionHtml { get; set; }
public string DescriptionText
{
get
{
return DescriptionDiv?.InnerText?.Replace("\n", "\n\n");
}
}
[IgnoreDataMember]
public XmlNode DescriptionDiv
{
get
{
if(DescriptionHtml != null)
{
XmlDocument xdoc = new XmlDocument();
xdoc.LoadXml(DescriptionHtml);
return xdoc.DocumentElement;
//HtmlDocument doc = new HtmlDocument() { OptionOutputAsXml = true };
//doc.LoadHtml(DescriptionHtml);
//return doc.DocumentNode;
}
return null;
}
set
{
DescriptionHtml = value?.OuterXml;
}
}
public string Overflow { get; set; }
public string NoOverflow { get; set; }
public string Source { get; set; }
}

View file

@ -19,8 +19,6 @@ namespace AideDeJeu.ViewModels
set
{
SetProperty(ref _Item, value);
OnPropertyChanged(nameof(Description));
OnPropertyChanged(nameof(DescriptionList));
OnPropertyChanged(nameof(TypeLevel));
OnPropertyChanged(nameof(CastingTime));
OnPropertyChanged(nameof(Range));
@ -29,34 +27,6 @@ namespace AideDeJeu.ViewModels
}
}
public FormattedString Description
{
get
{
var fs = new FormattedString();
if (Item?.DescriptionDiv != null)
{
FormatedTextHelpers.HtmlNodeToFormatedString(global::AideDeJeuLib.Item.StringToNode(Item?.DescriptionHtml), fs, FontAttributes.None);
}
return fs;
}
}
public ObservableCollection<FormattedString> DescriptionList
{
get
{
var list = new ObservableCollection<FormattedString>();
list.Add(TypeLevel);
list.Add(CastingTime);
list.Add(Range);
list.Add(Components);
list.Add(Duration);
list.Add(TypeLevel);
return list;
}
}
public FormattedString TypeLevel
{
get
@ -131,29 +101,6 @@ namespace AideDeJeu.ViewModels
}
async Task ExecuteLoadItemCommand()
{
if (IsBusy)
return;
IsBusy = true;
try
{
//Item.ParseHtml();
//Item = _Item;
//using (var spellsScrappers = new SpellsScrappers())
//{
// var item = await spellsScrappers.GetSpell(Item.Id);
// Item = item;
//}
}
catch (Exception ex)
{
Debug.WriteLine(ex);
}
finally
{
IsBusy = false;
}
}
}

View file

@ -21,17 +21,11 @@
<Label Text="{Binding Item.NamePHB}" Style="{StaticResource Key=subsection}" />
<mdview:MarkdownView x:Name="mdNameVO" Theme="{StaticResource MonsterMarkdownTheme}" Markdown="{Binding Item.NameVO}" />
<!--<Label Text="{Binding Item.NameVO}" Style="{StaticResource Key=content}" />-->
<!--<Label Text="{Binding Item.Name}" Style="{StaticResource Key=content}" />-->
<!--<Label Text=" " />-->
<Label FormattedText="{Binding TypeSizeAlignment}" />
<skia:SKCanvasView PaintSurface="PaintRedBar" HorizontalOptions="FillAndExpand" HeightRequest="8"/>
<!--<BoxView WidthRequest="100" HeightRequest="2" Color="#922610" />-->
<Label FormattedText="{Binding ArmorClass}" Style="{StaticResource Key=content}" />
<Label FormattedText="{Binding HitPoints}" Style="{StaticResource Key=content}" />
<Label FormattedText="{Binding Speed}" Style="{StaticResource Key=content}" />
@ -75,36 +69,28 @@
<Label FormattedText="{Binding ConditionImmunities}" IsVisible="{Binding Item.ConditionImmunities, Converter={StaticResource NullToFalseConverter}}" Style="{StaticResource Key=content}" />
<Label FormattedText="{Binding Senses}" IsVisible="{Binding Item.Senses, Converter={StaticResource NullToFalseConverter}}" Style="{StaticResource Key=content}" />
<Label FormattedText="{Binding Languages}" IsVisible="{Binding Item.Languages, Converter={StaticResource NullToFalseConverter}}" Style="{StaticResource Key=content}" />
<!--<Label FormattedText="{Binding Power}" Style="{StaticResource Key=content}" />-->
<Label FormattedText="{Binding Challenge}" IsVisible="{Binding Item.Challenge, Converter={StaticResource NullToFalseConverter}}" Style="{StaticResource Key=content}" />
<skia:SKCanvasView PaintSurface="PaintRedBar" HorizontalOptions="FillAndExpand" HeightRequest="8"/>
<Label Text="Capacités" Style="{StaticResource Key=subsubsection}" IsVisible="{Binding Item.SpecialFeatures, Converter={StaticResource NullToFalseConverter}}" />
<!--<Label FormattedText="{Binding Item.SpecialFeatures, Converter={StaticResource HtmlNodesToFormattedStringConverter}}" IsVisible="{Binding Item.SpecialFeatures, Converter={StaticResource NullToFalseConverter}}" />-->
<mdview:MarkdownView x:Name="mdSpecialFeatures" Theme="{StaticResource MonsterMarkdownTheme}" Markdown="{Binding Item.SpecialFeatures, Converter={StaticResource HtmlNodesToFormattedStringConverter}}" IsVisible="{Binding Item.SpecialFeatures, Converter={StaticResource NullToFalseConverter}}" />
<Label Text="Actions" Style="{StaticResource Key=subsubsection}" IsVisible="{Binding Item.Actions, Converter={StaticResource NullToFalseConverter}}" />
<!--<Label FormattedText="{Binding Item.Actions, Converter={StaticResource HtmlNodesToFormattedStringConverter}}" IsVisible="{Binding Item.Actions, Converter={StaticResource NullToFalseConverter}}" />-->
<mdview:MarkdownView x:Name="mdActions" Theme="{StaticResource MonsterMarkdownTheme}" Markdown="{Binding Item.Actions, Converter={StaticResource HtmlNodesToFormattedStringConverter}}" IsVisible="{Binding Item.Actions, Converter={StaticResource NullToFalseConverter}}" />
<Label Text="Réactions" Style="{StaticResource Key=subsubsection}" IsVisible="{Binding Item.Reactions, Converter={StaticResource NullToFalseConverter}}" />
<!--<Label FormattedText="{Binding Item.Reactions, Converter={StaticResource HtmlNodesToFormattedStringConverter}}" IsVisible="{Binding Item.Reactions, Converter={StaticResource NullToFalseConverter}}" />-->
<mdview:MarkdownView x:Name="mdReactions" Theme="{StaticResource MonsterMarkdownTheme}" Markdown="{Binding Item.Reactions, Converter={StaticResource HtmlNodesToFormattedStringConverter}}" IsVisible="{Binding Item.Reactions, Converter={StaticResource NullToFalseConverter}}" />
<Label Text="Actions légendaires" Style="{StaticResource Key=subsubsection}" IsVisible="{Binding Item.LegendaryActions, Converter={StaticResource NullToFalseConverter}}" />
<!--<Label FormattedText="{Binding Item.LegendaryActions, Converter={StaticResource HtmlNodesToFormattedStringConverter}}" IsVisible="{Binding Item.LegendaryActions, Converter={StaticResource NullToFalseConverter}}" />-->
<mdview:MarkdownView x:Name="mdLegendaryActions" Theme="{StaticResource MonsterMarkdownTheme}" Markdown="{Binding Item.LegendaryActions, Converter={StaticResource HtmlNodesToFormattedStringConverter}}" IsVisible="{Binding Item.LegendaryActions, Converter={StaticResource NullToFalseConverter}}" />
<skia:SKCanvasView PaintSurface="PaintHeaderBar" HorizontalOptions="FillAndExpand" HeightRequest="8" />
<Label Text="{Binding Item.Description}" Style="{StaticResource Key=content}" />
<!--<Label Text="{Binding Item.Picture}" Style="{StaticResource Key=content}" />-->
<Label Text="{Binding Item.Legendary}" Style="{StaticResource Key=content}" />
<Label Text="{Binding Item.Source}" Style="{StaticResource Key=content}" />
<Image Source="{Binding Item.Picture}" />
</StackLayout>
</ScrollView>
</ContentPage>

View file

@ -17,57 +17,21 @@
<StackLayout Orientation="Vertical" Padding="15">
<Label Text="{Binding Item.NamePHB}" Style="{StaticResource Key=subsection}" />
<mdview:MarkdownView x:Name="mdNameVO" Theme="{StaticResource MonsterMarkdownTheme}" Markdown="{Binding Item.NameVO}" />
<!--<Label Text="{Binding Item.NameVO}" Style="{StaticResource Key=content}" />-->
<!--<Label Text="{Binding Item.Name}" Style="{StaticResource Key=content}" />-->
<Label Text=" " />
<Label FormattedText="{Binding TypeLevel}" />
<!--<StackLayout Orientation="Horizontal">
<Label Text="{Binding Item.Type}" Style="{StaticResource Key=contentital}" />
<Label Text="{Binding Item.Level, StringFormat='de niveau {0}'}" Style="{StaticResource Key=contentital}" />
</StackLayout>-->
<Label FormattedText="{Binding CastingTime}" />
<!--<StackLayout Orientation="Horizontal">
<Label Text="Durée d'incantation :" LineBreakMode="NoWrap" Style="{StaticResource Key=contentbold}" />
<Label Text="{Binding Item.CastingTime}" Style="{StaticResource Key=content}" />
</StackLayout>-->
<Label FormattedText="{Binding Range}" />
<!--<StackLayout Orientation="Horizontal">
<Label Text="Portée :" LineBreakMode="NoWrap" Style="{StaticResource Key=contentbold}" />
<Label Text="{Binding Item.Range}" Style="{StaticResource Key=content}" />
</StackLayout>-->
<Label FormattedText="{Binding Components}" />
<!--<StackLayout Orientation="Horizontal">
<Label Text="Composantes :" LineBreakMode="NoWrap" Style="{StaticResource Key=contentbold}" />
<Label Text="{Binding Item.Components}" Style="{StaticResource Key=content}" />
</StackLayout>-->
<Label FormattedText="{Binding Duration}" />
<!--<StackLayout Orientation="Horizontal">
<Label Text="Durée :" LineBreakMode="NoWrap" Style="{StaticResource Key=contentbold}" />
<Label Text="{Binding Item.Duration}" Style="{StaticResource Key=content}" />
</StackLayout>-->
<Label Text=" " />
<!--<ListView HasUnevenRows="True" RowHeight="-1" SeparatorVisibility="None" IsPullToRefreshEnabled="False" ItemsSource="{Binding DescriptionList}" ItemTapped="ListView_ItemTapped">
<ListView.ItemTemplate>
<DataTemplate>
<ViewCell>
<ViewCell.View>
<Label BindingContext="{Binding}" FormattedText="{Binding}" Style="{StaticResource Key=content}" />
</ViewCell.View>
</ViewCell>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>-->
<!--<Label FormattedText="{Binding Description}" Style="{StaticResource Key=content}" />-->
<!--<Label FormattedText="{Binding Item.DescriptionHtml, Converter={StaticResource HtmlNodeToFormattedStringConverter}}" IsVisible="{Binding Item.DescriptionHtml, Converter={StaticResource NullToFalseConverter}}" Style="{StaticResource Key=content}" />-->
<mdview:MarkdownView x:Name="mdDescription" Theme="{StaticResource MonsterMarkdownTheme}" Markdown="{Binding Item.DescriptionHtml}" IsVisible="{Binding Item.DescriptionHtml, Converter={StaticResource NullToFalseConverter}}" />
<Label Text="{Binding Item.Source}" Style="{StaticResource Key=content}" />