mirror of
https://github.com/Nioux/AideDeJeu.git
synced 2025-10-30 15:06:06 +00:00
Retour du NameLevel
This commit is contained in:
parent
921546d3c2
commit
9719557d2c
5 changed files with 52 additions and 18 deletions
|
|
@ -13,6 +13,7 @@
|
||||||
</ControlTemplate>
|
</ControlTemplate>
|
||||||
|
|
||||||
<Color x:Key="HDRed">#9B1C47</Color>
|
<Color x:Key="HDRed">#9B1C47</Color>
|
||||||
|
<Color x:Key="HDBlue">#5B61FF</Color>
|
||||||
<Color x:Key="HDGrey">#563F5A</Color>
|
<Color x:Key="HDGrey">#563F5A</Color>
|
||||||
<Color x:Key="HDMidGrey">#6F5B73</Color>
|
<Color x:Key="HDMidGrey">#6F5B73</Color>
|
||||||
<Color x:Key="HDLightGrey">#7C7B7B</Color>
|
<Color x:Key="HDLightGrey">#7C7B7B</Color>
|
||||||
|
|
@ -225,7 +226,7 @@
|
||||||
|
|
||||||
<Style TargetType="Label" x:Key="link">
|
<Style TargetType="Label" x:Key="link">
|
||||||
<Setter Property="FontSize" Value="14" />
|
<Setter Property="FontSize" Value="14" />
|
||||||
<Setter Property="TextColor" Value="{StaticResource HDRed}" />
|
<Setter Property="TextColor" Value="{StaticResource HDBlue}" />
|
||||||
<Setter Property="FontFamily" Value="{DynamicResource LinuxLibertine}" />
|
<Setter Property="FontFamily" Value="{DynamicResource LinuxLibertine}" />
|
||||||
</Style>
|
</Style>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -72,7 +72,18 @@ namespace AideDeJeu.Tools
|
||||||
var level = value as int?;
|
var level = value as int?;
|
||||||
if(level.HasValue)
|
if(level.HasValue)
|
||||||
{
|
{
|
||||||
return Application.Current.Resources[$"heading{level.Value+1}"];
|
int finallevel = level.Value;
|
||||||
|
int baselevel = 1;
|
||||||
|
if(int.TryParse(parameter as string, out baselevel))
|
||||||
|
{
|
||||||
|
finallevel += baselevel;
|
||||||
|
}
|
||||||
|
finallevel = Math.Max(1, Math.Min(6, finallevel));
|
||||||
|
var heading = $"heading{finallevel}";
|
||||||
|
if (Application.Current.Resources.ContainsKey(heading))
|
||||||
|
{
|
||||||
|
return Application.Current.Resources[heading];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return Application.Current.Resources["paragraph"];
|
return Application.Current.Resources["paragraph"];
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -111,35 +111,45 @@ namespace AideDeJeu.ViewModels
|
||||||
return currentItem;
|
return currentItem;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ParseItemProperties(string source, Item item, Block block)
|
public bool ParseItemProperties(string source, Item item, Block block)
|
||||||
{
|
{
|
||||||
switch (block)
|
switch (block)
|
||||||
{
|
{
|
||||||
case Markdig.Extensions.Tables.Table table:
|
case Markdig.Extensions.Tables.Table table:
|
||||||
ParseItemProperties(source, item, table);
|
return ParseItemProperties(source, item, table);
|
||||||
break;
|
|
||||||
case ContainerBlock blocks:
|
case ContainerBlock blocks:
|
||||||
ParseItemProperties(source, item, blocks);
|
return ParseItemProperties(source, item, blocks);
|
||||||
break;
|
|
||||||
case LeafBlock leaf:
|
case LeafBlock leaf:
|
||||||
ParseItemProperties(source, item, leaf.Inline);
|
bool isname = ParseItemProperties(source, item, leaf.Inline);
|
||||||
break;
|
if(isname)
|
||||||
|
{
|
||||||
|
if(leaf is HeadingBlock)
|
||||||
|
{
|
||||||
|
var headingBlock = leaf as HeadingBlock;
|
||||||
|
item.NameLevel = headingBlock.Level;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return isname;
|
||||||
}
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ParseItemProperties(string source, Item item, ContainerBlock blocks)
|
public bool ParseItemProperties(string source, Item item, ContainerBlock blocks)
|
||||||
{
|
{
|
||||||
|
bool isname = false;
|
||||||
foreach (var block in blocks)
|
foreach (var block in blocks)
|
||||||
{
|
{
|
||||||
ParseItemProperties(source, item, block);
|
isname |= ParseItemProperties(source, item, block);
|
||||||
}
|
}
|
||||||
|
return isname;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ParseItemProperties(string source, Item item, ContainerInline inlines)
|
public bool ParseItemProperties(string source, Item item, ContainerInline inlines)
|
||||||
{
|
{
|
||||||
|
bool isname = false;
|
||||||
if (inlines == null)
|
if (inlines == null)
|
||||||
{
|
{
|
||||||
return;
|
return isname;
|
||||||
}
|
}
|
||||||
PropertyInfo prop = null;
|
PropertyInfo prop = null;
|
||||||
foreach (var inline in inlines)
|
foreach (var inline in inlines)
|
||||||
|
|
@ -158,6 +168,10 @@ namespace AideDeJeu.ViewModels
|
||||||
else if (tag.StartsWith("<!--") && !tag.StartsWith("<!--/"))
|
else if (tag.StartsWith("<!--") && !tag.StartsWith("<!--/"))
|
||||||
{
|
{
|
||||||
var propertyName = tag.Substring(4, tag.Length - 7);
|
var propertyName = tag.Substring(4, tag.Length - 7);
|
||||||
|
if(propertyName == "Name")
|
||||||
|
{
|
||||||
|
isname = true;
|
||||||
|
}
|
||||||
prop = item.GetType().GetProperty(propertyName, BindingFlags.Public | BindingFlags.Instance);
|
prop = item.GetType().GetProperty(propertyName, BindingFlags.Public | BindingFlags.Instance);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -169,6 +183,7 @@ namespace AideDeJeu.ViewModels
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return isname;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,13 @@
|
||||||
x:Class="AideDeJeu.Views.FilteredItemsPage"
|
x:Class="AideDeJeu.Views.FilteredItemsPage"
|
||||||
x:Name="This"
|
x:Name="This"
|
||||||
Title="{Binding Title}">
|
Title="{Binding Title}">
|
||||||
|
<MasterDetailPage.Resources>
|
||||||
|
<ResourceDictionary>
|
||||||
|
<tools:MonsterMarkdownTheme x:Key="MonsterMarkdownTheme" />
|
||||||
|
<tools:NullToFalseConverter x:Key="NullToFalseConverter" />
|
||||||
|
<tools:HeaderLevelToStyleConverter x:Key="HeaderLevelToStyleConverter" />
|
||||||
|
</ResourceDictionary>
|
||||||
|
</MasterDetailPage.Resources>
|
||||||
<MasterDetailPage.ToolbarItems>
|
<MasterDetailPage.ToolbarItems>
|
||||||
<ToolbarItem Name="Filter" Text="Filtrer" Order="Primary" Icon="funnel.png" Clicked="Button_Clicked" />
|
<ToolbarItem Name="Filter" Text="Filtrer" Order="Primary" Icon="funnel.png" Clicked="Button_Clicked" />
|
||||||
<ToolbarItem Name="AddToFavorites" Text="Ajouter aux favoris" Order="Primary" Icon="round_star.png" Command="{Binding Main.Navigator.AddToFavoritesCommand}" />
|
<ToolbarItem Name="AddToFavorites" Text="Ajouter aux favoris" Order="Primary" Icon="round_star.png" Command="{Binding Main.Navigator.AddToFavoritesCommand}" />
|
||||||
|
|
@ -49,10 +56,10 @@
|
||||||
<ListView Grid.Column="0" Grid.Row="1" x:Name="ItemsListView" ItemsSource="{Binding Children}" VerticalOptions="FillAndExpand" HasUnevenRows="true" CachingStrategy="RecycleElement" SelectedItem="{Binding SelectedItem}" ItemTapped="ItemsListView_ItemTapped">
|
<ListView Grid.Column="0" Grid.Row="1" x:Name="ItemsListView" ItemsSource="{Binding Children}" VerticalOptions="FillAndExpand" HasUnevenRows="true" CachingStrategy="RecycleElement" SelectedItem="{Binding SelectedItem}" ItemTapped="ItemsListView_ItemTapped">
|
||||||
<ListView.ItemTemplate>
|
<ListView.ItemTemplate>
|
||||||
<DataTemplate>
|
<DataTemplate>
|
||||||
<ViewCell AutomationProperties.IsInAccessibleTree="True" AutomationId="machin" AutomationProperties.Name="hop">
|
<ViewCell>
|
||||||
<StackLayout Padding="10" Orientation="Vertical">
|
<StackLayout Padding="10" Orientation="Vertical">
|
||||||
<Label Text="{Binding Name}" LineBreakMode="WordWrap" Style="{DynamicResource heading3}" FontSize="16" />
|
<Label Text="{Binding Name}" LineBreakMode="WordWrap" TextColor="{StaticResource HDBlue}" Style="{Binding NameLevel,Converter={StaticResource HeaderLevelToStyleConverter}, ConverterParameter=1}" />
|
||||||
<Label Text="{Binding AltNameText}" LineBreakMode="WordWrap" Style="{DynamicResource heading3}" FontSize="12" />
|
<Label Text="{Binding AltNameText}" LineBreakMode="WordWrap" TextColor="{StaticResource HDLightGrey}" Style="{Binding NameLevel,Converter={StaticResource HeaderLevelToStyleConverter}, ConverterParameter=4}" />
|
||||||
</StackLayout>
|
</StackLayout>
|
||||||
</ViewCell>
|
</ViewCell>
|
||||||
</DataTemplate>
|
</DataTemplate>
|
||||||
|
|
|
||||||
|
|
@ -31,8 +31,8 @@
|
||||||
<DataTemplate>
|
<DataTemplate>
|
||||||
<ViewCell>
|
<ViewCell>
|
||||||
<StackLayout Padding="10" Orientation="Vertical">
|
<StackLayout Padding="10" Orientation="Vertical">
|
||||||
<Label Text="{Binding Name}" LineBreakMode="WordWrap" TextColor="#0366d6" Style="{Binding NameLevel,Converter={StaticResource HeaderLevelToStyleConverter}}" />
|
<Label Text="{Binding Name}" LineBreakMode="WordWrap" TextColor="{StaticResource HDBlue}" Style="{Binding NameLevel,Converter={StaticResource HeaderLevelToStyleConverter}, ConverterParameter=1}" />
|
||||||
<Label Text="{Binding AltNameText}" LineBreakMode="WordWrap" Style="{DynamicResource heading3}" FontSize="12" />
|
<Label Text="{Binding AltNameText}" LineBreakMode="WordWrap" TextColor="{StaticResource HDLightGrey}" Style="{Binding NameLevel,Converter={StaticResource HeaderLevelToStyleConverter}, ConverterParameter=4}" />
|
||||||
</StackLayout>
|
</StackLayout>
|
||||||
</ViewCell>
|
</ViewCell>
|
||||||
</DataTemplate>
|
</DataTemplate>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue