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

Modifs search

This commit is contained in:
Yan Maniez 2018-10-24 22:41:37 +02:00
parent 13acf0d971
commit 2d038f47b8
6 changed files with 11 additions and 7 deletions

View file

@ -69,7 +69,7 @@ namespace Xam.Forms.Markdown
Attributes = FontAttributes.None,
BorderSize = 4,
FontSize = 12,
BackgroundColor = Color.Gray.MultiplyAlpha(.1),
BackgroundColor = Color.White // Color.Gray.MultiplyAlpha(.1),
};
this.Separator = new MarkdownStyle

View file

@ -54,7 +54,7 @@ namespace AideDeJeu.ViewModels
int position = markdown.IndexOf(searchText);
int startPosition = Math.Max(0, position - 30);
int endPosition = Math.Min(markdown.Length, position + searchText.Length + 30);
return markdown.Substring(startPosition, endPosition - startPosition - 1);
return $"\"{markdown.Substring(startPosition, endPosition - startPosition - 1).Replace("\n","")}\"";
}
public async Task<IEnumerable<SearchedItem>> DeepSearchAllItemsAsync(string searchText)
@ -63,13 +63,13 @@ namespace AideDeJeu.ViewModels
{
var primary = await context.Items.
Where(item => EF.Functions.Like(item.Name, $"%{searchText}%")).
Select(item => new SearchedItem() { Item = item, Preview = item.Name }).
Select(item => new SearchedItem() { Item = item, Preview = item.ParentName != null ? $"> {item.ParentName}" : "" }).
ToListAsync();
var secondary = await context.Items.
Where(item => EF.Functions.Like(item.Markdown, $"%{searchText}%")).
Select(item => new SearchedItem()
{
Item = item, Preview = GetPreview(item.Markdown, searchText)
Item = item, Preview = (item.ParentName != null ? $"> {item.ParentName} > " : "") + GetPreview(item.Markdown, searchText)
}).ToListAsync();
//var primary = await context.Items.
// Where(item => item.Name.Contains(searchText)).

View file

@ -36,8 +36,8 @@
<DataTemplate>
<ViewCell AutomationProperties.IsInAccessibleTree="True" AutomationId="machin" AutomationProperties.Name="hop">
<StackLayout Padding="10" Orientation="Vertical">
<Label Text="{Binding Preview}" LineBreakMode="WordWrap" Style="{DynamicResource heading3}" FontSize="16" />
<Label Text="{Binding Item.Name}" LineBreakMode="WordWrap" Style="{DynamicResource heading3}" FontSize="12" />
<Label Text="{Binding Item.Name}" LineBreakMode="WordWrap" Style="{DynamicResource heading3}" FontSize="16" />
<Label Text="{Binding Preview}" LineBreakMode="WordWrap" Style="{DynamicResource heading3}" FontSize="12" />
</StackLayout>
</ViewCell>
</DataTemplate>

View file

@ -300,6 +300,10 @@ namespace AideDeJeuCmd
var store = new StoreViewModel();
await store.PreloadAllItemsAsync();
var index = store._AllItems.Where(it => it.Value.RootId == "index.md").FirstOrDefault();
index.Value.Id = index.Value.RootId;
index.Value.Name = "Bibliothèque";
using (var context = await StoreViewModel.GetLibraryContextAsync())
{
await context.Database.EnsureDeletedAsync();

Binary file not shown.

View file

@ -1 +1 @@
9
11