mirror of
https://github.com/Nioux/AideDeJeu.git
synced 2025-12-16 07:10:32 +00:00
Modifs search
This commit is contained in:
parent
13acf0d971
commit
2d038f47b8
6 changed files with 11 additions and 7 deletions
|
|
@ -69,7 +69,7 @@ namespace Xam.Forms.Markdown
|
||||||
Attributes = FontAttributes.None,
|
Attributes = FontAttributes.None,
|
||||||
BorderSize = 4,
|
BorderSize = 4,
|
||||||
FontSize = 12,
|
FontSize = 12,
|
||||||
BackgroundColor = Color.Gray.MultiplyAlpha(.1),
|
BackgroundColor = Color.White // Color.Gray.MultiplyAlpha(.1),
|
||||||
};
|
};
|
||||||
|
|
||||||
this.Separator = new MarkdownStyle
|
this.Separator = new MarkdownStyle
|
||||||
|
|
|
||||||
|
|
@ -54,7 +54,7 @@ namespace AideDeJeu.ViewModels
|
||||||
int position = markdown.IndexOf(searchText);
|
int position = markdown.IndexOf(searchText);
|
||||||
int startPosition = Math.Max(0, position - 30);
|
int startPosition = Math.Max(0, position - 30);
|
||||||
int endPosition = Math.Min(markdown.Length, position + searchText.Length + 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)
|
public async Task<IEnumerable<SearchedItem>> DeepSearchAllItemsAsync(string searchText)
|
||||||
|
|
@ -63,13 +63,13 @@ namespace AideDeJeu.ViewModels
|
||||||
{
|
{
|
||||||
var primary = await context.Items.
|
var primary = await context.Items.
|
||||||
Where(item => EF.Functions.Like(item.Name, $"%{searchText}%")).
|
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();
|
ToListAsync();
|
||||||
var secondary = await context.Items.
|
var secondary = await context.Items.
|
||||||
Where(item => EF.Functions.Like(item.Markdown, $"%{searchText}%")).
|
Where(item => EF.Functions.Like(item.Markdown, $"%{searchText}%")).
|
||||||
Select(item => new SearchedItem()
|
Select(item => new SearchedItem()
|
||||||
{
|
{
|
||||||
Item = item, Preview = GetPreview(item.Markdown, searchText)
|
Item = item, Preview = (item.ParentName != null ? $"> {item.ParentName} > " : "") + GetPreview(item.Markdown, searchText)
|
||||||
}).ToListAsync();
|
}).ToListAsync();
|
||||||
//var primary = await context.Items.
|
//var primary = await context.Items.
|
||||||
// Where(item => item.Name.Contains(searchText)).
|
// Where(item => item.Name.Contains(searchText)).
|
||||||
|
|
|
||||||
|
|
@ -36,8 +36,8 @@
|
||||||
<DataTemplate>
|
<DataTemplate>
|
||||||
<ViewCell AutomationProperties.IsInAccessibleTree="True" AutomationId="machin" AutomationProperties.Name="hop">
|
<ViewCell AutomationProperties.IsInAccessibleTree="True" AutomationId="machin" AutomationProperties.Name="hop">
|
||||||
<StackLayout Padding="10" Orientation="Vertical">
|
<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="16" />
|
||||||
<Label Text="{Binding Item.Name}" LineBreakMode="WordWrap" Style="{DynamicResource heading3}" FontSize="12" />
|
<Label Text="{Binding Preview}" LineBreakMode="WordWrap" Style="{DynamicResource heading3}" FontSize="12" />
|
||||||
</StackLayout>
|
</StackLayout>
|
||||||
</ViewCell>
|
</ViewCell>
|
||||||
</DataTemplate>
|
</DataTemplate>
|
||||||
|
|
|
||||||
|
|
@ -300,6 +300,10 @@ namespace AideDeJeuCmd
|
||||||
var store = new StoreViewModel();
|
var store = new StoreViewModel();
|
||||||
await store.PreloadAllItemsAsync();
|
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())
|
using (var context = await StoreViewModel.GetLibraryContextAsync())
|
||||||
{
|
{
|
||||||
await context.Database.EnsureDeletedAsync();
|
await context.Database.EnsureDeletedAsync();
|
||||||
|
|
|
||||||
BIN
Data/library.db
BIN
Data/library.db
Binary file not shown.
|
|
@ -1 +1 @@
|
||||||
9
|
11
|
||||||
Loading…
Add table
Add a link
Reference in a new issue